dotfiles/nvim/lua/maps.lua

51 lines
1.7 KiB
Lua
Raw Normal View History

2021-04-20 14:34:02 +02:00
local map = vim.api.nvim_set_keymap
-- Getting stuck in ~~vim~~ terminal
2021-04-20 14:43:22 +02:00
map("t", "<Esc>", "<C-\\><C-n>", {})
map("n", "fzf", ":FZF<CR>", { silent = true })
2021-04-20 14:34:02 +02:00
-- Quick cursor movement
2021-04-20 14:43:22 +02:00
map("n", "<C-Down>", "5j", { noremap = true })
map("n", "<C-Up>", "5k", { noremap = true })
2021-04-20 14:34:02 +02:00
-- Quick pasting/yoinking to system register
map("n", "+y", "\"+y", { noremap = true })
map("n", "+p", "\"+p", { noremap = true })
map("n", "+d", "\"+d", { noremap = true })
map("n", "*y", "\"*y", { noremap = true })
map("n", "*p", "\"*p", { noremap = true })
map("n", "*d", "\"*d", { noremap = true })
-- symbol renaming
2021-05-13 16:37:41 +02:00
map("n", "-n", "<Plug>(coc-rename)", { silent = true })
2021-04-20 14:34:02 +02:00
-- apply AutoFix to problem on current line
2021-05-13 16:37:41 +02:00
map("n", "-f", "<Plug>(coc-fix-current)", { silent = true })
2021-04-20 14:34:02 +02:00
-- open action dialog
2021-05-13 16:37:41 +02:00
map("n", "-a", ":CocAction<CR>", { silent = true })
2021-04-20 14:34:02 +02:00
-- GoTo code navigation.
2021-04-20 14:43:22 +02:00
map("n", "gd", "<Plug>(coc-definition)", { silent = true })
map("n", "gy", "<Plug>(coc-type-definition)", { silent = true })
map("n", "gi", "<Plug>(coc-implementation)", { silent = true })
map("n", "gr", "<Plug>(coc-references)", { silent = true })
2021-04-20 14:34:02 +02:00
-- Use K to show documentation in preview window.
2021-04-20 14:43:22 +02:00
map("n", "K", ":call CocActionAsync(\'doHover\')<CR>", { silent = true })
2021-04-20 14:34:02 +02:00
-- use space o to show symbols
2021-04-20 14:43:22 +02:00
map("n", "<space>o", ":CocList -I symbols<CR>", { silent = true })
2021-04-20 14:34:02 +02:00
-- format code
2021-05-13 16:37:41 +02:00
map("n", "-r", ":call CocActionAsync(\'format\')<CR>", { silent = true })
2021-04-20 14:34:02 +02:00
2021-04-20 15:12:56 +02:00
-- Use <c-space> to trigger completion.
map("i", "<c-space>", "coc#refresh()", { silent = true, expr = true })
2021-05-13 16:37:41 +02:00
-- Use -d to jump to next diagnostic
map("n", "-d", "<Plug>(coc-diagnostic-next)", { silent = true })
2021-04-24 15:58:23 +02:00
2021-05-13 16:37:41 +02:00
-- Use -o to show outline
map("n", "-o", ":CocList outline<CR>", { silent = true })
2021-05-01 20:23:43 +02:00