-- https://github.com/arnvald/viml-to-lua/blob/main/lua/mappings.lua vim.cmd('noremap :noh:call clearmatches()') -- clear matches Ctrl+b function map(mode, shortcut, command) vim.api.nvim_set_keymap(mode, shortcut, command, { noremap = true, silent = true }) end function nmap(shortcut, command) map('n', shortcut, command) end function imap(shortcut, command) map('i', shortcut, command) end function vmap(shortcut, command) map('v', shortcut, command) end function cmap(shortcut, command) map('c', shortcut, command) end function tmap(shortcut, command) map('t', shortcut, command) end -- PLUGINS -- Keymaps for Luasnip local ls = require("luasnip") vim.keymap.set({ "i", "s" }, "", function() if ls.expand_or_jumpable() then ls.expand_or_jump() end end, { silent = true }) vim.keymap.set({ "i", "s" }, "", function() if ls.jumpable(-1) then ls.jump(-1) end end, { silent = true }) vim.keymap.set("i", "", function() if ls.choice_active() then ls.change_choice(1) end end) -- Find files using Telescope command-line sugar. nmap("", "Telescope find_files") nmap("f", "Telescope live_grep") nmap("bb", "Telescope buffers") nmap("hh", "Telescope help_tags") -- LSP nmap('K', 'Lspsaga hover_doc') imap('', 'Lspsaga hover_doc') nmap('gh', 'Lspsaga lsp_finder') nmap('', 'Lspsaga show_line_diagnostics')