diff options
Diffstat (limited to 'fnl/settings/autocmds.fnl')
-rw-r--r-- | fnl/settings/autocmds.fnl | 79 |
1 files changed, 36 insertions, 43 deletions
diff --git a/fnl/settings/autocmds.fnl b/fnl/settings/autocmds.fnl index 5ae8b8c..ca361b3 100644 --- a/fnl/settings/autocmds.fnl +++ b/fnl/settings/autocmds.fnl @@ -3,46 +3,39 @@ (fn create-autocmd [event opts] (vim.api.nvim_create_autocmd event opts)) -(create-autocmd :FileType - {:pattern [:qf :help :man :lspinfo :spectre_panel] - :command "nnoremap <silent> <buffer> q :close<CR>"}) - -(create-autocmd :TextYankPost - {:callback (lambda [] - (vim.highlight.on_yank {:higroup :Visual - :timeout 200}))}) - -(create-autocmd :FileType {:pattern :lir - :callback (fn [] - (tset vim.opt_local :number false) - (tset vim.opt_local :relativenumber - false))}) - -(create-autocmd :BufWinEnter {:command "setlocal formatoptions-=cro"}) - -(create-autocmd :FileType {:pattern :qf :command "set nobuflisted"}) - -(create-autocmd :FileType {:pattern [:gitcommit :markdown] - :command "setlocal wrap"}) - -(create-autocmd :FileType - {:pattern [:NeogitStatus - :NeogitCommitMessage - :NeogitNotification - :NeogitCommitView] - :command "setlocal spell!"}) - -(create-autocmd :TermOpen - {:pattern ["term://*toggleterm#*"] :command "setlocal spell!"}) - -(create-autocmd :VimResized {:command "tabdo wincmd ="}) - -(create-autocmd :FocusGained {:command :checktime}) - -(create-autocmd :TermOpen - {:pattern "term://*toggleterm#*" - :callback (fn [] - (vim.keymap.set :t :<C-h> "<Cmd>wincmd h<CR>" {}) - (vim.keymap.set :t :<C-j> "<Cmd>wincmd j<CR>" {}) - (vim.keymap.set :t :<C-k> "<Cmd>wincmd k<CR>" {}) - (vim.keymap.set :t :<C-l> "<Cmd>wincmd l<CR>" {}))}) +(local autocmds + [[:FileType + {:pattern [:qf :help :man :lspinfo :spectre_panel] + :command "nnoremap <silent> <buffer> q :close<CR>"}] + [:TextYankPost + {:callback (lambda [] + (vim.highlight.on_yank {:higroup :Visual :timeout 200}))}] + [:FileType + {:pattern :lir + :callback (fn [] + (tset vim.opt_local :number false) + (tset vim.opt_local :relativenumber false))}] + [:BufWinEnter {:command "setlocal formatoptions-=cro"}] + [:FileType {:pattern :qf :command "set nobuflisted"}] + [:FileType {:pattern [:gitcommit :markdown] :command "setlocal wrap"}] + [:FileType + {:pattern [:NeogitStatus + :NeogitCommitMessage + :NeogitNotification + :NeogitCommitView] + :command "setlocal spell!"}] + [:TermOpen + {:pattern ["term://*toggleterm#*"] :command "setlocal spell!"}] + [:VimResized {:command "tabdo wincmd ="}] + [:FocusGained {:command :checktime}] + [:TermOpen + {:pattern "term://*toggleterm#*" + :callback (fn [] + (vim.keymap.set :t :<C-h> "<Cmd>wincmd h<CR>" {}) + (vim.keymap.set :t :<C-j> "<Cmd>wincmd j<CR>" {}) + (vim.keymap.set :t :<C-k> "<Cmd>wincmd k<CR>" {}) + (vim.keymap.set :t :<C-l> "<Cmd>wincmd l<CR>" {}))}]]) + +(each [_ autocmd (ipairs autocmds)] + (match autocmd + [event opts] (create-autocmd event opts))) |