.config/nvim/plugin/vimrc/autocmds.vim

changeset 1075
3b88450bda15
parent 1050
6fb014427493
equal deleted inserted replaced
1074:91b42a87c3d9 1075:3b88450bda15
1 augroup vimrc
2 autocmd!
3
4 autocmd TermOpen * startinsert
5
6 autocmd WinLeave,FocusLost * if !pumvisible() | stopinsert | endif
7
8 " complement to autoread?
9 autocmd FocusGained * silent! checktime
10
11 " complement to autowriteall
12 autocmd FocusLost * silent! wa
13
14 " Make paths when writing, as necessary
15 autocmd BufWritePre * :call vimrc#MkNonExDir(expand('<afile>'), +expand('<abuf>'))
16
17 if ! &diff
18 " set and load a session based on servername
19 autocmd VimEnter * nested call vimrc#AutoSessionCheck()
20
21 " Jump to last known pos
22 autocmd BufReadPost *
23 \ if &filetype !~# 'mail\|^git\|^hg' && line("'\"") >= 1 && line("'\"") <= line("$") |
24 \ exe "normal! g`\"" |
25 \ endif
26
27 " Simple highlight conflict markers
28 autocmd BufReadPost *
29 \ match Error "^\([<>|]\)\{7} \@=\|^=\{7}$"
30 endif
31
32 " Simplify noisy ltag output
33 autocmd BufReadPost quickfix
34 \ if w:quickfix_title =~# '^:ltag' |
35 \ setl modifiable |
36 \ silent exe ':%s/\^\\V\s*\|\\\$|.*//g' |
37 \ setl nomodifiable |
38 \ endif
39
40 " easy close quickfix
41 autocmd BufReadPost quickfix nmap <buffer> q <C-w>c
42
43 " Neomutt changed their tmpfile pattern, ugh
44 autocmd BufNewFile,BufRead neomutt-*-\w\+ setf mail
45 augroup END
46
47 " https://mjj.io/2015/01/27/encrypting-files-with-gpg-and-vim/ 1 " https://mjj.io/2015/01/27/encrypting-files-with-gpg-and-vim/
48 " hacked to work with vimwiki 2 " hacked to work with vimwiki
49 augroup encrypted 3 augroup encrypted
50 autocmd! 4 autocmd!
51 autocmd BufReadPre,FileReadPre *.gpg,*.gpg.* setl noswapfile noundofile nobackup viminfo= 5 autocmd BufReadPre,FileReadPre *.gpg,*.gpg.* setl noswapfile noundofile nobackup viminfo=

mercurial