Wed, 31 May 2017 11:57:26 -0400
improve ltag
470 | 1 | |
580 | 2 | func! vimrc#AutoFmtToggle() abort |
470 | 3 | if &formatoptions =~ 'a' |
580 | 4 | setl fo-=a | echo '-a' |
470 | 5 | else |
580 | 6 | setl fo+=a | echo '+a' |
470 | 7 | endif |
580 | 8 | endfunc |
470 | 9 | |
586 | 10 | func! vimrc#Ltag(term) abort |
11 | exe "ltag " . a:term | |
12 | lopen | |
13 | endfunc | |
14 | ||
470 | 15 | " Make paths when writing, as necessary |
580 | 16 | func! vimrc#MkNonExDir(file, buf) abort |
470 | 17 | if empty(getbufvar(a:buf, '&buftype')) && a:file!~#'\v^\w+\:\/' |
18 | let dir=fnamemodify(a:file, ':h') | |
19 | if !isdirectory(dir) | |
20 | call mkdir(dir, 'p') | |
21 | endif | |
22 | endif | |
580 | 23 | endfunc |
470 | 24 | |
583 | 25 | func! vimrc#AutoSessionConfig() abort |
26 | if strlen(v:servername) > 0 && match(v:servername, 'VIM') == -1 | |
27 | let g:unite_source_session_default_session_name = tolower(v:servername) | |
28 | let g:unite_source_session_enable_auto_save = 1 | |
29 | ||
30 | UniteSessionLoad | |
31 | endif | |
32 | endfunc | |
33 | ||
580 | 34 | func! vimrc#VundleInstallAndBegin() abort |
578
3e4703eef23d
make on_windows global
Meredith Howard <mhoward@roomag.org>
parents:
574
diff
changeset
|
35 | let l:vundle_readme = expand(g:on_windows |
574
3874b97048b0
Move vundle install to func, switch to begin/end vundle interface
Meredith Howard <mhoward@roomag.org>
parents:
470
diff
changeset
|
36 | \ ? '~/vimfiles/bundle/vundle/README.md' |
3874b97048b0
Move vundle install to func, switch to begin/end vundle interface
Meredith Howard <mhoward@roomag.org>
parents:
470
diff
changeset
|
37 | \ : '~/.vim/bundle/vundle/README.md') |
3874b97048b0
Move vundle install to func, switch to begin/end vundle interface
Meredith Howard <mhoward@roomag.org>
parents:
470
diff
changeset
|
38 | |
3874b97048b0
Move vundle install to func, switch to begin/end vundle interface
Meredith Howard <mhoward@roomag.org>
parents:
470
diff
changeset
|
39 | if !filereadable(l:vundle_readme) |
3874b97048b0
Move vundle install to func, switch to begin/end vundle interface
Meredith Howard <mhoward@roomag.org>
parents:
470
diff
changeset
|
40 | if !executable('git') |
3874b97048b0
Move vundle install to func, switch to begin/end vundle interface
Meredith Howard <mhoward@roomag.org>
parents:
470
diff
changeset
|
41 | 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
|
42 | return |
3874b97048b0
Move vundle install to func, switch to begin/end vundle interface
Meredith Howard <mhoward@roomag.org>
parents:
470
diff
changeset
|
43 | endif |
3874b97048b0
Move vundle install to func, switch to begin/end vundle interface
Meredith Howard <mhoward@roomag.org>
parents:
470
diff
changeset
|
44 | |
578
3e4703eef23d
make on_windows global
Meredith Howard <mhoward@roomag.org>
parents:
574
diff
changeset
|
45 | if g:on_windows == 0 |
574
3874b97048b0
Move vundle install to func, switch to begin/end vundle interface
Meredith Howard <mhoward@roomag.org>
parents:
470
diff
changeset
|
46 | silent !mkdir -p ~/.vim/bundle |
3874b97048b0
Move vundle install to func, switch to begin/end vundle interface
Meredith Howard <mhoward@roomag.org>
parents:
470
diff
changeset
|
47 | silent !git clone --depth 1 https://github.com/gmarik/vundle ~/.vim/bundle/vundle |
3874b97048b0
Move vundle install to func, switch to begin/end vundle interface
Meredith Howard <mhoward@roomag.org>
parents:
470
diff
changeset
|
48 | else |
3874b97048b0
Move vundle install to func, switch to begin/end vundle interface
Meredith Howard <mhoward@roomag.org>
parents:
470
diff
changeset
|
49 | silent execute '!mkdir "'. $HOME .'\vimfiles\bundle"' |
3874b97048b0
Move vundle install to func, switch to begin/end vundle interface
Meredith Howard <mhoward@roomag.org>
parents:
470
diff
changeset
|
50 | silent execute '!git clone --depth 1 https://github.com/gmarik/vundle "'. $HOME .'\vimfiles\bundle\vundle"' |
3874b97048b0
Move vundle install to func, switch to begin/end vundle interface
Meredith Howard <mhoward@roomag.org>
parents:
470
diff
changeset
|
51 | endif |
3874b97048b0
Move vundle install to func, switch to begin/end vundle interface
Meredith Howard <mhoward@roomag.org>
parents:
470
diff
changeset
|
52 | |
3874b97048b0
Move vundle install to func, switch to begin/end vundle interface
Meredith Howard <mhoward@roomag.org>
parents:
470
diff
changeset
|
53 | 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
|
54 | endif |
579
0cb7adee16fe
move begin into function too
Meredith Howard <mhoward@roomag.org>
parents:
578
diff
changeset
|
55 | |
0cb7adee16fe
move begin into function too
Meredith Howard <mhoward@roomag.org>
parents:
578
diff
changeset
|
56 | if g:on_windows |
0cb7adee16fe
move begin into function too
Meredith Howard <mhoward@roomag.org>
parents:
578
diff
changeset
|
57 | set rtp+=~/vimfiles/bundle/vundle/ |
0cb7adee16fe
move begin into function too
Meredith Howard <mhoward@roomag.org>
parents:
578
diff
changeset
|
58 | call vundle#begin('~/vimfiles/bundle') |
0cb7adee16fe
move begin into function too
Meredith Howard <mhoward@roomag.org>
parents:
578
diff
changeset
|
59 | else |
0cb7adee16fe
move begin into function too
Meredith Howard <mhoward@roomag.org>
parents:
578
diff
changeset
|
60 | set rtp+=~/.vim/bundle/vundle/ |
0cb7adee16fe
move begin into function too
Meredith Howard <mhoward@roomag.org>
parents:
578
diff
changeset
|
61 | call vundle#begin() |
0cb7adee16fe
move begin into function too
Meredith Howard <mhoward@roomag.org>
parents:
578
diff
changeset
|
62 | endif |
580 | 63 | endfunc |