.config/nvim/autoload/vimrc.vim

changeset 1078
aa4c1aa529a5
parent 1076
15007f695dfb
child 1079
b59861305252
equal deleted inserted replaced
1077:5439ee582f9b 1078:aa4c1aa529a5
1 func! vimrc#CommandAlias(abbrev, expand) abort
2 execute printf('cnoreabbrev <expr> %s (getcmdtype()==":" && getcmdline()=="%s") ? "%s" : "%s"', a:abbrev, a:abbrev, a:expand, a:abbrev)
3 endfunc
4
5 func! vimrc#AutoFmtToggle() abort 1 func! vimrc#AutoFmtToggle() abort
6 if &formatoptions =~# 'a' 2 if &formatoptions =~# 'a'
7 setl formatoptions-=a | echo '-a' 3 setl formatoptions-=a | echo '-a'
8 else 4 else
9 setl formatoptions+=a | echo '+a' 5 setl formatoptions+=a | echo '+a'
18 cgetexpr system(cmd) 14 cgetexpr system(cmd)
19 call setqflist([], 'a', {"title": cmd}) 15 call setqflist([], 'a', {"title": cmd})
20 let @/ = '\v' . pattern 16 let @/ = '\v' . pattern
21 copen 17 copen
22 cfirst 18 cfirst
23 endfunc
24
25 func! vimrc#Gcd() abort
26 let root = system('git rev-parse --show-toplevel 2>/dev/null')[:-2]
27 if ! v:shell_error
28 exec 'cd ' . root
29 endif
30 pwd
31 endfunc
32
33 func! vimrc#Hgcd() abort
34 let root = system('hg root 2>/dev/null')[:-2]
35 if ! v:shell_error
36 exec 'cd ' . root
37 endif
38 pwd
39 endfunc 19 endfunc
40 20
41 func! vimrc#SafeFilterFile(cmd) 21 func! vimrc#SafeFilterFile(cmd)
42 let errors = tempname() 22 let errors = tempname()
43 try 23 try

mercurial