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

Sun, 19 Feb 2023 13:48:14 -0600

author
Meredith Howard <mhoward@roomag.org>
date
Sun, 19 Feb 2023 13:48:14 -0600
changeset 1032
b0497894f69b
parent 1025
9dfc1a5a52dc
child 1050
6fb014427493
permissions
-rw-r--r--

Customize LSP float diags further

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

mercurial