dotfiles/mzte-nv/conf/lua/maps.lua

42 lines
1.5 KiB
Lua
Raw Normal View History

local map = vim.api.nvim_set_keymap
2022-10-22 00:38:18 +02:00
local opts = { noremap = true, silent = true }
2021-09-01 00:15:10 +02:00
2021-04-20 14:34:02 +02:00
-- Getting stuck in ~~vim~~ terminal
2021-04-20 14:43:22 +02:00
map("t", "<Esc>", "<C-\\><C-n>", {})
2021-09-11 18:13:25 +02:00
2021-04-20 14:34:02 +02:00
-- Quick cursor movement
2022-10-22 00:38:18 +02:00
map("n", "<C-Down>", "5j", opts)
map("n", "<C-Up>", "5k", opts)
2021-04-20 14:34:02 +02:00
-- Quick pasting/yoinking to system register
2022-10-22 00:38:18 +02:00
map("n", "+y", '"+y', opts)
map("n", "+p", '"+p', opts)
map("n", "+d", '"+d', opts)
map("n", "*y", '"*y', opts)
map("n", "*p", '"*p', opts)
map("n", "*d", '"*d', opts)
2021-04-20 14:34:02 +02:00
2022-10-25 21:28:38 +02:00
-- Vimgrep
map("n", "<F4>", "<cmd>:cnext<CR>", opts)
map("n", "<S-F4>", "<cmd>:cprevious<CR>", opts)
2022-10-22 00:38:18 +02:00
-- See `:help vim.lsp.*` for documentation on any of the below functions
map("n", "-a", "<cmd>lua vim.lsp.buf.code_action()<CR>", opts)
map("n", "-d", "<cmd>lua vim.diagnostic.goto_next()<CR>", opts)
2022-11-29 21:45:00 +01:00
map("n", "-n", "<cmd>lua vim.lsp.buf.rename()<CR>", opts)
2022-10-22 00:38:18 +02:00
map("n", "-r", "<cmd>lua vim.lsp.buf.format { asnyc = true }<CR>", opts)
2022-11-29 21:45:00 +01:00
map("n", "<C-k>", "<cmd>lua vim.lsp.buf.signature_help()<CR>", opts)
map("n", "<space>e", "<cmd>lua vim.diagnostic.open_float()<CR>", opts)
map("n", "K", "<cmd>lua vim.lsp.buf.hover()<CR>", opts)
map("n", "gd", "<cmd>Telescope lsp_definitions<CR>", opts)
map("n", "gi", "<cmd>Telescope lsp_implementations<CR>", opts)
map("n", "gp", "<cmd>Telescope diagnostics bufnr=0<CR>", opts)
2022-12-11 16:23:58 +01:00
map("n", "gP", "<cmd>Telescope diagnostics<CR>", opts)
2022-11-29 21:45:00 +01:00
map("n", "gr", "<cmd>Telescope lsp_references<CR>", opts)
2022-11-11 18:47:09 +01:00
-- command to stop LSP servers
vim.api.nvim_create_user_command("StopLsps", function()
vim.lsp.stop_client(vim.lsp.get_active_clients())
end, { nargs = 0 })