dotfiles/nvim/lua/maps.lua

42 lines
1.4 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-04-20 14:43:22 +02:00
map("n", "cn", "<Plug>(coc-rename)", { silent = true })
2021-04-20 14:34:02 +02:00
-- apply AutoFix to problem on current line
2021-04-20 14:43:22 +02:00
map("n", "cf", "<Plug>(coc-fix-current)", { silent = true })
2021-04-20 14:34:02 +02:00
-- open action dialog
2021-04-20 14:43:22 +02:00
map("n", "ca", ":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-04-20 14:43:22 +02:00
map("n", "cr", ":call CocActionAsync(\'format\')<CR>", { silent = true })
2021-04-20 14:34:02 +02:00