neovim-config/lua/keymap.lua

57 lines
1.6 KiB
Lua
Raw Normal View History

2024-04-17 20:47:26 +00:00
local function map(mode, lhs, rhs, opts)
local options = { noremap=true, silent=true }
if opts then
options = vim.tbl_extend('force', options, opts)
end
vim.api.nvim_set_keymap(mode, lhs, rhs, options)
end
map("n", "<leader><F3>", ":NvimTreeToggle<CR>")
map("n", "<F3>", ":NvimTreeFindFileToggle<CR>")
map("n", "<F4>", ":Buffers<CR>")
map("n", "<F2>", ":TagbarToggle<CR>")
map("n", "<leader>e", ":CocList diagnostics<CR>")
map("n", "<C-P>", ":Telescope find_files<cr>")
map("n", "<leader>s", ":Telescope live_grep glob_pattern=*.{ts,html,c,h,go,json,py,sh,lua,vim,rs,txt}<cr>")
map("n", "<leader>sc", ":noh<CR>")
map("n", "gs", ":call CocAction('jumpDefinition', 'split')<CR>")
2024-07-16 08:01:56 +00:00
map("n", "gt", ":CocCommand clangd.switchSourceHeader<CR>")
2024-04-17 20:47:26 +00:00
map("n", "<leader>1", "1gt")
map("n", "<leader>2", "2gt")
map("n", "<leader>3", "3gt")
map("n", "<leader>4", "4gt")
map("n", "<leader>5", "5gt")
map("n", "<leader>6", "6gt")
map("n", "<leader>7", "7gt")
map("n", "<leader>8", "8gt")
map("n", "<leader>9", "9gt")
map("n", "<leader>0", ":tablast<cr>")
map("n", "<leader><F9>", ":call vimspector#ToggleBreakpoint( input( \"Enter condition: \" ) )<CR>")
2024-04-22 08:23:34 +00:00
2024-04-22 12:34:34 +00:00
map("", "<UP>", "<NOP>")
map("", "<DOWN>", "<NOP>")
map("", "<RIGHT>", "<NOP>")
map("", "<LEFT>", "<NOP>")
map("i", "<RIGHT>", "<NOP>")
map("i", "<LEFT>", "<NOP>")
2024-04-22 08:23:34 +00:00
map("n", "<leader>t", ":bo 15split +term<CR>")
map("t", "<ESC>", "<C-\\><C-N>")
2024-04-22 12:34:34 +00:00
map("n", "<A-j>", ":m .+1<CR>==")
map("n", "<A-k>", ":m .-2<CR>==")
map("i", "<A-j>", "<Esc>:m .+1<CR>==gi")
map("i", "<A-k>", "<Esc>:m .-2<CR>==gi")
map("v", "<A-j>", ":m '>+1<CR>gv=gv")
map("v", "<A-k>", ":m '<-2<CR>gv=gv")