From 8922578321d9e3a0be5d6dbedabd039406c2740b Mon Sep 17 00:00:00 2001 From: Gustaf Rydholm Date: Thu, 31 Mar 2022 00:07:48 +0200 Subject: feat(settings): add keymaps --- fnl/settings/keymaps.fnl | 57 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 fnl/settings/keymaps.fnl (limited to 'fnl') diff --git a/fnl/settings/keymaps.fnl b/fnl/settings/keymaps.fnl new file mode 100644 index 0000000..9c4b0e8 --- /dev/null +++ b/fnl/settings/keymaps.fnl @@ -0,0 +1,57 @@ +-- Custom keymappings. +(module settings.keymaps + {autoload {nvim aniseed.nvim}}) + +(def- opts {:noremap true :silent true}) +(defn- map [mode lhs rhs opt] + (nvim.set_keymap mode lhs rhs opt) + +--Remap space as leader key +(map "" "" "" opts) + +-- Modes +-- normal_mode = "n" +-- insert_mode = "i" +-- visual_mode = "v" +-- visual_block_mode = "x" +-- term_mode = "t" +-- command_mode = "c" + +-- Normal -- +-- Better window navigation +(map "n" "" "h" opts) +(map "n" "" "j" opts) +(map "n" "" "k" opts) +(map "n" "" "l" opts) + + +-- Resize with arrows +(map "n" "" ":resize -2" opts) +(map "n" "" ":resize +2" opts) +(map "n" "" ":vertical resize -2" opts) +(map "n" "" ":vertical resize +2" opts) + +-- Navigate buffers +(map "n" "" ":bnext" opts) +(map "n" "" ":bprevious" opts) + +-- Insert -- +-- Press jk fast to enter +(map "i" "jk" "" opts) + +-- Visual -- +-- Stay in indent mode +(map "v" "<" "" ">gv" opts) + +-- Move text up and down +(map "v" "" ":m .+1==" opts) +(map "v" "" ":m .-2==" opts) +(map "v" "p" '"_dP' opts) + +-- Visual Block -- +-- Move text up and down +(map "x" "J" ":move '>+1gv-gv" opts) +(map "x" "K" ":move '<-2gv-gv" opts) +(map "x" "" ":move '>+1gv-gv" opts) +(map "x" "" ":move '<-2gv-gv" opts) -- cgit v1.2.3-70-g09d2