Skip to content

Commit 793f80b

Browse files
committed
nvim: Add some keybindings
1 parent ff75b66 commit 793f80b

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

nvim/.config/nvim/init.lua

+3
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,6 @@ end
1414
-- Initialize lazy.nvim
1515
vim.opt.runtimepath:prepend(lazypath)
1616
require('lazy').setup('plugins', {})
17+
18+
-- Import config modules
19+
require('keybindings')

nvim/.config/nvim/lua/keybindings.lua

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
local mapopts = { silent = true, noremap = true }
2+
3+
-- Builtins
4+
vim.keymap.set('n', '<leader>w', '<cmd>write<cr>', mapopts)
5+
vim.keymap.set('n', '<leader>j', '<cmd>join<cr>', mapopts)
6+
vim.keymap.set('n', 'J', '5j', mapopts)
7+
vim.keymap.set('n', 'K', '5k', mapopts)
8+
vim.keymap.set('i', 'jj', '<esc>', mapopts)
9+
vim.keymap.set('n', '<c-j>', '<c-w>j', mapopts)
10+
vim.keymap.set('n', '<c-k>', '<c-w>k', mapopts)
11+
vim.keymap.set('n', '<c-h>', '<c-w>h', mapopts)
12+
vim.keymap.set('n', '<c-l>', '<c-w>l', mapopts)
13+
14+
-- Helpers
15+
vim.keymap.set('n', '<leader>s', [[:%s/\s\+$//e<cr>]])
16+
17+
-- Plugin bindings
18+
vim.keymap.set('n', '<leader>e', '<cmd>NvimTreeToggle<cr>', mapopts)

0 commit comments

Comments
 (0)