dgy
/
hexagons
Archived
1
0
Fork 0
This repository has been archived on 2021-03-24. You can view files and clone it, but cannot push or open issues or pull requests.
hexagons/.config/nvim/plugin/autocmds.vim

33 lines
1.3 KiB
VimL

scriptencoding utf-8
if !exists('autocommands_loaded') && has('autocmd')
let autocommands_loaded = 1
let ftToIgnore = ['markdown', 'html', 'text']
let noNumbers = ['markdown', 'help', 'text']
aug OnInsert
au BufWinEnter,FocusGained,InsertLeave,WinEnter * if index(noNumbers, &ft) < 0 | setlocal cursorline norelativenumber
au BufWinLeave,FocusLost,InsertEnter,WinLeave * if index(noNumbers, &ft) < 0 | setlocal nocursorline relativenumber
au InsertLeave * if &paste | setlocal nopaste | endif
au InsertLeave,CompleteDone * if pumvisible() == 0 | pclose | endif
aug END
aug FileTypes
au BufNewFile ~/doc/blog/*.md 0r ~/.config/nvim/templates/wiki.skeleton
au BufRead,BufNewFile /tmp/neomutt* set filetype=mail
aug END
aug StatusLine
au VimEnter * call dead#statusline#UpdateInactiveWindows()
au VimEnter,WinEnter,BufWinEnter * call dead#statusline#RefreshStatusLine('active')
au WinLeave * call dead#statusline#RefreshStatusLine('inactive')
aug END
aug OnSave
au BufWritePre * if index(ftToIgnore, &ft) < 0 | :%s/\s\+$//e
au BufWritePost *xresources !xrdb %
au BufWritePost *sxhkdrc !pkill -USR1 sxhkd
au QuitPre * if empty(&buftype) | lclose | endif
aug END
endif