.vim/autoload/vimrc.vim

Sat, 30 Dec 2017 20:56:50 -0500

author
Meredith Howard <mhoward@roomag.org>
date
Sat, 30 Dec 2017 20:56:50 -0500
changeset 665
807f6539d9cc
parent 641
60b56bbfc143
child 725
6ff8e3f73482
permissions
-rw-r--r--

housekeeping

631
8e07c29f2672 fix viewdoc abbrevs and cabbrevs in general
Meredith Howard <mhoward@roomag.org>
parents: 619
diff changeset
1 func! vimrc#CommandAlias(abbrev, expand) abort
632
9a87ce42aa3c getcmdpos is cursor position in expr mode here, wont work
Meredith Howard <mhoward@roomag.org>
parents: 631
diff changeset
2 execute printf('cnoreabbrev <expr> %s (getcmdtype()==":" && getcmdline()=="%s") ? "%s" : "%s"', a:abbrev, a:abbrev, a:expand, a:abbrev)
631
8e07c29f2672 fix viewdoc abbrevs and cabbrevs in general
Meredith Howard <mhoward@roomag.org>
parents: 619
diff changeset
3 endfunc
470
4c2db769baac Move into autoload
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
4
580
5a9e9be223f0 shorten
Meredith Howard <mhoward@roomag.org>
parents: 579
diff changeset
5 func! vimrc#AutoFmtToggle() abort
641
60b56bbfc143 use strict regex ops
Meredith Howard <mhoward@roomag.org>
parents: 640
diff changeset
6 if &formatoptions =~# 'a'
640
f8985ae54969 avoid abbreviated options
Meredith Howard <mhoward@roomag.org>
parents: 632
diff changeset
7 setl formatoptions-=a | echo '-a'
470
4c2db769baac Move into autoload
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
8 else
640
f8985ae54969 avoid abbreviated options
Meredith Howard <mhoward@roomag.org>
parents: 632
diff changeset
9 setl formatoptions+=a | echo '+a'
470
4c2db769baac Move into autoload
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
10 endif
580
5a9e9be223f0 shorten
Meredith Howard <mhoward@roomag.org>
parents: 579
diff changeset
11 endfunc
470
4c2db769baac Move into autoload
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
12
586
ab5763bb6ca7 improve ltag
Meredith Howard <mhoward@roomag.org>
parents: 583
diff changeset
13 func! vimrc#Ltag(term) abort
ab5763bb6ca7 improve ltag
Meredith Howard <mhoward@roomag.org>
parents: 583
diff changeset
14 exe "ltag " . a:term
ab5763bb6ca7 improve ltag
Meredith Howard <mhoward@roomag.org>
parents: 583
diff changeset
15 lopen
ab5763bb6ca7 improve ltag
Meredith Howard <mhoward@roomag.org>
parents: 583
diff changeset
16 endfunc
ab5763bb6ca7 improve ltag
Meredith Howard <mhoward@roomag.org>
parents: 583
diff changeset
17
470
4c2db769baac Move into autoload
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
18 " Make paths when writing, as necessary
580
5a9e9be223f0 shorten
Meredith Howard <mhoward@roomag.org>
parents: 579
diff changeset
19 func! vimrc#MkNonExDir(file, buf) abort
470
4c2db769baac Move into autoload
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
20 if empty(getbufvar(a:buf, '&buftype')) && a:file!~#'\v^\w+\:\/'
4c2db769baac Move into autoload
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
21 let dir=fnamemodify(a:file, ':h')
4c2db769baac Move into autoload
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
22 if !isdirectory(dir)
4c2db769baac Move into autoload
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
23 call mkdir(dir, 'p')
4c2db769baac Move into autoload
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
24 endif
4c2db769baac Move into autoload
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
25 endif
580
5a9e9be223f0 shorten
Meredith Howard <mhoward@roomag.org>
parents: 579
diff changeset
26 endfunc
470
4c2db769baac Move into autoload
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
27
583
e2c2404479d3 move one more func
Meredith Howard <mhoward@roomag.org>
parents: 580
diff changeset
28 func! vimrc#AutoSessionConfig() abort
e2c2404479d3 move one more func
Meredith Howard <mhoward@roomag.org>
parents: 580
diff changeset
29 if strlen(v:servername) > 0 && match(v:servername, 'VIM') == -1
619
b1cd1ee191be simplify auto session
Meredith Howard <mhoward@roomag.org>
parents: 607
diff changeset
30 exec 'UniteSessionLoad ' . tolower(v:servername)
583
e2c2404479d3 move one more func
Meredith Howard <mhoward@roomag.org>
parents: 580
diff changeset
31 endif
e2c2404479d3 move one more func
Meredith Howard <mhoward@roomag.org>
parents: 580
diff changeset
32 endfunc
e2c2404479d3 move one more func
Meredith Howard <mhoward@roomag.org>
parents: 580
diff changeset
33
580
5a9e9be223f0 shorten
Meredith Howard <mhoward@roomag.org>
parents: 579
diff changeset
34 func! vimrc#VundleInstallAndBegin() abort
607
042360ae89bb one more pass
Meredith Howard <mhoward@roomag.org>
parents: 606
diff changeset
35 let bundlepath = g:myvim . '/bundle'
042360ae89bb one more pass
Meredith Howard <mhoward@roomag.org>
parents: 606
diff changeset
36
042360ae89bb one more pass
Meredith Howard <mhoward@roomag.org>
parents: 606
diff changeset
37 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
38 if !executable('git')
3874b97048b0 Move vundle install to func, switch to begin/end vundle interface
Meredith Howard <mhoward@roomag.org>
parents: 470
diff changeset
39 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
40 return
3874b97048b0 Move vundle install to func, switch to begin/end vundle interface
Meredith Howard <mhoward@roomag.org>
parents: 470
diff changeset
41 endif
3874b97048b0 Move vundle install to func, switch to begin/end vundle interface
Meredith Howard <mhoward@roomag.org>
parents: 470
diff changeset
42
607
042360ae89bb one more pass
Meredith Howard <mhoward@roomag.org>
parents: 606
diff changeset
43 if !isdirectory(bundlepath)
042360ae89bb one more pass
Meredith Howard <mhoward@roomag.org>
parents: 606
diff changeset
44 call mkdir(bundlepath, 'p')
042360ae89bb one more pass
Meredith Howard <mhoward@roomag.org>
parents: 606
diff changeset
45 endif
042360ae89bb one more pass
Meredith Howard <mhoward@roomag.org>
parents: 606
diff changeset
46 exec 'cd ' . bundlepath
606
37b21dd61717 simplify vundle install
Meredith Howard <mhoward@roomag.org>
parents: 586
diff changeset
47 silent !git clone --depth 1 https://github.com/gmarik/vundle
37b21dd61717 simplify vundle install
Meredith Howard <mhoward@roomag.org>
parents: 586
diff changeset
48 cd -
574
3874b97048b0 Move vundle install to func, switch to begin/end vundle interface
Meredith Howard <mhoward@roomag.org>
parents: 470
diff changeset
49
3874b97048b0 Move vundle install to func, switch to begin/end vundle interface
Meredith Howard <mhoward@roomag.org>
parents: 470
diff changeset
50 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
51 endif
579
0cb7adee16fe move begin into function too
Meredith Howard <mhoward@roomag.org>
parents: 578
diff changeset
52
640
f8985ae54969 avoid abbreviated options
Meredith Howard <mhoward@roomag.org>
parents: 632
diff changeset
53 let &runtimepath .= ',' . bundlepath . '/vundle'
607
042360ae89bb one more pass
Meredith Howard <mhoward@roomag.org>
parents: 606
diff changeset
54 call vundle#begin(bundlepath)
580
5a9e9be223f0 shorten
Meredith Howard <mhoward@roomag.org>
parents: 579
diff changeset
55 endfunc

mercurial