1
0
Fork 0
numbers/nvim/plugin/autocmds.vim

32 lines
1.1 KiB
VimL
Raw Normal View History

2021-04-16 00:15:31 +00:00
scriptencoding utf-8
if !exists('autocommands_loaded') && has('autocmd')
2021-10-19 23:00:23 +00:00
let autocommands_loaded = 1
let ftToIgnore = ['markdown', 'html', 'text']
2021-04-16 00:15:31 +00:00
2021-10-19 23:00:23 +00:00
aug OnInsert
au InsertLeave * if &paste | setlocal nopaste | endif
au InsertLeave * set nocursorline
au InsertEnter * set cursorline
2021-10-19 23:00:23 +00:00
au InsertLeave,CompleteDone * if pumvisible() == 0 | pclose | endif
aug END
2021-04-16 00:15:31 +00:00
2021-10-19 23:00:23 +00:00
aug Miscs
au TextYankPost * silent! lua vim.highlight.on_yank{timeout = 80, on_visual=true}
au BufEnter * set fo-=c fo-=r fo-=o
2021-12-03 23:15:59 +00:00
au CursorHold,CursorHoldI * lua vim.diagnostic.open_float(nil, {focusable=false, header=""})
2021-10-19 23:00:23 +00:00
aug END
2021-04-16 00:15:31 +00:00
2021-10-19 23:00:23 +00:00
aug OnSave
au BufWritePre * if index(ftToIgnore, &ft) < 0 | :%s/\s\+$//e
au BufWritePost init.lua PackerSync
2021-10-19 23:00:23 +00:00
au QuitPre * if empty(&buftype) | lclose | endif
aug END
let statusline_blacklist = ['terminal', 'fugitive', 'vista', 'diagnostics', 'qf']
aug StatusLine
au WinEnter,BufEnter * if index(statusline_blacklist, &ft) < 0 | setlocal statusline=%!v:lua.StatusLine()
au WinLeave,BufLeave * if index(statusline_blacklist, &ft) < 0 | setlocal statusline=%!v:lua.StatusLineInactive()
aug END
2021-04-16 00:15:31 +00:00
endif