5 func! vimrc#AutoFmtToggle() abort |
5 func! vimrc#AutoFmtToggle() abort |
6 if &formatoptions =~# 'a' |
6 if &formatoptions =~# 'a' |
7 setl formatoptions-=a | echo '-a' |
7 setl formatoptions-=a | echo '-a' |
8 else |
8 else |
9 setl formatoptions+=a | echo '+a' |
9 setl formatoptions+=a | echo '+a' |
10 endif |
|
11 endfunc |
|
12 |
|
13 " Make paths when writing, as necessary |
|
14 func! vimrc#MkNonExDir(file, buf) abort |
|
15 if empty(getbufvar(a:buf, '&buftype')) && a:file!~#'\v^\w+\:\/' |
|
16 let dir=fnamemodify(a:file, ':h') |
|
17 if !isdirectory(dir) |
|
18 call mkdir(dir, 'p') |
|
19 endif |
|
20 endif |
|
21 endfunc |
|
22 |
|
23 func! vimrc#AutoSessionCheck() abort |
|
24 if strlen(v:servername) > 0 && match(v:servername, 'VIM') == -1 |
|
25 let sessionfile = g:vimcache . "/session/" . tolower(v:servername) . ".vim" |
|
26 |
|
27 if filereadable(sessionfile) |
|
28 execute "source " . sessionfile |
|
29 endif |
|
30 endif |
10 endif |
31 endfunc |
11 endfunc |
32 |
12 |
33 func! vimrc#Grep(...) abort |
13 func! vimrc#Grep(...) abort |
34 let pattern = get(a:000, 0, expand('<cword>')) |
14 let pattern = get(a:000, 0, expand('<cword>')) |