From 6af1d0d7b18ecd4f771b8aa1d96dfcbe00355ead Mon Sep 17 00:00:00 2001 From: srdusr Date: Tue, 20 Feb 2024 23:58:34 +0200 Subject: Add vimtex keys --- lua/user/keys.lua | 441 ++++++++++++++++++++++++++++-------------------------- 1 file changed, 229 insertions(+), 212 deletions(-) (limited to 'lua') diff --git a/lua/user/keys.lua b/lua/user/keys.lua index 11de667..87d852b 100644 --- a/lua/user/keys.lua +++ b/lua/user/keys.lua @@ -6,14 +6,14 @@ local map = function(mode, l, r, opts) keymap.set(mode, l, r, opts) end local term_opts = { noremap = true, silent = false } -local mods = require('user.mods') +local mods = require("user.mods") local bufnr = vim.api.nvim_get_current_buf() -- Semi-colon as leader key -vim.g.mapleader = ';' +vim.g.mapleader = ";" -- "jk" and "kj" to exit insert-mode -map('i', 'jk', '') +map("i", "jk", "") -- Jump to next match on line using `.` instead of `;` NOTE: commented out in favour of "ggandor/flit.nvim" --map("n", ".", ";") @@ -22,395 +22,404 @@ map('i', 'jk', '') --map("n", "", ".") -- Reload nvim config -map('n', '', "luafile ~/.config/nvim/init.lua | :echom ('Nvim config loading...') | :sl! | echo ('')") +map("n", "", + "luafile ~/.config/nvim/init.lua | :echom ('Nvim config loading...') | :sl! | echo ('')") --------------- Extended Operations --------------- -- Conditional 'q' to quit on floating/quickfix/help windows otherwise still use it for macros -- TODO: Have a list of if available on system/packages, example "Zen Mode" to not work on it (quit Zen Mode) -map('n', 'q', function() +map("n", "q", function() local config = vim.api.nvim_win_get_config(0) - if config.relative ~= '' then -- is_floating_window? - return ':silent! close!' - elseif vim.o.buftype == 'quickfix' then - return ':quit' - elseif vim.o.buftype == 'help' then - return ':close' + if config.relative ~= "" then -- is_floating_window? + return ":silent! close!" + elseif vim.o.buftype == "quickfix" then + return ":quit" + elseif vim.o.buftype == "help" then + return ":close" else - return 'q' + return "q" end end, { expr = true, replace_keycodes = true }) -- Edit new file -map('n', 'e', [[:e =expand("%:h")..'/']], { noremap = true, silent = true, desc = 'New file' }) +map("n", ";", [[:e =expand("%:h")..'/']], { noremap = true, silent = true, desc = "New file" }) -- Write as sudo -map('c', 'W', "exe 'w !sudo tee >/dev/null %:p:S' | setl nomod", { silent = true, desc = 'Write as Sudo' }) +map("c", "W", "exe 'w !sudo tee >/dev/null %:p:S' | setl nomod", { silent = true, desc = "Write as Sudo" }) -- Combine buffers list with buffer name -map('n', 'b', ':buffers:buffer') +map("n", "b", ":buffers:buffer") -- Buffer confirmation -map('n', 'y', ':BufferPick') +map("n", "y", ":BufferPick") --- Map buffer next, prev and delete to +(n/p/d) respectively -map('n', 'n', ':bn') -map('n', 'p', ':bp') -map('n', 'd', ':bd') +-- Map buffer next, prev and delete to +(n/p/d) respectively and tab/s-tab +map("n", "n", ":bn") +map("n", "p", ":bp") +map("n", "d", ":bd") +map("n", "", ":bnext") +map("n", "", ":bprevious") -- Delete file of current buffer -map('n', 'rm', "call delete(expand('%')) | bdelete!") +map("n", "rm", "call delete(expand('%')) | bdelete!") -- List marks -map('n', 'm', ':marks') +map("n", "m", ":marks") -- Messages -map('n', 'M', ':messages') +map("n", "M", ":messages") --- Clear messages or just refresh/redraw the screen -map('n', 'i', "lua require('notify').dismiss()") +map("n", "i", "lua require('notify').dismiss()") -- Unsets the 'last search pattern' register by hitting return --map("n", "", "!silent :noh") -- Toggle set number -map('n', '$', ':NumbersToggle') -map('n', '%', ':NumbersOnOff') +map("n", "$", ":NumbersToggle") +map("n", "%", ":NumbersOnOff") -- Easier split navigations, just ctrl-j instead of ctrl-w then j -map('t', '', '') -map('t', '', '') -map('t', '', '') -map('t', '', '') -map('t', '', '') +map("t", "", "") +map("t", "", "") +map("t", "", "") +map("t", "", "") +map("t", "", "") -- Split window -map('n', 'h', ':split') -map('n', 'v', ':vsplit') -map('n', 'c', 'c') +map("n", "-", ":split") +map("n", "\\", ":vsplit") +map("n", "c", "c") -- Resize Panes -map('n', '+', ':resize +5') -map('n', '-', ':resize -5') -map('n', '<', ':vertical resize +5') -map('n', '>', ':vertical resize -5') -map('n', '=', '=') +--map('n', '+', ':resize +5') +--map('n', '-', ':resize -5') +map("n", "<", ":vertical resize +5") +map("n", ">", ":vertical resize -5") +map("n", "=", "=") -- Map Alt+(h/j/k/l) in insert(include terminal/command) mode to move directional -map({ 'i', 't', 'c' }, '', '') -map({ 'i', 't', 'c' }, '', '') -map({ 'i', 't', 'c' }, '', '') -map({ 'i', 't', 'c' }, '', '') +map({ "i", "t", "c" }, "", "") +map({ "i", "t", "c" }, "", "") +map({ "i", "t", "c" }, "", "") +map({ "i", "t", "c" }, "", "") -- Create tab, edit and move between them -map('n', 'n', ':tabnew') -map('n', 'e', ':tabedit') -map('n', '[', ':tabprev') -map('n', ']', ':tabnext') +map("n", "n", ":tabnew") +map("n", "e", ":tabedit") +map("n", "[", ":tabprev") +map("n", "]", ":tabnext") -- "Zoom" a split window into a tab and/or close it --map("n", ",", ":tabnew %") --map("n", ".", ":tabclose") -- Vim TABs -map('n', '1', '1gt') -map('n', '2', '2gt') -map('n', '3', '3gt') -map('n', '4', '4gt') -map('n', '5', '5gt') -map('n', '6', '6gt') -map('n', '7', '7gt') -map('n', '8', '8gt') -map('n', '9', '9gt') -map('n', '0', '10gt') +map("n", "1", "1gt") +map("n", "2", "2gt") +map("n", "3", "3gt") +map("n", "4", "4gt") +map("n", "5", "5gt") +map("n", "6", "6gt") +map("n", "7", "7gt") +map("n", "8", "8gt") +map("n", "9", "9gt") +map("n", "0", "10gt") -- Hitting ESC when inside a terminal to get into normal mode --map("t", "", [[]]) -- Move block (indentation) easily -map('n', '<', '<<', term_opts) -map('n', '>', '>>', term_opts) -map('x', '<', '', '>gv', term_opts) +--map("n", "<", "<<", term_opts) +--map("n", ">", ">>", term_opts) +--map("x", "<", "", ">gv", term_opts) +map("v", "<", "", ">gv") +map("n", "<", "<") +map("n", ">", ">") -- Set alt+(j/k) to switch lines of texts or simply move them -map('n', '', ':let save_a=@a"add"ap:let @a=save_a') -map('n', '', ':let save_a=@a"add"ap:let @a=save_a') +map("n", "", ':let save_a=@a"add"ap:let @a=save_a') +map("n", "", ':let save_a=@a"add"ap:let @a=save_a') -- Toggle Diff -map('n', 'df', 'call utils#ToggleDiff()') +map("n", "df", "call utils#ToggleDiff()") -- Toggle Verbose -map('n', 'uvt', 'call utils#VerboseToggle()') +map("n", "uvt", "call utils#VerboseToggle()") -- Jump List -map('n', 'j', 'call utils#GotoJump()') +map("n", "j", "call utils#GotoJump()") -- Rename file -map('n', 'rf', 'call utils#RenameFile()') +map("n", "rf", "call utils#RenameFile()") -- Map delete to Ctrl+l -map('i', '', '') +map("i", "", "") -- Clear screen -map('n', '', '!clear') +map("n", "", "!clear") -- Change file to an executable -map('n', 'x', ":lua require('user.mods').Toggle_executable() | :echom ('Toggle executable') | :sl! | echo ('')") +map("n", "x", + ":lua require('user.mods').Toggle_executable() | :echom ('Toggle executable') | :sl! | echo ('')") -- map("n", "x", ":!chmod +x %") -- Paste without replace clipboard -map('v', 'p', '"_dP') +map("v", "p", '"_dP') -- Swap two pieces of text, use x to cut in visual mode, then use Ctrl-x in -- visual mode to select text to swap with --map("v", "", "`.``gvP``P") -- Change Working Directory to current project -map('n', 'cd', ':cd %:p:h:pwd') +map("n", "cd", ":cd %:p:h:pwd") -- Open the current file in the default program (on Mac this should just be just `open`) -map('n', 'o', ':!xdg-open %') +map("n", "o", ":!xdg-open %") -- URL handling -if vim.fn.has('mac') == 1 then - map('', 'gx', 'call jobstart(["open", expand("")], {"detach": v:true})', {}) -elseif vim.fn.has('unix') == 1 then - map('', 'gx', 'call jobstart(["xdg-open", expand("")], {"detach": v:true})', {}) -elseif vim.fn.has('wsl') == 1 then - map('', 'gx', 'call jobstart(["wslview", expand("")], {"detach": v:true})', {}) +if vim.fn.has("mac") == 1 then + map("", "gx", 'call jobstart(["open", expand("")], {"detach": v:true})', {}) +elseif vim.fn.has("unix") == 1 then + map("", "gx", 'call jobstart(["xdg-open", expand("")], {"detach": v:true})', {}) +elseif vim.fn.has("wsl") == 1 then + map("", "gx", 'call jobstart(["wslview", expand("")], {"detach": v:true})', {}) else - map[''].gx = { 'lua print("Error: gx is not supported on this OS!")' } + map[""].gx = { 'lua print("Error: gx is not supported on this OS!")' } end -- Search and replace -map('v', 'sr', 'y:%s/"//gc') +map("v", "sr", 'y:%s/"//gc') -- Substitute globally and locally in the selected region. -map('n', 's', ':%s//g') -map('v', 's', ':s//g') +map("n", "s", ":%s//g") +map("v", "s", ":s//g") -- Toggle completion -map('n', 'tc', ':lua require("user.mods").toggle_completion()') +map("n", "tc", ':lua require("user.mods").toggle_completion()') -- Disable default completion. -map('i', '', '') -map('i', '', '') +map("i", "", "") +map("i", "", "") -- Set line wrap -map('n', '', function() - local wrap_status = vim.api.nvim_exec('set wrap ?', true) +map("n", "", function() + local wrap_status = vim.api.nvim_exec("set wrap ?", true) - if wrap_status == 'nowrap' then - vim.api.nvim_command('set wrap linebreak') - print('Wrap enabled') + if wrap_status == "nowrap" then + vim.api.nvim_command("set wrap linebreak") + print("Wrap enabled") else - vim.api.nvim_command('set wrap nowrap') - print('Wrap disabled') + vim.api.nvim_command("set wrap nowrap") + print("Wrap disabled") end end, { silent = true }) -- Toggle between folds ---utils.map("n", "", "&foldlevel ? 'zM' : 'zR'", { expr = true }) +map("n", "", "&foldlevel ? 'zM' : 'zR'", { expr = true }) -- Use space to toggle fold -map('n', '', 'za') +--map("n", "", "za") -- Make a copy of current file --vim.cmd([[ -- map s :up \| saveas! %:p:r-=strftime("%y.%m.%d-%H:%M")-bak.=expand("%:e") \| 3sleep \| e # --]]) -map('n', '.b', ':!cp % %.backup') +map("n", ".b", ":!cp % %.backup") -- Toggle transparency -map('n', 'tb', ':call utils#Toggle_transparent_background()') +map("n", "tb", ":call utils#Toggle_transparent_background()") -- Toggle zoom -map('n', 'z', ':call utils#ZoomToggle()') -map('n', 'z', '|_') +map("n", "z", ":call utils#ZoomToggle()") +map("n", "z", "|_") -- Toggle statusline -map('n', 'sl', ':call utils#ToggleHiddenAll()') +map("n", "sl", ":call utils#ToggleHiddenAll()") -- Open last closed buffer -map('n', '', ':call OpenLastClosed()') +map("n", "", ":call OpenLastClosed()") ---------------- Plugin Operations ---------------- -- Packer -map('n', 'Pc', 'PackerCompile') -map('n', 'Pi', 'PackerInstall') -map('n', 'Ps', 'PackerSync') -map('n', 'PS', 'PackerStatus') -map('n', 'Pu', 'PackerUpdate') +map("n", "Pc", "PackerCompile") +map("n", "Pi", "PackerInstall") +map("n", "Ps", "PackerSync") +map("n", "PS", "PackerStatus") +map("n", "Pu", "PackerUpdate") -- Tmux navigation (aserowy/tmux.nvim) -map('n', '', 'NavigatorLeft') -map('n', '', 'NavigatorRight') -map('n', '', 'NavigatorUp') -map('n', '', 'NavigatorDown') +map("n", "", "NavigatorLeft") +map("n", "", "NavigatorRight") +map("n", "", "NavigatorUp") +map("n", "", "NavigatorDown") -- ToggleTerm -map({ 'n', 't' }, 'tt', 'ToggleTerm') -map({ 'n', 't' }, 'th', 'lua Horizontal_term_toggle()') -map({ 'n', 't' }, 'tv', 'lua Vertical_term_toggle()') +map({ "n", "t" }, "tt", "ToggleTerm") +map({ "n", "t" }, "th", "lua Horizontal_term_toggle()") +map({ "n", "t" }, "tv", "lua Vertical_term_toggle()") -- LazyGit -map({ 'n', 't' }, 'gg', 'lua Lazygit_toggle()') +map({ "n", "t" }, "gg", "lua Lazygit_toggle()") -map('n', 'tg', 'lua Gh_dash()') +map("n", "tg", "lua Gh_dash()") -- Fugitive git bindings -map('n', 'gs', vim.cmd.Git) -map('n', 'ga', ':Git add %:p') +map("n", "gs", vim.cmd.Git) +map("n", "ga", ":Git add %:p") --map("n", "gs", ":Gstatus") -map('n', 'gc', ':Gcommit -v -q') -map('n', 'gt', ':Gcommit -v -q %:p') +map("n", "gc", ":Gcommit -v -q") +map("n", "gt", ":Gcommit -v -q %:p") --map("n", "gd", ":Gdiff") -map('n', 'ge', ':Gedit') +map("n", "ge", ":Gedit") --map("n", "gr", ":Gread") -map('n', 'gw', ':Gwrite') -map('n', 'gl', ':silent! Glog:bot copen') +map("n", "gw", ":Gwrite") +map("n", "gl", ":silent! Glog:bot copen") --map("n", "gp", ":Ggrep") --map("n", "gp", ":Git push") --map("n", "gb", ":Gblame") -map('n', 'gm', ':Gmove') +map("n", "gm", ":Gmove") --map("n", "gb", ":Git branch") --map("n", "go", ":Git checkout") --map("n", "gps", ":Dispatch! git push") --map("n", "gpl", ":Dispatch! git pull") -- Telescope -map('n', 'ff', ":cd %:p:h:pwdlua require('telescope.builtin').find_files()") -- find files with hidden option -map('n', 'fF', ":cd %:p:h:pwdlua require('user.mods').findFilesInCwd()", { noremap = true, silent = true, desc = 'Find files in cwd' }) -map('n', 'f.', function() - require('telescope.builtin').find_files({ hidden = true, no_ignore = true }) +map("n", "ff", ":cd %:p:h:pwdlua require('telescope.builtin').find_files()") -- find files with hidden option +map("n", "fF", ":cd %:p:h:pwdlua require('user.mods').findFilesInCwd()", + { noremap = true, silent = true, desc = "Find files in cwd" }) +map("n", "f.", function() + require("telescope.builtin").find_files({ hidden = true, no_ignore = true }) end) -- find all files -map('n', 'fg', "lua require('telescope.builtin').live_grep()") -map('n', 'fb', "lua require('telescope.builtin').buffers()") -map('n', 'fh', "lua require('telescope.builtin').help_tags()") -map('n', 'fc', "lua require('telescope.builtin').commands()") -map('n', 'cf', 'Telescope changed_files') -map('n', 'fp', 'Telescope pickers') -map('n', 'fd', "lua require('telescope.builtin').diagnostics()") -map('n', 'fk', "lua require('telescope.builtin').keymaps()") -map('n', 'fr', "lua require('telescope.builtin').registers({})") -- registers picker -map('n', 'fm', "lua require('telescope').extensions.media_files.media_files({})") -- find media files -map('n', 'fi', "lua require('telescope').extensions.notify.notify({})") -- find notifications -map('n', 'fs', 'lua require("session-lens").search_session()') -map('n', 'ffd', [[lua require'plugins.telescope'.find_dirs()]]) -- find dies -map('n', 'ff.', [[lua require'plugins.telescope'.find_configs()]]) -- find configs -map('n', 'ffs', [[lua require'plugins.telescope'.find_scripts()]]) -- find scripts -map('n', 'ffw', [[lua require'plugins.telescope'.find_projects()]]) -- find projects -map('n', 'ffb', [[lua require'plugins.telescope'.find_books()]]) -- find books -map('n', 'ffn', [[lua require'plugins.telescope'.find_notes()]]) -- find notes -map('n', 'fgn', [[lua require'plugins.telescope'.grep_notes()]]) -- search notes -map('n', 'frf', "lua require('telescope').extensions.recent_files.pick()") -map('n', 'ffc', "lua require('telescope.builtin').current_buffer_fuzzy_find()") -map('n', 'f/', "lua require('telescope').extensions.file_browser.file_browser()") +map("n", "fg", "lua require('telescope.builtin').live_grep()") +map("n", "fb", "lua require('telescope.builtin').buffers()") +map("n", "fh", "lua require('telescope.builtin').help_tags()") +map("n", "fc", "lua require('telescope.builtin').commands()") +map("n", "cf", "Telescope changed_files") +map("n", "fp", "Telescope pickers") +map("n", "fd", "lua require('telescope.builtin').diagnostics()") +map("n", "fk", "lua require('telescope.builtin').keymaps()") +map("n", "fr", "lua require('telescope.builtin').registers({})") -- registers picker +map("n", "fm", "lua require('telescope').extensions.media_files.media_files({})") -- find media files +map("n", "fi", "lua require('telescope').extensions.notify.notify({})") -- find notifications +map("n", "fs", 'lua require("session-lens").search_session()') +map("n", "ffd", [[lua require'plugins.telescope'.find_dirs()]]) -- find dies +map("n", "ff.", [[lua require'plugins.telescope'.find_configs()]]) -- find configs +map("n", "ffs", [[lua require'plugins.telescope'.find_scripts()]]) -- find scripts +map("n", "ffw", [[lua require'plugins.telescope'.find_projects()]]) -- find projects +map("n", "ffb", [[lua require'plugins.telescope'.find_books()]]) -- find books +map("n", "ffn", [[lua require'plugins.telescope'.find_notes()]]) -- find notes +map("n", "fgn", [[lua require'plugins.telescope'.grep_notes()]]) -- search notes +map("n", "frf", "lua require('telescope').extensions.recent_files.pick()") +map("n", "ffc", "lua require('telescope.builtin').current_buffer_fuzzy_find()") +map("n", "f/", "lua require('telescope').extensions.file_browser.file_browser()") --map("n", "f/", "lua require('plugins.telescope').curbuf()") -- find files with hidden option -- Map a shortcut to open the picker. -- FZF -map('n', 'fz', "lua require('fzf-lua').files()") +map("n", "fz", "lua require('fzf-lua').files()") -- Nvim-tree -map('n', 'f', 'Rooter:NvimTreeToggle', {}) +map("n", "e", "Rooter:NvimTreeToggle", {}) -- Undotree -map('n', 'u', vim.cmd.UndotreeToggle) +map("n", "u", vim.cmd.UndotreeToggle) -- Markdown-preview -map('n', 'md', 'MarkdownPreviewToggle') -map('n', 'mg', 'Glow') +map("n", "md", "MarkdownPreviewToggle") +map("n", "mg", "Glow") -- Autopairs -map('n', 'ww', "lua require('user.mods').Toggle_autopairs()") +map("n", "ww", "lua require('user.mods').Toggle_autopairs()") -- Zen-mode toggle -map('n', 'zm', "ZenMode | :echom ('Zen Mode') | :sl! | echo ('')") +map("n", "zm", "ZenMode | :echom ('Zen Mode') | :sl! | echo ('')") -- Vim-rooter -map('n', 'ro', "Rooter | :echom ('cd to root/project directory') | :sl! | echo ('')", term_opts) +map("n", "ro", "Rooter | :echom ('cd to root/project directory') | :sl! | echo ('')", term_opts) -- Trouble (UI to show diagnostics) -map('n', 't', ':cd %:p:h:pwdTroubleToggle') -map('n', 'tw', ':cd %:p:h:pwdTroubleToggle workspace_diagnostics') -map('n', 'td', ':cd %:p:h:pwdTroubleToggle document_diagnostics') -map('n', 'tq', ':cd %:p:h:pwdTroubleToggle quickfix') -map('n', 'tl', ':cd %:p:h:pwdTroubleToggle loclist') -map('n', 'gR', 'TroubleToggle lsp_references') +map("n", "t", ":cd %:p:h:pwdTroubleToggle") +map("n", "tw", ":cd %:p:h:pwdTroubleToggle workspace_diagnostics") +map("n", "td", ":cd %:p:h:pwdTroubleToggle document_diagnostics") +map("n", "tq", ":cd %:p:h:pwdTroubleToggle quickfix") +map("n", "tl", ":cd %:p:h:pwdTroubleToggle loclist") +map("n", "gR", "TroubleToggle lsp_references") -- Null-ls -map('n', 'ls', 'NullLsToggle') +map("n", "ls", "NullLsToggle") -- Replacer -map('n', 'qr', ':lua require("replacer").run()') +map("n", "qr", ':lua require("replacer").run()') -- Quickfix -map('n', 'q', function() +map("n", "q", function() if vim.fn.getqflist({ winid = 0 }).winid ~= 0 then - require('plugins.quickfix').close() + require("plugins.quickfix").close() else - require('plugins.quickfix').open() + require("plugins.quickfix").open() end -end, { desc = 'Toggle quickfix window' }) +end, { desc = "Toggle quickfix window" }) -- Move to the next and previous item in the quickfixlist -map('n', ']c', 'cnext') -map('n', '[c', 'cprevious') +map("n", "]c", "cnext") +map("n", "[c", "cprevious") -- Location list -map('n', 'l', 'lua require("plugins.loclist").loclist_toggle()') +map("n", "l", 'lua require("plugins.loclist").loclist_toggle()') -- Dap (debugging) -local dap_ok, dap = pcall(require, 'dap') -local dap_ui_ok, ui = pcall(require, 'dapui') +local dap_ok, dap = pcall(require, "dap") +local dap_ui_ok, ui = pcall(require, "dapui") if not (dap_ok and dap_ui_ok) then - require('notify')('nvim-dap or dap-ui not installed!', 'warning') + require("notify")("nvim-dap or dap-ui not installed!", "warning") return end -vim.fn.sign_define('DapBreakpoint', { text = '🐞' }) +vim.fn.sign_define("DapBreakpoint", { text = "🐞" }) -- Start debugging session -map('n', 'ds', function() +map("n", "ds", function() dap.continue() ui.toggle({}) - vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes('=', false, true, true), 'n', false) -- Spaces buffers evenly + vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes("=", false, true, true), "n", false) -- Spaces buffers evenly end) -- Set breakpoints, get variable values, step into/out of functions, etc. -map('n', 'dC', dap.continue) +map("n", "dC", dap.continue) -- map("n", "dC", dap.close) -- map("n", "dt", dap.terminate) -map('n', 'dt', ui.toggle) -map('n', 'dd', function() +map("n", "dt", ui.toggle) +map("n", "dd", function() dap.disconnect({ terminateDebuggee = true }) end) -map('n', 'dn', dap.step_over) -map('n', 'di', dap.step_into) -map('n', 'do', dap.step_out) -map('n', 'db', dap.toggle_breakpoint) -map('n', 'dB', function() +map("n", "dn", dap.step_over) +map("n", "di", dap.step_into) +map("n", "do", dap.step_out) +map("n", "db", dap.toggle_breakpoint) +map("n", "dB", function() dap.clear_breakpoints() - require('notify')('Breakpoints cleared', 'warn') + require("notify")("Breakpoints cleared", "warn") end) -map('n', 'dl', require('dap.ui.widgets').hover) -map('n', 'de', function() - require('dapui').float_element() -end, { desc = 'Open Element' }) -map('n', 'dq', function() - require('dapui').close() - require('dap').repl.close() - local session = require('dap').session() +map("n", "dl", require("dap.ui.widgets").hover) +map("n", "de", function() + require("dapui").float_element() +end, { desc = "Open Element" }) +map("n", "dq", function() + require("dapui").close() + require("dap").repl.close() + local session = require("dap").session() if session then - require('dap').terminate() + require("dap").terminate() end - require('nvim-dap-virtual-text').refresh() -end, { desc = 'Terminate Debug' }) -map('n', 'dc', function() - require('telescope').extensions.dap.commands() -end, { desc = 'DAP-Telescope: Commands' }) + require("nvim-dap-virtual-text").refresh() +end, { desc = "Terminate Debug" }) +map("n", "dc", function() + require("telescope").extensions.dap.commands() +end, { desc = "DAP-Telescope: Commands" }) --vim.keymap.set("n", "B", ":lua require'dap'.set_breakpoint(vim.fn.input('Breakpoint condition: '))") --vim.keymap.set("v", "B", ":lua require'dap'.set_breakpoint(vim.fn.input('Breakpoint condition: '))") --vim.keymap.set("n", "lp", ":lua require'dap'.set_breakpoint(nil, nil, vim.fn.input('Log point message: '))") @@ -426,30 +435,38 @@ end, { desc = 'DAP-Telescope: Commands' }) --end) -- Toggle Dashboard -map('n', '', 'lua require("user.mods").toggle_dashboard()') +map("n", "", 'lua require("user.mods").toggle_dashboard()') -- Lsp Lines toggle -map('', 'll', require('lsp_lines').toggle, { desc = 'Toggle lsp_lines' }) +map("", "ll", require("lsp_lines").toggle, { desc = "Toggle lsp_lines" }) -- SnipRun -map({ 'n', 'v' }, 'r', 'SnipRun') +map({ "n", "v" }, "r", "SnipRun") -- Codi -map('n', 'co', 'lua require("user.mods").toggleCodi()') +map("n", "co", 'lua require("user.mods").toggleCodi()') -- Scratch buffer -map('n', 'ss', 'lua require("user.mods").Scratch("float")') -map('n', 'sh', 'lua require("user.mods").Scratch("horizontal")') -map('n', 'sv', 'lua require("user.mods").Scratch("vertical")') +map("n", "ss", 'lua require("user.mods").Scratch("float")') +map("n", "sh", 'lua require("user.mods").Scratch("horizontal")') +map("n", "sv", 'lua require("user.mods").Scratch("vertical")') -- Hardtime -map('n', 'H', 'lua require("plugins.hardtime").ToggleHardtime()') +map("n", "H", 'lua require("plugins.hardtime").ToggleHardtime()') -- Code Run -map('n', 'rr', 'lua require("user.mods").toggleCodeRunner()') +map("n", "rr", 'lua require("user.mods").toggleCodeRunner()') -- Run executable file -map('n', 'rx', ":lua require('user.mods').RunCurrentFile():echom 'Running executable file...':sl!:echo ''") +map("n", "rx", + ":lua require('user.mods').RunCurrentFile():echom 'Running executable file...':sl!:echo ''") -- Close all floating windows -map({ 'n', 't', 'c' }, 'w', 'CloseFloatingWindows') +map({ "n", "t", "c" }, "w", "CloseFloatingWindows") + +-- Vimtex +map("n", "lc", ":VimtexCompile") +map("v", "ls", ":VimtexCompileSelected") +map("n", "li", ":VimtexInfo") +map("n", "lt", ":VimtexTocToggle") +map("n", "lv", ":VimtexView") -- cgit v1.2.3