diff options
author | Gustaf Rydholm <gustaf.rydholm@gmail.com> | 2022-08-06 15:27:11 +0200 |
---|---|---|
committer | Gustaf Rydholm <gustaf.rydholm@gmail.com> | 2022-08-06 15:27:11 +0200 |
commit | 73ead4fccda383c099d92187412a5c1b8858a079 (patch) | |
tree | df23d70702273443fa4f5b63000889d876773362 /fnl | |
parent | 186457c467a10ad5f587a98ded919b159e3947b2 (diff) |
Move autocmd fn to util
Diffstat (limited to 'fnl')
-rw-r--r-- | fnl/config/autocmd.fnl | 20 | ||||
-rw-r--r-- | fnl/util.fnl | 2 |
2 files changed, 11 insertions, 11 deletions
diff --git a/fnl/config/autocmd.fnl b/fnl/config/autocmd.fnl index d66fb3a..28ed98d 100644 --- a/fnl/config/autocmd.fnl +++ b/fnl/config/autocmd.fnl @@ -1,32 +1,30 @@ ;; Autocommands for nvim. (module config.autocmd {autoload {nvim aniseed.nvim a aniseed.core : util}}) -(defn- autocmd [event opts] (nvim.create_autocmd event opts)) - -(autocmd :BufEnter +(util.autocmd :BufEnter {:command "if winnr('$') == 1 && bufname() == 'NvimTree_' . tabpagenr() | quit | endif"}) -(autocmd :FileType +(util.autocmd :FileType {:pattern [:qf :help :man :lspinfo] :command "nnoremap <silent> <buffer> q :close<CR>"}) -(autocmd :TextYankPost +(util.autocmd :TextYankPost {:callback (lambda [] (vim.highlight.on_yank {:timeout 200}))}) -(autocmd :BufWinEnter {:command "setlocal formatoptions-=cro"}) +(util.autocmd :BufWinEnter {:command "setlocal formatoptions-=cro"}) -(autocmd :FileType {:pattern :qf :command "set nobuflisted"}) +(util.autocmd :FileType {:pattern :qf :command "set nobuflisted"}) -(autocmd :FileType +(util.autocmd :FileType {:pattern :lir :callback (fn [] (tset vim.opt_local :number false) (tset vim.opt_local :relativenumber false))}) -(autocmd :FileType {:pattern [:gitcommit :markdown] :command "setlocal wrap"}) +(util.autocmd :FileType {:pattern [:gitcommit :markdown] :command "setlocal wrap"}) -(autocmd :FileType {:pattern [:gitcommit :markdown :org :plaintex] +(util.autocmd :FileType {:pattern [:gitcommit :markdown :org :plaintex] :command "setlocal spell"}) -(autocmd :VimResized {:command "tabdo wincmd ="}) +(util.autocmd :VimResized {:command "tabdo wincmd ="}) diff --git a/fnl/util.fnl b/fnl/util.fnl index 555768c..a8ea011 100644 --- a/fnl/util.fnl +++ b/fnl/util.fnl @@ -1,6 +1,8 @@ ;; Utility functions. (module util {autoload {a aniseed.core nvim aniseed.nvim : packer}}) +(defn autocmd [event opts] (nvim.create_autocmd event opts)) + (def- path (.. (vim.fn.stdpath :data) :/site/pack/packer/start)) (def- installed-plugins (vim.fn.readdir path)) |