From ac8edfb0db52efe65e01f73ef44133a86571ba02 Mon Sep 17 00:00:00 2001 From: aktersnurra Date: Fri, 17 Apr 2026 23:34:22 +0200 Subject: More based fixes --- fnl/settings/autocmds.fnl | 50 +++++++++++++++++++++++------------------------ fnl/settings/init.fnl | 14 ++++++------- fnl/settings/keymaps.fnl | 46 +++++++++++++++---------------------------- fnl/settings/terminal.fnl | 6 ++++-- 4 files changed, 51 insertions(+), 65 deletions(-) (limited to 'fnl/settings') 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 q :close"}] - [: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 q :close"}] + [: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 : :+ {}] - [:n : :- {}] - [:n "" :5< {}] - [:n : :5> {}] - ;; Stay in indent mode - [:v "<" :" :>gv {}] - ;; Move text up and down - [:x :J ":move '>+1gv-gv" {}] - [:x :K ":move '<-2gv-gv" {}] - [:v : ":m .+1==" {}] - [:v : ":m .-2==" {}] - [:v :p "\"_dP" {}] - ;; Splits - [:n : :split {}] - [:n : :vsplit {}] - ;; Buf navigation - [:n : :bprev {}] - [:n : :bnext {}] - ;; Jump half a page and centralize the view - [:n : :zz {}] - [:n : :zz {}] - ;; Remove highlighted search - [:n : :nohlsearch {}] - ;; Jump to eol in insert mode - [:i : :$ {}] - ;; Force refresh - [:n :mj ":e" {:desc :Refresh}]) +(keymaps ;; Resize with arrows + [:n : :+ {}] [:n : :- {}] [:n "" :5< {}] + [:n : :5> {}] ;; Stay in indent mode + [:v "<" :" :>gv {}] ;; Move text up and down + [:x :J ":move '>+1gv-gv" {}] [:x :K ":move '<-2gv-gv" {}] + [:v : ":m .+1==" {}] [:v : ":m .-2==" {}] + [:v :p "\"_dP" {}] ;; Splits + [:n : :split {}] [:n : :vsplit {}] + ;; Buf navigation + [:n : :bprev {}] [:n : :bnext {}] + ;; Jump half a page and centralize the view + [:n : :zz {}] [:n : :zz {}] + ;; Remove highlighted search + [:n : :nohlsearch {}] ;; Jump to eol in insert mode + [:i : :$ {}] ;; Force refresh + [:n :mj ":e" {: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] : toggle-term {:desc "Toggle terminal"}) +(keymap [:n :t] : toggle-term {:desc "Toggle terminal"}) -- cgit v1.2.3-70-g09d2