diff options
Diffstat (limited to 'fnl/settings')
| -rw-r--r-- | fnl/settings/autocmds.fnl | 50 | ||||
| -rw-r--r-- | fnl/settings/init.fnl | 14 | ||||
| -rw-r--r-- | fnl/settings/keymaps.fnl | 46 | ||||
| -rw-r--r-- | fnl/settings/terminal.fnl | 6 |
4 files changed, 51 insertions, 65 deletions
diff --git a/fnl/settings/autocmds.fnl b/fnl/settings/autocmds.fnl index 2f0a3cd..2dd0c71 100644 --- a/fnl/settings/autocmds.fnl +++ b/fnl/settings/autocmds.fnl @@ -2,29 +2,27 @@ (import-macros {: autocmds} :macros) -(autocmds - [:FileType - {:pattern [:qf :help :man :lspinfo] - :command "nnoremap <silent> <buffer> q :close<CR>"}] - [:TextYankPost - {:callback (λ [] - (vim.highlight.on_yank {:higroup :Visual - :timeout 200}))}] - [:BufWinEnter {:command "setlocal formatoptions-=cro"}] - [:FileType {:pattern :qf :command "set nobuflisted"}] - [:FileType - {:pattern [:gitcommit :markdown] :command "setlocal wrap"}] - [:VimResized {:command "tabdo wincmd ="}] - [[:FocusGained :BufEnter :CursorHold :CursorHoldI] - {:pattern "*" - :callback (fn [] - (when (= (vim.fn.mode) :n) - (vim.cmd :checktime)))}] - [[:InsertLeave :WinEnter] - {:callback (λ [] - (let [cursorline (require :settings.cursorline)] - cursorline.show))}] - [[:InsertEnter :WinLeave] - {:callback (λ [] - (let [cursorline (require :settings.cursorline)] - cursorline.hide))}]) +(autocmds [:FileType + {:pattern [:qf :help :man :lspinfo] + :command "nnoremap <silent> <buffer> q :close<CR>"}] + [:TextYankPost + {:callback (λ [] + (vim.highlight.on_yank {:higroup :Visual :timeout 200}))}] + [:BufWinEnter {:command "setlocal formatoptions-=cro"}] + [:FileType {:pattern :qf :command "set nobuflisted"}] + [:FileType + {:pattern [:gitcommit :markdown] :command "setlocal wrap"}] + [:VimResized {:command "tabdo wincmd ="}] + [[:FocusGained :BufEnter :CursorHold :CursorHoldI] + {:pattern "*" + :callback (fn [] + (when (= (vim.fn.mode) :n) + (vim.cmd :checktime)))}] + [[:InsertLeave :WinEnter] + {:callback (λ [] + (let [cursorline (require :settings.cursorline)] + cursorline.show))}] + [[:InsertEnter :WinLeave] + {:callback (λ [] + (let [cursorline (require :settings.cursorline)] + cursorline.hide))}]) diff --git a/fnl/settings/init.fnl b/fnl/settings/init.fnl index d01d848..4bb0e4c 100644 --- a/fnl/settings/init.fnl +++ b/fnl/settings/init.fnl @@ -1,12 +1,12 @@ ;; Load nvim settings +(import-macros {: autocmd} :macros) + (require :settings.options) (require :settings.terminal) -(vim.api.nvim_create_autocmd :User - {:group (vim.api.nvim_create_augroup :Lazy - {:clear true}) - :pattern :VeryLazy - :callback (λ [] - (require :settings.autocmds) - (require :settings.keymaps))}) +(autocmd :User {:group (vim.api.nvim_create_augroup :Lazy {:clear true}) + :pattern :VeryLazy + :callback (λ [] + (require :settings.autocmds) + (require :settings.keymaps))}) diff --git a/fnl/settings/keymaps.fnl b/fnl/settings/keymaps.fnl index fcc7511..d10b34e 100644 --- a/fnl/settings/keymaps.fnl +++ b/fnl/settings/keymaps.fnl @@ -2,33 +2,19 @@ (import-macros {: keymaps} :macros) -(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}]) +(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}]) diff --git a/fnl/settings/terminal.fnl b/fnl/settings/terminal.fnl index 16464ee..ca18327 100644 --- a/fnl/settings/terminal.fnl +++ b/fnl/settings/terminal.fnl @@ -1,3 +1,5 @@ +(import-macros {: keymap} :macros) + (local state {:buf -1 :win -1}) (fn hide-term [] @@ -10,7 +12,7 @@ (if (not (vim.api.nvim_buf_is_valid state.buf)) (do (set state.buf (vim.api.nvim_get_current_buf)) - (vim.fn.termopen vim.o.shell) + (vim.cmd.terminal) (set vim.opt_local.number false) (set vim.opt_local.relativenumber false) (set vim.opt_local.signcolumn :no)) @@ -22,4 +24,4 @@ (hide-term) (open-term))) -(vim.keymap.set [:n :t] :<c-_> toggle-term {:desc "Toggle terminal"}) +(keymap [:n :t] :<c-_> toggle-term {:desc "Toggle terminal"}) |