etc/nvim/lua/maps.lua

74 lines
1.9 KiB
Lua
Raw Normal View History

2023-08-26 11:47:29 +03:00
2023-08-27 13:31:42 +03:00
vim.o.timeout = false
2023-08-26 11:47:29 +03:00
-- Key mapping
local map = vim.api.nvim_set_keymap
-- Configuration fast editing.
2023-08-29 17:39:24 +03:00
local opts = {silent = true}
2023-08-26 15:09:08 +03:00
map('n', '\\rconf', ':source $HOME/lib/nvim/init.lua\n', opts)
map('n', '\\econf', ':e $HOME/lib/nvim/init.lua\n', opts)
2023-08-26 12:20:56 +03:00
map('n', '\\emap', ':e $HOME/lib/nvim/lua/maps.lua\n', opts)
2023-09-07 09:21:41 +03:00
-- Quit
map('n', '\\q', ":quit\n", opts)
map('n', '\\qa', ":qa\n", opts)
2023-08-29 13:42:38 +03:00
-- Moving around.
2023-08-28 13:47:12 +03:00
map('n', '\\home', ":cd $HOME\n", opts)
2023-09-07 09:21:41 +03:00
map('n', '\\cd', ":cd ", {silent = false})
map('n', '\\lcd', ":lcd ", {silent = false})
map('n', '\\tcd', ":tcd ", {silent = false})
map('n', '\\pwd', ':pwd\n', {silent = false})
map('n', '\\aa', ':argadd ', {silent = false})
map('n', '\\bb', ':b ', {silent = false})
map('n', '\\b#', ':b#\n ', {silent = true})
2023-08-29 13:42:38 +03:00
2023-08-29 17:39:24 +03:00
map('n', '\\lex', ":Lexplore\n", opts)
map('n', '\\ex', ":Explore\n", opts)
2023-08-29 13:42:38 +03:00
-- Search
map('n', '\\noh', ':noh\n', opts)
2023-08-26 11:47:29 +03:00
2023-08-26 12:20:56 +03:00
-- Tabs.
map('n', '\\tn', ':tabnew\n', opts)
2023-08-26 11:47:29 +03:00
2023-09-07 09:21:41 +03:00
-- Insert
-- Literal tabs with Shift-Tab
map('i', '<S-Tab>', '\t', opts)
2023-08-26 15:09:08 +03:00
2023-09-07 09:21:41 +03:00
-- Empty
map('n', '<C-l>', '', opts)
-- vim.api.nvim_del_keymap('n', '<C-l>')
-- vim.api.nvim_del_keymap('n', '<C-r>')
2023-08-26 11:47:29 +03:00
-- Windows
-- Moving
2023-09-08 18:04:07 +03:00
map('n', '<S-b>', '<C-b>', opts)
map('n', '<S-f>', '<C-f>', opts)
2023-08-26 11:47:29 +03:00
opts = {silent = true}
2023-08-26 12:20:56 +03:00
map('n', '<A-l>', '<C-w>l', opts)
map('n', '<A-h>', '<C-w>h', opts)
map('n', '<A-k>', '<C-w>k', opts)
map('n', '<A-j>', '<C-w>j', opts)
-- Resizing
2023-09-08 18:04:07 +03:00
map('n', '+', '<C-w>+', opts)
map('n', '-', '<C-w>-', opts)
2023-09-07 09:21:41 +03:00
-- map('n', '<C-h>', '3<C-w><', opts)
-- map('n', '<C-l>', '3<C-w>>', opts)
2023-08-30 10:59:08 +03:00
map('n', '<Space>', '3<C-w>>', opts)
map('n', '<C-Space>', '3<C-w><', opts)
2023-08-26 11:47:29 +03:00
-- Splitting
map('n', '\\|', '<C-w>v', opts)
map('n', '\\-', '<C-w>s', opts)
2023-09-07 09:21:41 +03:00
-- Netrw
vim.api.nvim_create_autocmd('filetype', {
pattern = 'netrw',
callback = function()
local buf = vim.api.nvim_get_current_buf()
vim.api.nvim_buf_set_keymap(buf, "n", 'f', '%', opts)
end,
})