chore(nvim): Converted normal command shortcut to Lua
This commit is contained in:
parent
b9c32dfd52
commit
0261c07d0a
2 changed files with 24 additions and 15 deletions
|
@ -1,23 +1,32 @@
|
|||
-- Loaded by `null.config`
|
||||
local remap = function(mode, key, target, opts)
|
||||
vim.api.nvim_set_keymap(mode, key, target, opts or {
|
||||
noremap = true,
|
||||
silent = true,
|
||||
})
|
||||
local map = function(modes, key, target, opts)
|
||||
local mt = {}
|
||||
|
||||
for mode in modes:gmatch"." do
|
||||
table.insert(mt, mode)
|
||||
end
|
||||
|
||||
vim.keymap.set(mt, key, target, opts or {
|
||||
noremap = true,
|
||||
silent = true,
|
||||
})
|
||||
end
|
||||
|
||||
-- Map Ctrl+U as U so it can be used as redo
|
||||
remap("n", "<C-u>", "U")
|
||||
map("n", "<C-u>", "U")
|
||||
-- Map U as redo
|
||||
remap("n", "U", "<C-r>")
|
||||
map("n", "U", "<C-r>")
|
||||
|
||||
-- Yank and Put
|
||||
remap("n", "<C-y>", '"+y')
|
||||
remap("n", "<C-p>", '"+p')
|
||||
remap("n", "<C-Y>", '"+y')
|
||||
remap("n", "<C-P>", '"+p')
|
||||
map("n", "<C-y>", '"+y')
|
||||
map("n", "<C-p>", '"+p')
|
||||
map("n", "<C-Y>", '"+y')
|
||||
map("n", "<C-P>", '"+p')
|
||||
|
||||
-- Comment a line like how it is on VSC (using vim-commentary)
|
||||
remap("n", "<C-/>", "gcc", { noremap = false })
|
||||
remap("v", "<C-/>", "gc", { noremap = false })
|
||||
remap("i", "<C-/>", "<esc>gcc", { noremap = false })
|
||||
map("n", "<C-/>", "gcc", { remap = true })
|
||||
map("v", "<C-/>", "gc", { remap = true })
|
||||
map("i", "<C-/>", "<esc>gcc", { remap = true })
|
||||
|
||||
-- Normal command shortcut for VISUAL mode
|
||||
map("v", ".", ":normal .<CR>")
|
||||
|
|
|
@ -37,7 +37,7 @@ set foldlevel=1
|
|||
autocmd FileType python setlocal foldmethod=indent
|
||||
|
||||
" ----- Mapping
|
||||
" Norm but in shortcut
|
||||
" Norm but in shortcut -- converted
|
||||
vnoremap . :normal .<CR>
|
||||
|
||||
" Map ctrl + u as U -- converted
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue