.vim/autoload/vimrc.vim

Thu, 27 Apr 2017 12:40:35 -0400

author
Meredith Howard <mhoward@roomag.org>
date
Thu, 27 Apr 2017 12:40:35 -0400
changeset 548
e34f183fbd55
parent 470
4c2db769baac
child 574
3874b97048b0
permissions
-rw-r--r--

Make sure git sticks to gpg2

470
4c2db769baac Move into autoload
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
1
4c2db769baac Move into autoload
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
2 function! vimrc#AutoFmtToggle() abort
4c2db769baac Move into autoload
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
3 if &formatoptions =~ 'a'
4c2db769baac Move into autoload
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
4 setl fo-=a
4c2db769baac Move into autoload
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
5 echo '-a'
4c2db769baac Move into autoload
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
6 else
4c2db769baac Move into autoload
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
7 setl fo+=a
4c2db769baac Move into autoload
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
8 echo '+a'
4c2db769baac Move into autoload
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
9 endif
4c2db769baac Move into autoload
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
10 endfunction
4c2db769baac Move into autoload
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
11
4c2db769baac Move into autoload
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
12 " Make paths when writing, as necessary
4c2db769baac Move into autoload
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
13 function! vimrc#MkNonExDir(file, buf) abort
4c2db769baac Move into autoload
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
14 if empty(getbufvar(a:buf, '&buftype')) && a:file!~#'\v^\w+\:\/'
4c2db769baac Move into autoload
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
15 let dir=fnamemodify(a:file, ':h')
4c2db769baac Move into autoload
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
16 if !isdirectory(dir)
4c2db769baac Move into autoload
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
17 call mkdir(dir, 'p')
4c2db769baac Move into autoload
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
18 endif
4c2db769baac Move into autoload
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
19 endif
4c2db769baac Move into autoload
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
20 endfunction
4c2db769baac Move into autoload
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
21

mercurial