.vim/autoload/vimrc.vim

Wed, 26 Jul 2017 17:55:17 -0400

author
Meredith Howard <mhoward@roomag.org>
date
Wed, 26 Jul 2017 17:55:17 -0400
changeset 628
4e8fc8e56ff7
parent 619
b1cd1ee191be
child 631
8e07c29f2672
permissions
-rw-r--r--

keep tabs in gitconfig mode

470
4c2db769baac Move into autoload
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
1
580
5a9e9be223f0 shorten
Meredith Howard <mhoward@roomag.org>
parents: 579
diff changeset
2 func! vimrc#AutoFmtToggle() abort
470
4c2db769baac Move into autoload
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
3 if &formatoptions =~ 'a'
580
5a9e9be223f0 shorten
Meredith Howard <mhoward@roomag.org>
parents: 579
diff changeset
4 setl fo-=a | echo '-a'
470
4c2db769baac Move into autoload
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
5 else
580
5a9e9be223f0 shorten
Meredith Howard <mhoward@roomag.org>
parents: 579
diff changeset
6 setl fo+=a | echo '+a'
470
4c2db769baac Move into autoload
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
7 endif
580
5a9e9be223f0 shorten
Meredith Howard <mhoward@roomag.org>
parents: 579
diff changeset
8 endfunc
470
4c2db769baac Move into autoload
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
9
586
ab5763bb6ca7 improve ltag
Meredith Howard <mhoward@roomag.org>
parents: 583
diff changeset
10 func! vimrc#Ltag(term) abort
ab5763bb6ca7 improve ltag
Meredith Howard <mhoward@roomag.org>
parents: 583
diff changeset
11 exe "ltag " . a:term
ab5763bb6ca7 improve ltag
Meredith Howard <mhoward@roomag.org>
parents: 583
diff changeset
12 lopen
ab5763bb6ca7 improve ltag
Meredith Howard <mhoward@roomag.org>
parents: 583
diff changeset
13 endfunc
ab5763bb6ca7 improve ltag
Meredith Howard <mhoward@roomag.org>
parents: 583
diff changeset
14
470
4c2db769baac Move into autoload
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
15 " Make paths when writing, as necessary
580
5a9e9be223f0 shorten
Meredith Howard <mhoward@roomag.org>
parents: 579
diff changeset
16 func! vimrc#MkNonExDir(file, buf) abort
470
4c2db769baac Move into autoload
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
17 if empty(getbufvar(a:buf, '&buftype')) && a:file!~#'\v^\w+\:\/'
4c2db769baac Move into autoload
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
18 let dir=fnamemodify(a:file, ':h')
4c2db769baac Move into autoload
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
19 if !isdirectory(dir)
4c2db769baac Move into autoload
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
20 call mkdir(dir, 'p')
4c2db769baac Move into autoload
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
21 endif
4c2db769baac Move into autoload
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
22 endif
580
5a9e9be223f0 shorten
Meredith Howard <mhoward@roomag.org>
parents: 579
diff changeset
23 endfunc
470
4c2db769baac Move into autoload
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
24
583
e2c2404479d3 move one more func
Meredith Howard <mhoward@roomag.org>
parents: 580
diff changeset
25 func! vimrc#AutoSessionConfig() abort
e2c2404479d3 move one more func
Meredith Howard <mhoward@roomag.org>
parents: 580
diff changeset
26 if strlen(v:servername) > 0 && match(v:servername, 'VIM') == -1
619
b1cd1ee191be simplify auto session
Meredith Howard <mhoward@roomag.org>
parents: 607
diff changeset
27 exec 'UniteSessionLoad ' . tolower(v:servername)
583
e2c2404479d3 move one more func
Meredith Howard <mhoward@roomag.org>
parents: 580
diff changeset
28 endif
e2c2404479d3 move one more func
Meredith Howard <mhoward@roomag.org>
parents: 580
diff changeset
29 endfunc
e2c2404479d3 move one more func
Meredith Howard <mhoward@roomag.org>
parents: 580
diff changeset
30
580
5a9e9be223f0 shorten
Meredith Howard <mhoward@roomag.org>
parents: 579
diff changeset
31 func! vimrc#VundleInstallAndBegin() abort
607
042360ae89bb one more pass
Meredith Howard <mhoward@roomag.org>
parents: 606
diff changeset
32 let bundlepath = g:myvim . '/bundle'
042360ae89bb one more pass
Meredith Howard <mhoward@roomag.org>
parents: 606
diff changeset
33
042360ae89bb one more pass
Meredith Howard <mhoward@roomag.org>
parents: 606
diff changeset
34 if !filereadable(bundlepath . '/vundle/README.md')
574
3874b97048b0 Move vundle install to func, switch to begin/end vundle interface
Meredith Howard <mhoward@roomag.org>
parents: 470
diff changeset
35 if !executable('git')
3874b97048b0 Move vundle install to func, switch to begin/end vundle interface
Meredith Howard <mhoward@roomag.org>
parents: 470
diff changeset
36 echo "Can't autoinstall Vundle without git"
3874b97048b0 Move vundle install to func, switch to begin/end vundle interface
Meredith Howard <mhoward@roomag.org>
parents: 470
diff changeset
37 return
3874b97048b0 Move vundle install to func, switch to begin/end vundle interface
Meredith Howard <mhoward@roomag.org>
parents: 470
diff changeset
38 endif
3874b97048b0 Move vundle install to func, switch to begin/end vundle interface
Meredith Howard <mhoward@roomag.org>
parents: 470
diff changeset
39
607
042360ae89bb one more pass
Meredith Howard <mhoward@roomag.org>
parents: 606
diff changeset
40 if !isdirectory(bundlepath)
042360ae89bb one more pass
Meredith Howard <mhoward@roomag.org>
parents: 606
diff changeset
41 call mkdir(bundlepath, 'p')
042360ae89bb one more pass
Meredith Howard <mhoward@roomag.org>
parents: 606
diff changeset
42 endif
042360ae89bb one more pass
Meredith Howard <mhoward@roomag.org>
parents: 606
diff changeset
43 exec 'cd ' . bundlepath
606
37b21dd61717 simplify vundle install
Meredith Howard <mhoward@roomag.org>
parents: 586
diff changeset
44 silent !git clone --depth 1 https://github.com/gmarik/vundle
37b21dd61717 simplify vundle install
Meredith Howard <mhoward@roomag.org>
parents: 586
diff changeset
45 cd -
574
3874b97048b0 Move vundle install to func, switch to begin/end vundle interface
Meredith Howard <mhoward@roomag.org>
parents: 470
diff changeset
46
3874b97048b0 Move vundle install to func, switch to begin/end vundle interface
Meredith Howard <mhoward@roomag.org>
parents: 470
diff changeset
47 echo "Installed Vundle, run :PluginInstall if desired"
3874b97048b0 Move vundle install to func, switch to begin/end vundle interface
Meredith Howard <mhoward@roomag.org>
parents: 470
diff changeset
48 endif
579
0cb7adee16fe move begin into function too
Meredith Howard <mhoward@roomag.org>
parents: 578
diff changeset
49
607
042360ae89bb one more pass
Meredith Howard <mhoward@roomag.org>
parents: 606
diff changeset
50 let &rtp .= ',' . bundlepath . '/vundle'
042360ae89bb one more pass
Meredith Howard <mhoward@roomag.org>
parents: 606
diff changeset
51 call vundle#begin(bundlepath)
580
5a9e9be223f0 shorten
Meredith Howard <mhoward@roomag.org>
parents: 579
diff changeset
52 endfunc

mercurial