summaryrefslogtreecommitdiff
path: root/fnl/config
diff options
context:
space:
mode:
Diffstat (limited to 'fnl/config')
-rw-r--r--fnl/config/autocmd.fnl41
1 files changed, 26 insertions, 15 deletions
diff --git a/fnl/config/autocmd.fnl b/fnl/config/autocmd.fnl
index bb9b232..d6bdabd 100644
--- a/fnl/config/autocmd.fnl
+++ b/fnl/config/autocmd.fnl
@@ -4,59 +4,70 @@
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- group [name]
(nvim.create_augroup name {:clear true}))
-(defn- autocmd [event opts name]
+(defn- autocmd-v2 [event opts name]
(nvim.create_autocmd event (a.merge! {:group (group name)} opts)))
-(autocmd :FileType
+(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
{:pattern [:qf :help :man :lspinfo]
:command "nnoremap <silent> <buffer> q :close<CR>"}
:_general_settings)
-(autocmd :TextYankPost
+(autocmd-v2 :TextYankPost
{:callback (lambda [] (vim.highlight.on_yank {:timeout 200}))}
:_general_settings)
-(autocmd :BufWinEnter
+(autocmd-v2 :BufWinEnter
{:command "setlocal formatoptions-=cro"}
:_general_settings)
-(autocmd :FileType
+(autocmd-v2 :FileType
{:pattern "qf"
:command "set nobuflisted"}
:_general_settings)
-(autocmd :FileType
+(autocmd-v2 :FileType
{:pattern "gitcommit"
:command "setlocal wrap"}
:_git)
-(autocmd :FileType
+(autocmd-v2 :FileType
{:pattern "gitcommit"
:command "setlocal spell"}
:_git)
-(autocmd :FileType
+(autocmd-v2 :FileType
{:pattern "markdown"
:command "setlocal wrap"}
:_markdown)
-(autocmd :FileType
+(autocmd-v2 :FileType
{:pattern "markdown"
:command "setlocal spell"}
:_markdown)
-(autocmd :FileType
+(autocmd-v2 :FileType
{:pattern "markdown"
:command "setlocal spell"}
:_markdown)
-(autocmd :VimResized
+(autocmd-v2 :VimResized
{:command "tabdo wincmd ="}
:_auto_resize)
-
-(autocmd "User AlphaReady"
- {:command "set showtabline=0 | autocmd BufUnload <buffer> set showtabline=2"}
- :_alpha)