summaryrefslogtreecommitdiff
path: root/fnl/settings/keymaps.fnl
diff options
context:
space:
mode:
authoraktersnurra <gustaf@gustafrydholm.xyz>2026-04-16 15:10:52 +0200
committeraktersnurra <gustaf@gustafrydholm.xyz>2026-04-17 23:28:47 +0200
commit152fd9d787c7433cad95795992e444250cb83216 (patch)
tree0ae3b4a3b42005dc08b1400981cfc4c1f37297fe /fnl/settings/keymaps.fnl
parent83a7f3505a441f1c152229d50a3d6011951a82fc (diff)
Add fff and other nice things such as macros
Diffstat (limited to 'fnl/settings/keymaps.fnl')
-rw-r--r--fnl/settings/keymaps.fnl72
1 files changed, 31 insertions, 41 deletions
diff --git a/fnl/settings/keymaps.fnl b/fnl/settings/keymaps.fnl
index 14cd160..fcc7511 100644
--- a/fnl/settings/keymaps.fnl
+++ b/fnl/settings/keymaps.fnl
@@ -1,44 +1,34 @@
;; Custom keymappings.
-(local opts {:noremap true :silent true})
+(import-macros {: keymaps} :macros)
-(local mappings [;;Remap space as leader key
- ["" :<Space> :<Nop> {}]
- ;; Normal ;;
- ;; Resize with arrows
- [:n :<m-f> :<c-w>+ {}]
- [:n :<m-p> :<c-w>- {}]
- [:n "<m-,>" :<c-w>5< {}]
- [:n :<m-.> :<c-w>5> {}]
- ;; Visual ;;
- ;; Stay in indent mode
- [:v "<" :<gv {}]
- [:v ">" :>gv {}]
- ;; Visual Block ;;
- ;; Move text up and down
- [:x :J ":move '>+1<CR>gv-gv" {}]
- [:x :K ":move '<-2<CR>gv-gv" {}]
- ;; Move text up and down
- [:v :<c-n> ":m .+1<CR>==" {}]
- [:v :<c-e> ":m .-2<CR>==" {}]
- [:v :p "\"_dP" {}]
- ;; Splits
- [:n :<m-s> :<cmd>split<CR> {}]
- [:n :<m-t> :<cmd>vsplit<CR> {}]
- ;; Buf navigation
- [:n :<c-n> :<cmd>bprev<CR> {}]
- [:n :<c-e> :<cmd>bnext<CR> {}]
- ;; Jump half a page and centralize the view
- [:n :<c-d> :<c-d>zz {}]
- [:n :<c-u> :<c-u>zz {}]
- ;; Remove highlighted search
- [:n :<m-h> :<cmd>nohlsearch<CR> {}]
- ;; jump to eol in insert mode
- [:i :<c-e> :<c-o>$ {}]
- ;; Force refresh
- [:n :mj "<cmd>:e<CR>" {:desc :Refresh}]])
-
-(each [_ mapping (ipairs mappings)]
- (match mapping
- [mode key cmd desc]
- (vim.api.nvim_set_keymap mode key cmd (vim.tbl_extend :force opts desc))))
+(keymaps
+ ;; Resize with arrows
+ [:n :<m-f> :<c-w>+ {}]
+ [:n :<m-p> :<c-w>- {}]
+ [:n "<m-,>" :<c-w>5< {}]
+ [:n :<m-.> :<c-w>5> {}]
+ ;; Stay in indent mode
+ [:v "<" :<gv {}]
+ [:v ">" :>gv {}]
+ ;; Move text up and down
+ [:x :J ":move '>+1<CR>gv-gv" {}]
+ [:x :K ":move '<-2<CR>gv-gv" {}]
+ [:v :<c-n> ":m .+1<CR>==" {}]
+ [:v :<c-e> ":m .-2<CR>==" {}]
+ [:v :p "\"_dP" {}]
+ ;; Splits
+ [:n :<m-s> :<cmd>split<CR> {}]
+ [:n :<m-t> :<cmd>vsplit<CR> {}]
+ ;; Buf navigation
+ [:n :<c-n> :<cmd>bprev<CR> {}]
+ [:n :<c-e> :<cmd>bnext<CR> {}]
+ ;; Jump half a page and centralize the view
+ [:n :<c-d> :<c-d>zz {}]
+ [:n :<c-u> :<c-u>zz {}]
+ ;; Remove highlighted search
+ [:n :<m-h> :<cmd>nohlsearch<CR> {}]
+ ;; Jump to eol in insert mode
+ [:i :<c-e> :<c-o>$ {}]
+ ;; Force refresh
+ [:n :mj "<cmd>:e<CR>" {:desc :Refresh}])