diff options
author | aktersnurra <grydholm@kth.se> | 2022-04-30 13:07:38 +0200 |
---|---|---|
committer | aktersnurra <grydholm@kth.se> | 2022-04-30 13:07:38 +0200 |
commit | 1f1e450fd37a0cee1d60782ba98fa0eafc59338f (patch) | |
tree | f8faa8993f6aa148e0b4fc97d1c3d32795dc9069 /fnl/config/autocmd.fnl | |
parent | 1ff6d4b03f8d856699b479bc71ba1e26df0eb42e (diff) |
fix(autocmd): use new api for all cmds
Diffstat (limited to 'fnl/config/autocmd.fnl')
-rw-r--r-- | fnl/config/autocmd.fnl | 75 |
1 files changed, 27 insertions, 48 deletions
diff --git a/fnl/config/autocmd.fnl b/fnl/config/autocmd.fnl index d6bdabd..d4e7950 100644 --- a/fnl/config/autocmd.fnl +++ b/fnl/config/autocmd.fnl @@ -4,70 +4,49 @@ a aniseed.core util util}}) -(defn- autocmd-v1 [group cmds] (nvim.command (.. "augroup " group)) - (nvim.command :autocmd!) - (each [_ cmd (ipairs cmds)] - (nvim.command (.. "autocmd " cmd))) - (nvim.command "augroup end")) +(defn- autocmd [event opts] + (nvim.create_autocmd event opts)) -(defn- group [name] - (nvim.create_augroup name {:clear true})) +(autocmd :User + {:pattern :AlphaReady + :command "set showtabline=0 | autocmd BufUnload <buffer> set showtabline=2"}) -(defn- autocmd-v2 [event opts name] - (nvim.create_autocmd event (a.merge! {:group (group name)} opts))) +(autocmd :BufEnter + {:command "if winnr('$') == 1 && bufname() == 'NvimTree_' . tabpagenr() | quit | endif"}) -(def- alpha - ["User AlphaReady set showtabline=0 | autocmd BufUnload <buffer> set showtabline=2"]) - -(def- nvim-tree-autoclose - ["BufEnter * ++nested if winnr('$') == 1 && bufname() == 'NvimTree_' . tabpagenr() | quit | endif"]) - -(autocmd-v1 :_alpha alpha) -(autocmd-v1 :_nvim-tree nvim-tree-autoclose) - -(autocmd-v2 :FileType +(autocmd :FileType {:pattern [:qf :help :man :lspinfo] - :command "nnoremap <silent> <buffer> q :close<CR>"} - :_general_settings) + :command "nnoremap <silent> <buffer> q :close<CR>"}) -(autocmd-v2 :TextYankPost - {:callback (lambda [] (vim.highlight.on_yank {:timeout 200}))} - :_general_settings) +(autocmd :TextYankPost + {:callback (lambda [] (vim.highlight.on_yank {:timeout 200}))}) -(autocmd-v2 :BufWinEnter - {:command "setlocal formatoptions-=cro"} - :_general_settings) +(autocmd :BufWinEnter + {:command "setlocal formatoptions-=cro"}) -(autocmd-v2 :FileType +(autocmd :FileType {:pattern "qf" - :command "set nobuflisted"} - :_general_settings) + :command "set nobuflisted"}) -(autocmd-v2 :FileType +(autocmd :FileType {:pattern "gitcommit" - :command "setlocal wrap"} - :_git) + :command "setlocal wrap"}) -(autocmd-v2 :FileType +(autocmd :FileType {:pattern "gitcommit" - :command "setlocal spell"} - :_git) + :command "setlocal spell"}) -(autocmd-v2 :FileType +(autocmd :FileType {:pattern "markdown" - :command "setlocal wrap"} - :_markdown) + :command "setlocal wrap"}) -(autocmd-v2 :FileType +(autocmd :FileType {:pattern "markdown" - :command "setlocal spell"} - :_markdown) + :command "setlocal spell"}) -(autocmd-v2 :FileType +(autocmd :FileType {:pattern "markdown" - :command "setlocal spell"} - :_markdown) + :command "setlocal spell"}) -(autocmd-v2 :VimResized - {:command "tabdo wincmd ="} - :_auto_resize) +(autocmd :VimResized + {:command "tabdo wincmd ="}) |