43 lines
1.6 KiB
VimL
43 lines
1.6 KiB
VimL
augroup benieAugroup
|
|
autocmd!
|
|
|
|
if tmux#inSession()
|
|
" [Un]set tmux window option to detect when to change pane.
|
|
call tmux#setNavigationFlag()
|
|
au FocusGained * silent call tmux#setNavigationFlag()
|
|
au VimLeave * silent call tmux#unsetNavigationFlag()
|
|
endif
|
|
|
|
" Reopening a file at last curson position
|
|
au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$")
|
|
\ | exe "normal! g'\"" | endif
|
|
|
|
" Update `Last change: <date>` on write & go back previous cursor position
|
|
au FileType help au BufWritePre <buffer>
|
|
\ 1s/Last change: \zs.*$/\=strftime('%Y %b %d')/e|norm!``
|
|
|
|
" Read template into buffer then send line 1 to the black hold register
|
|
au BufNewFile todo.md read ~/.vim/templates/skeleton.todo.md | 1delete _
|
|
|
|
" Augment vim-signify by modifying it's autocmds
|
|
au User SignifyAutocmds call do#signify()
|
|
|
|
if has('nvim')
|
|
" Start in terminal-insert mode.
|
|
autocmd TermOpen term://* startinsert
|
|
" Don't show the line number column in terminal-insert mode.
|
|
autocmd TermEnter term://*
|
|
\ set nonumber | set norelativenumber | set signcolumn=no
|
|
" But do show the line number column in terminal-normal mode.
|
|
autocmd TermLeave term://*
|
|
\ set number | set relativenumber | set signcolumn=auto
|
|
" Automatically press enter when the terminal process exits.
|
|
autocmd TermClose term://*
|
|
\ if (expand('<afile>') !~ "fzf") &&
|
|
\ (expand('<afile>') !~ "ranger") &&
|
|
\ (expand('<afile>') !~ "coc") |
|
|
\ call nvim_input('<CR>') |
|
|
\ endif
|
|
endif
|
|
augroup END
|