Sun, 05 Mar 2023 15:14:39 -0500
Add "comment" parser
1022 | 1 | augroup vimrc |
2 | autocmd! | |
3 | ||
1025 | 4 | autocmd TermOpen * startinsert |
5 | ||
1050
6fb014427493
Make autoread more reliable
Meredith Howard <mhoward@roomag.org>
parents:
1025
diff
changeset
|
6 | autocmd WinLeave,FocusLost * if !pumvisible() | stopinsert | endif |
6fb014427493
Make autoread more reliable
Meredith Howard <mhoward@roomag.org>
parents:
1025
diff
changeset
|
7 | |
6fb014427493
Make autoread more reliable
Meredith Howard <mhoward@roomag.org>
parents:
1025
diff
changeset
|
8 | " complement to autoread? |
6fb014427493
Make autoread more reliable
Meredith Howard <mhoward@roomag.org>
parents:
1025
diff
changeset
|
9 | autocmd FocusGained * silent! checktime |
1022 | 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/ | |
48 | " hacked to work with vimwiki | |
49 | augroup encrypted | |
50 | autocmd! | |
51 | autocmd BufReadPre,FileReadPre *.gpg,*.gpg.* setl noswapfile noundofile nobackup viminfo= | |
52 | autocmd BufReadPost *.gpg,*.gpg.* call vimrc#SafeFilterFile('gpg2 -d') | |
53 | autocmd BufWritePre *.gpg,*.gpg.* call vimrc#SafeFilterFile('gpg2 -se -a --default-recipient-self') | |
54 | autocmd BufWritePost *.gpg,*.gpg.* :sil undo | |
55 | augroup END | |
56 |