aboutsummaryrefslogtreecommitdiff
path: root/plugin
diff options
context:
space:
mode:
authorMax Christian Pohle2018-10-22 00:02:58 +0200
committerMax Christian Pohle2018-10-22 20:42:25 +0200
commitf2e01d7e513067ddb57c75f6e38cdcf434946cf8 (patch)
tree4e8448506756d2144db173d01385798840507133 /plugin
parent31f80d9c334e38e486545407ea5eb5f5cbb2f07d (diff)
downloadvim-f2e01d7e513067ddb57c75f6e38cdcf434946cf8.tar.bz2
vim-f2e01d7e513067ddb57c75f6e38cdcf434946cf8.zip
Major refactoring for version 2.0
vim-plug has been removed and replaced with Vims internal bundle mechanism. But I already noticed, that there is also GLVM now and started trying that as well.
Diffstat (limited to 'plugin')
-rw-r--r--plugin/AlignMapsPlugin.vim253
-rw-r--r--plugin/AlignPlugin.vim41
-rw-r--r--plugin/cecutil.vim482
-rw-r--r--plugin/cscope.vim57
-rw-r--r--plugin/jedi.vim15
-rw-r--r--plugin/max-change-icon.vim11
-rw-r--r--plugin/max-find-bash.vim9
-rw-r--r--plugin/max-fix-colorschemes.vim49
-rw-r--r--plugin/max-function-menu.vim173
-rw-r--r--plugin/max-highlight-word-under-cursor.vim18
-rw-r--r--plugin/max-set-window-title.vim21
-rw-r--r--plugin/max-splash.vim23
-rw-r--r--plugin/nerdtree.vim25
-rw-r--r--plugin/netrw.vim16
-rw-r--r--plugin/signify.vim35
-rw-r--r--plugin/snippets.vim12
-rw-r--r--plugin/statusline.vim125
-rw-r--r--plugin/tagbar.vim10
-rw-r--r--plugin/terminal.vim19
19 files changed, 1394 insertions, 0 deletions
diff --git a/plugin/AlignMapsPlugin.vim b/plugin/AlignMapsPlugin.vim
new file mode 100644
index 0000000..7296f7f
--- /dev/null
+++ b/plugin/AlignMapsPlugin.vim
@@ -0,0 +1,253 @@
1" AlignMapsPlugin: Alignment maps based upon <Align.vim> and <AlignMaps.vim>
2" Maintainer: Dr. Charles E. Campbell. <NdrOchipS@PcampbellAfamily.Mbiz>
3" Date: Jan 07, 2013
4"
5" NOTE: the code herein needs vim 7.0 or later
6" Copyright: Copyright (C) 1999-2012 Charles E. Campbell {{{1
7" Permission is hereby granted to use and distribute this code,
8" with or without modifications, provided that this copyright
9" notice is copied with it. Like anything else that's free,
10" AlignMaps.vim is provided *as is* and comes with no warranty
11" of any kind, either expressed or implied. By using this
12" plugin, you agree that in no event will the copyright
13" holder be liable for any damages resulting from the use
14" of this software.
15" Romans 1:20 For the invisible things of Him since the creation of the {{{1
16" world are clearly seen, being perceived through the things that are
17" made, even His everlasting power and divinity; that they may be
18" without excuse.
19
20" ---------------------------------------------------------------------
21" Usage: {{{1
22" Use 'a to mark beginning of to-be-aligned region, Alternative: use V
23" move cursor to end of region, and execute map. (linewise visual mode) to
24" The maps also set up marks 'y and 'z, and retain mark region, execute same
25" 'a at the beginning of region. map. Uses 'a, 'y, and 'z.
26"
27" The start/end wrappers save and restore marks 'y and 'z.
28"
29" Although the comments indicate the maps use a leading backslash,
30" actually they use <Leader> (:he mapleader), so the user can
31" specify that the maps start how he or she prefers.
32"
33" Note: these maps all use <Align.vim>.
34"
35" Load Once: {{{1
36if &cp || exists("g:loaded_AlignMapsPlugin")
37 finish
38endif
39let s:keepcpo = &cpo
40let g:loaded_AlignMapsPlugin = "v43"
41set cpo&vim
42
43" =====================================================================
44" Public Interface: {{{1
45com! AlignMapsClean :call AlignMaps#AlignMapsClean()
46
47" =====================================================================
48" Maps: {{{1
49
50" ---------------------------------------------------------------------
51" WS: wrapper start map (internal) {{{2
52" Produces a blank line above and below, marks with 'y and 'z
53if !hasmapto('<Plug>WrapperStart')
54 map <unique> <SID>WS <Plug>AlignMapsWrapperStart
55endif
56nnoremap <silent> <script> <Plug>AlignMapsWrapperStart :set lz<CR>:call AlignMaps#WrapperStart(0)<CR>
57vnoremap <silent> <script> <Plug>AlignMapsWrapperStart :<c-u>set lz<CR>:call AlignMaps#WrapperStart(1)<CR>
58
59" ---------------------------------------------------------------------
60" WE: wrapper end (internal) {{{2
61" Removes guard lines, restores marks y and z, and restores search pattern
62if !hasmapto('<Plug>WrapperEnd')
63 nmap <unique> <SID>WE <Plug>AlignMapsWrapperEnd
64endif
65nnoremap <silent> <script> <Plug>AlignMapsWrapperEnd :call AlignMaps#WrapperEnd()<CR>:set nolz<CR>
66
67" ---------------------------------------------------------------------
68" Complex C-code alignment maps: {{{2
69if !hasmapto('<Plug>AM_a?') |call AlignMaps#MakeMap("a?")|endif
70if !hasmapto('<Plug>AM_a,') |call AlignMaps#MakeMap("a,")|endif
71if !hasmapto('<Plug>AM_a<') |call AlignMaps#MakeMap("a<")|endif
72if !hasmapto('<Plug>AM_a=') |call AlignMaps#MakeMap("a=")|endif
73if !hasmapto('<Plug>AM_a(') |call AlignMaps#MakeMap("a(")|endif
74if !hasmapto('<Plug>AM_abox') |call AlignMaps#MakeMap("abox")|endif
75if !hasmapto('<Plug>AM_acom') |call AlignMaps#MakeMap("acom")|endif
76if !hasmapto('<Plug>AM_adcom')|call AlignMaps#MakeMap("adcom")|endif
77if !hasmapto('<Plug>AM_aocom')|call AlignMaps#MakeMap("aocom")|endif
78if !hasmapto('<Plug>AM_ascom')|call AlignMaps#MakeMap("ascom")|endif
79if !hasmapto('<Plug>AM_adec') |call AlignMaps#MakeMap("adec")|endif
80if !hasmapto('<Plug>AM_adef') |call AlignMaps#MakeMap("adef")|endif
81if !hasmapto('<Plug>AM_afnc') |call AlignMaps#MakeMap("afnc")|endif
82if !hasmapto('<Plug>AM_afnc') |call AlignMaps#MakeMap("afnc")|endif
83
84" ---------------------------------------------------------------------
85" Number alignment maps: {{{2
86if !hasmapto('<Plug>AM_aunum')|call AlignMaps#MakeMap("aunum")|endif
87if !hasmapto('<Plug>AM_aenum')|call AlignMaps#MakeMap("aenum")|endif
88if exists("g:alignmaps_euronumber") && !exists("g:alignmaps_usanumber")
89 if !hasmapto('<Plug>AM_anum')|call AlignMaps#MakeMap("anum")|endif
90else
91 if !hasmapto('<Plug>AM_anum')|call AlignMaps#MakeMap("anum")|endif
92endif
93
94" ---------------------------------------------------------------------
95" Plug maps: (the real thing) {{{2
96nnoremap <silent> <script> <Plug>AM_a? <SID>WS:AlignCtrl mIp1P1lC ? : : : : <CR>:'a,.Align<CR>:'a,'z-1s/\(\s\+\)? /?\1/e<CR><SID>WE
97nnoremap <silent> <script> <Plug>AM_a, <SID>WS:'y,'zs/\(\S\)\s\+/\1 /ge<CR>'yjma'zk:call AlignMaps#CharJoiner(",")<cr>:silent 'y,'zg/,/call AlignMaps#FixMultiDec()<CR>'z:exe "norm \<Plug>AM_adec"<cr><SID>WE
98nnoremap <silent> <script> <Plug>AM_a< <SID>WS:AlignCtrl mIp1P1=l << >><CR>:'a,.Align<CR><SID>WE
99nnoremap <silent> <script> <Plug>AM_a( <SID>WS:AlignCtrl mIp0P1=l<CR>:'a,.Align [(,]<CR>:sil 'y+1,'z-1s/\(\s\+\),/,\1/ge<CR><SID>WE
100nnoremap <silent> <script> <Plug>AM_a= <SID>WS:AlignCtrl mIp1P1=l<CR>:AlignCtrl g :=<CR>:'a,'zAlign :\==<CR><SID>WE
101nnoremap <silent> <script> <Plug>AM_abox <SID>WS:let g:alignmaps_iws=substitute(getline("'a"),'^\(\s*\).*$','\1','e')<CR>:'a,'z-1s/^\s\+//e<CR>:'a,'z-1s/^.*$/@&@/<CR>:AlignCtrl m=p01P0w @<CR>:'a,.Align<CR>:'a,'z-1s/@/ * /<CR>:'a,'z-1s/@$/*/<CR>'aYP:s/./*/g<CR>0r/'zkYp:s/./*/g<CR>0r A/<Esc>:exe "'a-1,'z-1s/^/".g:alignmaps_iws."/e"<CR><SID>WE
102nnoremap <silent> <script> <Plug>AM_acom <SID>WS:'a,.s/\/[*/]\/\=/@&@/e<CR>:'a,.s/\*\//@&/e<CR>:'y,'zs/^\( *\) @/\1@/e<CR>'zk:call AlignMaps#StdAlign(2)<CR>:'y,'zs/^\(\s*\) @/\1/e<CR>:'y,'zs/ @//eg<CR><SID>WE
103nnoremap <silent> <script> <Plug>AM_adcom <SID>WS:'a,.v/^\s*\/[/*]/s/\/[*/]\*\=/@&@/e<CR>:'a,.v/^\s*\/[/*]/s/\*\//@&/e<CR>:'y,'zv/^\s*\/[/*]/s/^\( *\) @/\1@/e<CR>'zk:call AlignMaps#StdAlign(3)<cr>:'y,'zv/^\s*\/[/*]/s/^\(\s*\) @/\1/e<CR>:'y,'zs/ @//eg<CR><SID>WE
104nnoremap <silent> <script> <Plug>AM_aocom <SID>WS:AlignPush<CR>:AlignCtrl g /[*/]<CR>:exe "norm \<Plug>AM_acom"<cr>:AlignPop<CR><SID>WE
105nnoremap <silent> <script> <Plug>AM_ascom <SID>WS:'a,.s/\/[*/]/@&@/e<CR>:'a,.s/\*\//@&/e<CR>:silent! 'a,.g/^\s*@\/[*/]/s/@//ge<CR>:AlignCtrl v ^\s*\/[*/]<CR>:AlignCtrl g \/[*/]<CR>'zk:call AlignMaps#StdAlign(2)<cr>:'y,'zs/^\(\s*\) @/\1/e<CR>:'y,'zs/ @//eg<CR><SID>WE
106nnoremap <silent> <script> <Plug>AM_adec <SID>WS:'a,'zs/\([^ \t/(]\)\([*&]\)/\1 \2/e<CR>:'y,'zv/^\//s/\([^ \t]\)\s\+/\1 /ge<CR>:'y,'zv/^\s*[*/]/s/\([^/][*&]\)\s\+/\1/ge<CR>:'y,'zv/^\s*[*/]/s/^\(\s*\%([a-zA-Z_][a-zA-Z_0-9<>:]*\s\+\%([a-zA-Z_*(&]\)\@=\)\+\)\([*(&]*\)\s*\([a-zA-Z0-9_()<>:]\+\)\s*\(\(\[.\{-}]\)*\)\s*\(=\)\=\s*\(.\{-}\)\=\s*;/\1@\2#@\3\4@\6@\7;@/e<CR>:'y,'zv/^\s*[*/]/s/\*\/\s*$/@*\//e<CR>:'y,'zv/^\s*[*/]/s/^\s\+\*/@@@@@* /e<CR>:'y,'zv/^\s*[*/]/s/^@@@@@\*\(.*[^*/]\)$/&@*/e<CR>'yjma'zk:AlignCtrl v ^\s*[*/#]<CR>:call AlignMaps#StdAlign(1)<cr>:'y,'zv/^\s*[*/]/s/@ //ge<CR>:'y,'zv/^\s*[*/]/s/\(\s*\);/;\1/e<CR>:'y,'zv/^#/s/# //e<CR>:'y,'zv/^\s\+[*/#]/s/\([^/*]\)\(\*\+\)\( \+\)/\1\3\2/e<CR>:'y,'zv/^\s\+[*/#]/s/\((\+\)\( \+\)\*/\2\1*/e<CR>:'y,'zv/^\s\+[*/#]/s/^\(\s\+\) \*/\1*/e<CR>:'y,'zv/^\s\+[*/#]/s/[ \t@]*$//e<CR>:'y,'zs/^[*]/ */e<CR><SID>WE
107nnoremap <silent> <script> <Plug>AM_adef <SID>WS:AlignPush<CR>:AlignCtrl v ^\s*\(\/\*\<bar>\/\/\)<CR>:'a,.v/^\s*\(\/\*\<bar>\/\/\)/s/^\(\s*\)#\(\s\)*define\s*\(\I[a-zA-Z_0-9(),]*\)\s*\(.\{-}\)\($\<Bar>\/\*\)/#\1\2define @\3@\4@\5/e<CR>:'a,.v/^\s*\(\/\*\<bar>\/\/\)/s/\($\<Bar>\*\/\)/@&/e<CR>'zk:call AlignMaps#StdAlign(1)<cr>'yjma'zk:'a,.v/^\s*\(\/\*\<bar>\/\/\)/s/ @//g<CR><SID>WE
108nnoremap <silent> <script> <Plug>AM_afnc :<c-u>set lz<CR>:silent call AlignMaps#Afnc()<CR>:set nolz<CR>
109nnoremap <silent> <script> <Plug>AM_aunum <SID>WS:'a,'zs/\([-+]\=\d\+\)\([eE][-+]\d\+\)\=/\1#\2/ge<CR>:'a,'zs/\([.eE][-+]\=\d\+\)#/\1/ge<CR>:'a,'zs/#\././ge<CR>:'a,'zs/[-+]\=\%(\d\+\%([.#]\d*\)\=\<bar>[.#]\d\+\)\%([eE][-+]\=\d\+\)\=/@&@/ge<CR>:AlignCtrl Imp0P0r<CR>:'a,'zAlign [@#.]<CR>:'a,'zs/\([.#]\)\(\s\+\)\(\d*\%([eE][-+]\=\d\+\)\=\)@/\1\3\2@/ge<CR>:'a,'zs/@//<CR>:'a,'zs/[#@]/ /ge<CR><SID>WE
110nnoremap <silent> <script> <Plug>AM_aenum <SID>WS:'a,'zs/\([-+]\=\d\+\)\([eE][-+]\d\+\)\=/\1#\2/ge<CR>:'a,'zs/\([,eE][-+]\=\d\+\)#/\1/ge<CR>:'a,'zs/#,/,/ge<CR>:'a,'zs/[-+]\=\%(\d\+\%([,#]\d*\)\=\<bar>[,#]\d\+\)\%([eE][-+]\=\d\+\)\=/@&@/ge<CR>:AlignCtrl Imp0P0r<CR>:'a,'zAlign [@#,]<CR>:'a,'zs/\([,#]\)\(\s\+\)\(\d*\%([eE][-+]\=\d\+\)\=\)@/\1\3\2@/ge<CR>:'a,'zs/@//<CR>:'a,'zs/[#@]/ /ge<CR><SID>WE
111" ---------------------------------------------------------------------
112" html table alignment {{{2
113if !hasmapto('<Plug>AM_Htd')|map <unique> <Leader>Htd <Plug>AM_Htd|endif
114map <silent> <script> <Plug>AM_Htd <SID>WS:'y,'zs%<[tT][rR]><[tT][dD][^>]\{-}>\<Bar></[tT][dD]><[tT][dD][^>]\{-}>\<Bar></[tT][dD]></[tT][rR]>%@&@%g<CR>'yjma'zk:AlignCtrl m=Ilp1P0 @<CR>:'a,.Align<CR>:'y,'zs/ @/@/<CR>:'y,'zs/@ <[tT][rR]>/<[tT][rR]>/ge<CR>:'y,'zs/@//ge<CR><SID>WE
115
116" ---------------------------------------------------------------------
117" character-based right-justified alignment maps {{{2
118if !hasmapto('<Plug>AM_T|')|call AlignMaps#MakeMap("T|")|endif
119if !hasmapto('<Plug>AM_T#') |call AlignMaps#MakeMap("T#")|endif
120if !hasmapto('<Plug>AM_T,') |call AlignMaps#MakeMap("T,")|endif
121if !hasmapto('<Plug>AM_Ts,') |call AlignMaps#MakeMap("Ts,")|endif
122if !hasmapto('<Plug>AM_T:') |call AlignMaps#MakeMap("T:")|endif
123if !hasmapto('<Plug>AM_T;') |call AlignMaps#MakeMap("T;")|endif
124if !hasmapto('<Plug>AM_T<') |call AlignMaps#MakeMap("T<")|endif
125if !hasmapto('<Plug>AM_T=') |call AlignMaps#MakeMap("T=")|endif
126if !hasmapto('<Plug>AM_T?') |call AlignMaps#MakeMap("T?")|endif
127if !hasmapto('<Plug>AM_T@') |call AlignMaps#MakeMap("T@")|endif
128if !hasmapto('<Plug>AM_TW@') |call AlignMaps#MakeMap("TW@")|endif
129if !hasmapto('<Plug>AM_Tab') |call AlignMaps#MakeMap("Tab")|endif
130if !hasmapto('<Plug>AM_Tsp') |call AlignMaps#MakeMap("Tsp")|endif
131if !hasmapto('<Plug>AM_T~') |call AlignMaps#MakeMap("T~")|endif
132
133nnoremap <silent> <script> <Plug>AM_T| <SID>WS:AlignCtrl mIp0P0=r <Bar><CR>:'a,.Align<CR><SID>WE
134nnoremap <silent> <script> <Plug>AM_T# <SID>WS:AlignCtrl mIp0P0=r #<CR>:'a,.Align<CR><SID>WE
135nnoremap <silent> <script> <Plug>AM_T, <SID>WS:AlignCtrl mIp0P1=r ,<CR>:'a,.Align<CR><SID>WE
136nnoremap <silent> <script> <Plug>AM_Ts, <SID>WS:AlignCtrl mIp0P1=r ,<CR>:'a,.Align<CR>:'a,.s/\(\s*\),/,\1/ge<CR><SID>WE
137nnoremap <silent> <script> <Plug>AM_T: <SID>WS:AlignCtrl mIp1P1=r :<CR>:'a,.Align<CR><SID>WE
138nnoremap <silent> <script> <Plug>AM_T; <SID>WS:AlignCtrl mIp0P0=r ;<CR>:'a,.Align<CR><SID>WE
139nnoremap <silent> <script> <Plug>AM_T< <SID>WS:AlignCtrl mIp0P0=r <<CR>:'a,.Align<CR><SID>WE
140nnoremap <silent> <script> <Plug>AM_T= <SID>WS:'a,'z-1s/\s\+\([*/+\-%<Bar>&\~^]\==\)/ \1/e<CR>:'a,'z-1s@ \+\([*/+\-%<Bar>&\~^]\)=@\1=@ge<CR>:'a,'z-1s/; */;@/e<CR>:'a,'z-1s/==/\="\<Char-0x0f>\<Char-0x0f>"/ge<CR>:'a,'z-1s/!=/\x="!\<Char-0x0f>"/ge<CR>:AlignCtrl mIp1P1=r = @<CR>:AlignCtrl g =<CR>:'a,'z-1Align<CR>:'a,'z-1s/; *@/;/e<CR>:'a,'z-1s/; *$/;/e<CR>:'a,'z-1s@\([*/+\-%<Bar>&\~^]\)\( \+\)=@\2\1=@ge<CR>:'a,'z-1s/\( \+\);/;\1/ge<CR>:'a,'z-1s/\xff/=/ge<CR><SID>WE:exe "norm <Plug>acom"
141nnoremap <silent> <script> <Plug>AM_T? <SID>WS:AlignCtrl mIp0P0=r ?<CR>:'a,.Align<CR>:'y,'zs/ \( *\);/;\1/ge<CR><SID>WE
142nnoremap <silent> <script> <Plug>AM_T@ <SID>WS:AlignCtrl mIp0P0=r @<CR>:'a,.Align<CR><SID>WE
143nnoremap <silent> <script> <Plug>AM_TW@ <SID>WS:AlignCtrl mWp0P0=r @<CR>:'a,.Align<CR><SID>WE
144nnoremap <silent> <script> <Plug>AM_Tab <SID>WS:'a,.s/^\(\t*\)\(.*\)/\=submatch(1).escape(substitute(submatch(2),'\t','@','g'),'\')/<CR>:AlignCtrl mI=r @<CR>:'a,.Align<CR>:'y+1,'z-1s/@/ /g<CR><SID>WE
145nnoremap <silent> <script> <Plug>AM_Tsp <SID>WS:'a,.s/^\(\s*\)\(.*\)/\=submatch(1).escape(substitute(submatch(2),'\s\+','@','g'),'\')/<CR>:AlignCtrl mI=r @<CR>:'a,.Align<CR>:'y+1,'z-1s/@/ /g<CR><SID>WE
146nnoremap <silent> <script> <Plug>AM_T~ <SID>WS:AlignCtrl mIp0P0=r ~<CR>:'a,.Align<CR>:'y,'zs/ \( *\);/;\1/ge<CR><SID>WE
147
148" ---------------------------------------------------------------------
149" character-based left-justified alignment maps {{{2
150if !hasmapto('<Plug>AM_t|','n') |call AlignMaps#MakeMap("t|")|endif
151if !hasmapto('<Plug>AM_t#','n') |call AlignMaps#MakeMap("t#")|endif
152if !hasmapto('<Plug>AM_t,','n') |call AlignMaps#MakeMap("t,")|endif
153if !hasmapto('<Plug>AM_t:','n') |call AlignMaps#MakeMap("t:")|endif
154if !hasmapto('<Plug>AM_t;','n') |call AlignMaps#MakeMap("t;")|endif
155if !hasmapto('<Plug>AM_t<','n') |call AlignMaps#MakeMap("t<")|endif
156if !hasmapto('<Plug>AM_t=','n') |call AlignMaps#MakeMap("t=")|endif
157if !hasmapto('<Plug>AM_ts,','n') |call AlignMaps#MakeMap("ts,")|endif
158if !hasmapto('<Plug>AM_ts:','n') |call AlignMaps#MakeMap("ts:")|endif
159if !hasmapto('<Plug>AM_ts;','n') |call AlignMaps#MakeMap("ts;")|endif
160if !hasmapto('<Plug>AM_ts<','n') |call AlignMaps#MakeMap("ts<")|endif
161if !hasmapto('<Plug>AM_ts=','n') |call AlignMaps#MakeMap("ts=")|endif
162if !hasmapto('<Plug>AM_w=','n') |call AlignMaps#MakeMap("w=")|endif
163if !hasmapto('<Plug>AM_t?','n') |call AlignMaps#MakeMap("t?")|endif
164if !hasmapto('<Plug>AM_t~','n') |call AlignMaps#MakeMap("t~")|endif
165if !hasmapto('<Plug>AM_t@','n') |call AlignMaps#MakeMap("t@")|endif
166if !hasmapto('<Plug>AM_tW@','n') |call AlignMaps#MakeMap("tW@")|endif
167if !hasmapto('<Plug>AM_m=','n') |call AlignMaps#MakeMap("m=")|endif
168if !hasmapto('<Plug>AM_tab','n') |call AlignMaps#MakeMap("tab")|endif
169if !hasmapto('<Plug>AM_tml','n') |call AlignMaps#MakeMap("tml")|endif
170if !hasmapto('<Plug>AM_tsp','n') |call AlignMaps#MakeMap("tsp")|endif
171if !hasmapto('<Plug>AM_tsq','n') |call AlignMaps#MakeMap("tsq")|endif
172if !hasmapto('<Plug>AM_tt','n') |call AlignMaps#MakeMap("tt")|endif
173if !hasmapto('<Plug>AM_tab','n') |call AlignMaps#MakeMap("tab")|endif
174
175" <Plug> normal mode mappings
176nnoremap <silent> <script> <Plug>AM_t| <SID>WS:AlignCtrl mIp0P0=l <Bar><CR>:'a,.Align<CR><SID>WE
177nnoremap <silent> <script> <Plug>AM_t# <SID>WS:AlignCtrl mIp0P0=l #<CR>:'a,.Align<CR><SID>WE
178nnoremap <silent> <script> <Plug>AM_t, <SID>WS:AlignCtrl mIp0P1=l ,<CR>:'a,.Align<CR><SID>WE
179nnoremap <silent> <script> <Plug>AM_t: <SID>WS:AlignCtrl mIp1P1=l :<CR>:'a,.Align<CR><SID>WE
180nnoremap <silent> <script> <Plug>AM_t; <SID>WS:AlignCtrl mIp0P1=l ;<CR>:'a,.Align<CR>:sil 'y,'zs/\( *\);/;\1/ge<CR><SID>WE
181nnoremap <silent> <script> <Plug>AM_t< <SID>WS:AlignCtrl mIp0P0=l <<CR>:'a,.Align<CR><SID>WE
182nnoremap <silent> <script> <Plug>AM_t= <SID>WS:call AlignMaps#Equals()<CR><SID>WE
183nnoremap <silent> <script> <Plug>AM_ts, <SID>WS:AlignCtrl mIp0P1=l #\zs<CR>:'a,.Align<CR><SID>WE
184nnoremap <silent> <script> <Plug>AM_ts, <SID>WS:AlignCtrl mIp0P1=l ,\zs<CR>:'a,.Align<CR><SID>WE
185nnoremap <silent> <script> <Plug>AM_ts: <SID>WS:AlignCtrl mIp1P1=l :\zs<CR>:'a,.Align<CR><SID>WE
186nnoremap <silent> <script> <Plug>AM_ts; <SID>WS:AlignCtrl mIp1P1=l ;\zs<CR>:'a,.Align<CR><SID>WE
187nnoremap <silent> <script> <Plug>AM_ts< <SID>WS:AlignCtrl mIp1P1=l <\zs<CR>:'a,.Align<CR><SID>WE
188nnoremap <silent> <script> <Plug>AM_ts= <SID>WS:AlignCtrl mIp1P1=l =\zs<CR>:'a,.Align<CR><SID>WE
189nnoremap <silent> <script> <Plug>AM_w= <SID>WS:'a,'zg/=/s/\s\+\([*/+\-%<Bar>&\~^]\==\)/ \1/e<CR>:'a,'zg/=/s@ \+\([*/+\-%<Bar>&\~^]\)=@\1=@ge<CR>:'a,'zg/=/s/==/\="\<Char-0x0f>\<Char-0x0f>"/ge<CR>:'a,'zg/=/s/!=/\="!\<Char-0x0f>"/ge<CR>'zk:AlignCtrl mWp1P1=l =<CR>:AlignCtrl g =<CR>:'a,'z-1g/=/Align<CR>:'a,'z-1g/=/s@\([*/+\-%<Bar>&\~^!=]\)\( \+\)=@\2\1=@ge<CR>:'a,'z-1g/=/s/\( \+\);/;\1/ge<CR>:'a,'z-1v/^\s*\/[*/]/s/\/[*/]/@&@/e<CR>:'a,'z-1v/^\s*\/[*/]/s/\*\//@&/e<CR>'zk:call AlignMaps#StdAlign(1)<cr>:'y,'zs/^\(\s*\) @/\1/e<CR>:'a,'z-1g/=/s/\xff/=/ge<CR>:'y,'zg/=/s/ @//eg<CR><SID>WE
190nnoremap <silent> <script> <Plug>AM_t? <SID>WS:AlignCtrl mIp0P0=l ?<CR>:'a,.Align<CR>:.,'zs/ \( *\);/;\1/ge<CR><SID>WE
191nnoremap <silent> <script> <Plug>AM_t~ <SID>WS:AlignCtrl mIp0P0=l ~<CR>:'a,.Align<CR>:'y,'zs/ \( *\);/;\1/ge<CR><SID>WE
192nnoremap <silent> <script> <Plug>AM_t@ <SID>WS:call AlignMaps#StdAlign(1)<cr><SID>WE
193nnoremap <silent> <script> <Plug>AM_tW@ <SID>WS:call AlignMaps#StdAlign(2)<cr><SID>WE
194nnoremap <silent> <script> <Plug>AM_m= <SID>WS:'a,'zs/\s\+\([*/+\-%<Bar>&\~^]\==\)/ \1/e<CR>:'a,'zs@ \+\([*/+\-%<Bar>&\~^]\)=@\1=@ge<CR>:'a,'zs/==/\="\<Char-0x0f>\<Char-0x0f>"/ge<CR>:'a,'zs/!=/\="!\<Char-0x0f>"/ge<CR>'zk:AlignCtrl mIp1P1=l =<CR>:AlignCtrl g =<CR>:'a,'z-1Align<CR>:'a,'z-1s@\([*/+\-%<Bar>&\~^!=]\)\( \+\)=@\2\1=@ge<CR>:'a,'z-1s/\( \+\);/;\1/ge<CR>:'a,'z-s/%\ze[^=]/ @%@ /e<CR>'zk:call AlignMaps#StdAlign(1)<cr>:'y,'zs/^\(\s*\) @/\1/e<CR>:'a,'z-1s/\xff/=/ge<CR>:'y,'zs/ @//eg<CR><SID>WE
195nnoremap <silent> <script> <Plug>AM_tab <SID>WS:'a,.s/^\(\t*\)\(.*\)$/\=submatch(1).escape(substitute(submatch(2),'\t',"\<Char-0x0f>",'g'),'\')/<CR>:if &ts == 1<bar>exe "AlignCtrl mI=lp0P0 \<Char-0x0f>"<bar>else<bar>exe "AlignCtrl mI=l"<bar>endif<CR>:'a,.Align <Char-0x0f><CR>:exe "'y+1,'z-1s/\<Char-0x0f>/".((&ts == 1)? '\t' : ' ')."/g"<CR><SID>WE
196nnoremap <silent> <script> <Plug>AM_tml <SID>WS:AlignCtrl mWp1P0=l \\\@<!\\\s*$<CR>:'a,.Align<CR><SID>WE
197nnoremap <silent> <script> <Plug>AM_tsp <SID>WS:keepj 'a,.s/^\(\s*\)\(.*\)/\=submatch(1).escape(substitute(submatch(2),'\s\+','@','g'),'\')/<CR>:AlignCtrl mI=lp0P0 @<CR>:'a,.Align<CR>:keepj 'y+1,'z-1s/@/ /g<CR><SID>WE
198nnoremap <silent> <script> <Plug>AM_tsq <SID>WS:'a,.AlignReplaceQuotedSpaces<CR>:keepj 'a,.s/^\(\s*\)\(.*\)/\=submatch(1).substitute(submatch(2),'\s\+','@','g')/<CR>:AlignCtrl mIp0P0=l @<CR>:'a,.Align<CR>:keepj 'y+1,'z-1s/[%@]/ /g<CR><SID>WE
199nnoremap <silent> <script> <Plug>AM_tt <SID>WS:AlignCtrl mIp1P1=l \\\@<!& \\\\<CR>:'a,.Align<CR><SID>WE
200
201" =====================================================================
202" Menu Support: {{{1
203" ma ..move.. use menu
204" v V or ctrl-v ..move.. use menu
205if has("menu") && has("gui_running") && &go =~# 'm' && !exists("s:firstmenu")
206 let s:firstmenu= 1
207 if !exists("g:DrChipTopLvlMenu")
208 let g:DrChipTopLvlMenu= "DrChip."
209 endif
210 if g:DrChipTopLvlMenu != ""
211 let s:mapleader = exists("g:mapleader")? g:mapleader : '\'
212 let s:emapleader= escape(s:mapleader,'\ ')
213 exe 'menu '.g:DrChipTopLvlMenu.'AlignMaps.<<\ and\ >><tab>'.s:emapleader.'a< '.s:mapleader.'a<'
214 exe 'menu '.g:DrChipTopLvlMenu.'AlignMaps.Assignment\ =<tab>'.s:emapleader.'t= '.s:mapleader.'t='
215 exe 'menu '.g:DrChipTopLvlMenu.'AlignMaps.Assignment\ :=<tab>'.s:emapleader.'a= '.s:mapleader.'a='
216 exe 'menu '.g:DrChipTopLvlMenu.'AlignMaps.Backslashes<tab>'.s:emapleader.'tml '.s:mapleader.'tml'
217 exe 'menu '.g:DrChipTopLvlMenu.'AlignMaps.Breakup\ Comma\ Declarations<tab>'.s:emapleader.'a, '.s:mapleader.'a,'
218 exe 'menu '.g:DrChipTopLvlMenu.'AlignMaps.C\ Comment\ Box<tab>'.s:emapleader.'abox '.s:mapleader.'abox'
219 exe 'menu '.g:DrChipTopLvlMenu.'AlignMaps.Commas<tab>'.s:emapleader.'t, '.s:mapleader.'t,'
220 exe 'menu '.g:DrChipTopLvlMenu.'AlignMaps.Commas<tab>'.s:emapleader.'ts, '.s:mapleader.'ts,'
221 exe 'menu '.g:DrChipTopLvlMenu.'AlignMaps.Commas\ With\ Strings<tab>'.s:emapleader.'tsq '.s:mapleader.'tsq'
222 exe 'menu '.g:DrChipTopLvlMenu.'AlignMaps.Comments<tab>'.s:emapleader.'acom '.s:mapleader.'acom'
223 exe 'menu '.g:DrChipTopLvlMenu.'AlignMaps.Comments\ Only<tab>'.s:emapleader.'aocom '.s:mapleader.'aocom'
224 exe 'menu '.g:DrChipTopLvlMenu.'AlignMaps.Declaration\ Comments<tab>'.s:emapleader.'adcom '.s:mapleader.'adcom'
225 exe 'menu '.g:DrChipTopLvlMenu.'AlignMaps.Declarations<tab>'.s:emapleader.'adec '.s:mapleader.'adec'
226 exe 'menu '.g:DrChipTopLvlMenu.'AlignMaps.Definitions<tab>'.s:emapleader.'adef '.s:mapleader.'adef'
227 exe 'menu '.g:DrChipTopLvlMenu.'AlignMaps.Function\ Header<tab>'.s:emapleader.'afnc '.s:mapleader.'afnc'
228 exe 'menu '.g:DrChipTopLvlMenu.'AlignMaps.Html\ Tables<tab>'.s:emapleader.'Htd '.s:mapleader.'Htd'
229 exe 'menu '.g:DrChipTopLvlMenu.'AlignMaps.(\.\.\.)?\.\.\.\ :\ \.\.\.<tab>'.s:emapleader.'a? '.s:mapleader.'a?'
230 exe 'menu '.g:DrChipTopLvlMenu.'AlignMaps.Numbers<tab>'.s:emapleader.'anum '.s:mapleader.'anum'
231 exe 'menu '.g:DrChipTopLvlMenu.'AlignMaps.Numbers\ (American-Style)<tab>'.s:emapleader.'aunum <Leader>aunum '.s:mapleader.'aunum <Leader>aunum'
232 exe 'menu '.g:DrChipTopLvlMenu.'AlignMaps.Numbers\ (Euro-Style)<tab>'.s:emapleader.'aenum '.s:mapleader.'aenum'
233 exe 'menu '.g:DrChipTopLvlMenu.'AlignMaps.Spaces\ (Left\ Justified)<tab>'.s:emapleader.'tsp '.s:mapleader.'tsp'
234 exe 'menu '.g:DrChipTopLvlMenu.'AlignMaps.Spaces\ (Right\ Justified)<tab>'.s:emapleader.'Tsp '.s:mapleader.'Tsp'
235 exe 'menu '.g:DrChipTopLvlMenu.'AlignMaps.Statements\ With\ Percent\ Style\ Comments<tab>'.s:emapleader.'m= '.s:mapleader.'m='
236 exe 'menu '.g:DrChipTopLvlMenu.'AlignMaps.Symbol\ <<tab>'.s:emapleader.'t< '.s:mapleader.'t<'
237 exe 'menu '.g:DrChipTopLvlMenu.'AlignMaps.Symbol\ \|<tab>'.s:emapleader.'t\| '.s:mapleader.'t|'
238 exe 'menu '.g:DrChipTopLvlMenu.'AlignMaps.Symbol\ @<tab>'.s:emapleader.'t@ '.s:mapleader.'t@'
239 exe 'menu '.g:DrChipTopLvlMenu.'AlignMaps.Symbol\ #<tab>'.s:emapleader.'t# '.s:mapleader.'t#'
240 exe 'menu '.g:DrChipTopLvlMenu.'AlignMaps.Tabs<tab>'.s:emapleader.'tab '.s:mapleader.'tab'
241 unlet s:mapleader
242 unlet s:emapleader
243 endif
244endif
245
246" =====================================================================
247" Restore: {{{1
248let &cpo= s:keepcpo
249unlet s:keepcpo
250
251" ==============================================================================
252" Modelines: {{{1
253" vim: ts=4 nowrap fdm=marker
diff --git a/plugin/AlignPlugin.vim b/plugin/AlignPlugin.vim
new file mode 100644
index 0000000..50c53d6
--- /dev/null
+++ b/plugin/AlignPlugin.vim
@@ -0,0 +1,41 @@
1" AlignPlugin: tool to align multiple fields based on one or more separators
2" Author: Charles E. Campbell
3" Date: Nov 02, 2008
4" GetLatestVimScripts: 294 1 :AutoInstall: Align.vim
5" GetLatestVimScripts: 1066 1 :AutoInstall: cecutil.vim
6" Copyright: Copyright (C) 1999-2012 Charles E. Campbell {{{1
7" Permission is hereby granted to use and distribute this code,
8" with or without modifications, provided that this copyright
9" notice is copied with it. Like anything else that's free,
10" Align.vim is provided *as is* and comes with no warranty
11" of any kind, either expressed or implied. By using this
12" plugin, you agree that in no event will the copyright
13" holder be liable for any damages resulting from the use
14" of this software.
15"
16" Romans 1:16,17a : For I am not ashamed of the gospel of Christ, for it is {{{1
17" the power of God for salvation for everyone who believes; for the Jew first,
18" and also for the Greek. For in it is revealed God's righteousness from
19" faith to faith.
20" ---------------------------------------------------------------------
21" Load Once: {{{1
22if &cp || exists("g:loaded_AlignPlugin")
23 finish
24endif
25let g:loaded_AlignPlugin = "v37"
26let s:keepcpo = &cpo
27set cpo&vim
28
29" ---------------------------------------------------------------------
30" Public Interface: {{{1
31com! -bang -range -nargs=* Align <line1>,<line2>call Align#Align(<bang>0,<q-args>)
32com! -range -nargs=0 AlignReplaceQuotedSpaces <line1>,<line2>call Align#AlignReplaceQuotedSpaces()
33com! -nargs=* AlignCtrl call Align#AlignCtrl(<q-args>)
34com! -nargs=0 AlignPush call Align#AlignPush()
35com! -nargs=0 AlignPop call Align#AlignPop()
36
37" ---------------------------------------------------------------------
38" Restore: {{{1
39let &cpo= s:keepcpo
40unlet s:keepcpo
41" vim: ts=4 fdm=marker
diff --git a/plugin/cecutil.vim b/plugin/cecutil.vim
new file mode 100644
index 0000000..506b7bf
--- /dev/null
+++ b/plugin/cecutil.vim
@@ -0,0 +1,482 @@
1" cecutil.vim : save/restore window position
2" save/restore mark position
3" save/restore selected user maps
4" Author: Charles E. Campbell, Jr.
5" Version: 17
6" Date: Sep 04, 2007
7"
8" Saving Restoring Destroying Marks: {{{1
9" call SaveMark(markname) let savemark= SaveMark(markname)
10" call RestoreMark(markname) call RestoreMark(savemark)
11" call DestroyMark(markname)
12" commands: SM RM DM
13"
14" Saving Restoring Destroying Window Position: {{{1
15" call SaveWinPosn() let winposn= SaveWinPosn()
16" call RestoreWinPosn() call RestoreWinPosn(winposn)
17" \swp : save current window/buffer's position
18" \rwp : restore current window/buffer's previous position
19" commands: SWP RWP
20"
21" Saving And Restoring User Maps: {{{1
22" call SaveUserMaps(mapmode,maplead,mapchx,suffix)
23" call RestoreUserMaps(suffix)
24"
25" GetLatestVimScripts: 1066 1 :AutoInstall: cecutil.vim
26"
27" You believe that God is one. You do well. The demons also {{{1
28" believe, and shudder. But do you want to know, vain man, that
29" faith apart from works is dead? (James 2:19,20 WEB)
30
31" Load Once: {{{1
32if &cp || exists("g:loaded_cecutil")
33 finish
34endif
35let g:loaded_cecutil = "v17"
36let s:keepcpo = &cpo
37set cpo&vim
38"DechoVarOn
39
40" -----------------------
41" Public Interface: {{{1
42" -----------------------
43
44" Map Interface: {{{2
45if !hasmapto('<Plug>SaveWinPosn')
46 map <unique> <Leader>swp <Plug>SaveWinPosn
47endif
48if !hasmapto('<Plug>RestoreWinPosn')
49 map <unique> <Leader>rwp <Plug>RestoreWinPosn
50endif
51nmap <silent> <Plug>SaveWinPosn :call SaveWinPosn()<CR>
52nmap <silent> <Plug>RestoreWinPosn :call RestoreWinPosn()<CR>
53
54" Command Interface: {{{2
55com! -bar -nargs=0 SWP call SaveWinPosn()
56com! -bar -nargs=0 RWP call RestoreWinPosn()
57com! -bar -nargs=1 SM call SaveMark(<q-args>)
58com! -bar -nargs=1 RM call RestoreMark(<q-args>)
59com! -bar -nargs=1 DM call DestroyMark(<q-args>)
60
61if v:version < 630
62 let s:modifier= "sil "
63else
64 let s:modifier= "sil keepj "
65endif
66
67" ---------------------------------------------------------------------
68" SaveWinPosn: {{{1
69" let winposn= SaveWinPosn() will save window position in winposn variable
70" call SaveWinPosn() will save window position in b:cecutil_winposn{b:cecutil_iwinposn}
71" let winposn= SaveWinPosn(0) will *only* save window position in winposn variable (no stacking done)
72fun! SaveWinPosn(...)
73" call Dfunc("SaveWinPosn() a:0=".a:0)
74 if line(".") == 1 && getline(1) == ""
75" call Dfunc("SaveWinPosn : empty buffer")
76 return ""
77 endif
78 let so_keep = &so
79 let siso_keep = &siso
80 let ss_keep = &ss
81 set so=0 siso=0 ss=0
82
83 let swline = line(".")
84 let swcol = col(".")
85 let swwline = winline() - 1
86 let swwcol = virtcol(".") - wincol()
87 let savedposn = "call GoWinbufnr(".winbufnr(0).")|silent ".swline
88 let savedposn = savedposn."|".s:modifier."norm! 0z\<cr>"
89 if swwline > 0
90 let savedposn= savedposn.":".s:modifier."norm! ".swwline."\<c-y>\<cr>"
91 endif
92 if swwcol > 0
93 let savedposn= savedposn.":".s:modifier."norm! 0".swwcol."zl\<cr>"
94 endif
95 let savedposn = savedposn.":".s:modifier."call cursor(".swline.",".swcol.")\<cr>"
96
97 " save window position in
98 " b:cecutil_winposn_{iwinposn} (stack)
99 " only when SaveWinPosn() is used
100 if a:0 == 0
101 if !exists("b:cecutil_iwinposn")
102 let b:cecutil_iwinposn= 1
103 else
104 let b:cecutil_iwinposn= b:cecutil_iwinposn + 1
105 endif
106" call Decho("saving posn to SWP stack")
107 let b:cecutil_winposn{b:cecutil_iwinposn}= savedposn
108 endif
109
110 let &so = so_keep
111 let &siso = siso_keep
112 let &ss = ss_keep
113
114" if exists("b:cecutil_iwinposn") " Decho
115" call Decho("b:cecutil_winpos{".b:cecutil_iwinposn."}[".b:cecutil_winposn{b:cecutil_iwinposn}."]")
116" else " Decho
117" call Decho("b:cecutil_iwinposn doesn't exist")
118" endif " Decho
119" call Dret("SaveWinPosn [".savedposn."]")
120 return savedposn
121endfun
122
123" ---------------------------------------------------------------------
124" RestoreWinPosn: {{{1
125fun! RestoreWinPosn(...)
126" call Dfunc("RestoreWinPosn() a:0=".a:0)
127" call Decho("getline(1)<".getline(1).">")
128" call Decho("line(.)=".line("."))
129 if line(".") == 1 && getline(1) == ""
130" call Dfunc("RestoreWinPosn : empty buffer")
131 return ""
132 endif
133 let so_keep = &so
134 let siso_keep = &siso
135 let ss_keep = &ss
136 set so=0 siso=0 ss=0
137
138 if a:0 == 0 || a:1 == ""
139 " use saved window position in b:cecutil_winposn{b:cecutil_iwinposn} if it exists
140 if exists("b:cecutil_iwinposn") && exists("b:cecutil_winposn{b:cecutil_iwinposn}")
141" call Decho("using stack b:cecutil_winposn{".b:cecutil_iwinposn."}<".b:cecutil_winposn{b:cecutil_iwinposn}.">")
142 try
143 exe "silent! ".b:cecutil_winposn{b:cecutil_iwinposn}
144 catch /^Vim\%((\a\+)\)\=:E749/
145 " ignore empty buffer error messages
146 endtry
147 " normally drop top-of-stack by one
148 " but while new top-of-stack doesn't exist
149 " drop top-of-stack index by one again
150 if b:cecutil_iwinposn >= 1
151 unlet b:cecutil_winposn{b:cecutil_iwinposn}
152 let b:cecutil_iwinposn= b:cecutil_iwinposn - 1
153 while b:cecutil_iwinposn >= 1 && !exists("b:cecutil_winposn{b:cecutil_iwinposn}")
154 let b:cecutil_iwinposn= b:cecutil_iwinposn - 1
155 endwhile
156 if b:cecutil_iwinposn < 1
157 unlet b:cecutil_iwinposn
158 endif
159 endif
160 else
161 echohl WarningMsg
162 echomsg "***warning*** need to SaveWinPosn first!"
163 echohl None
164 endif
165
166 else " handle input argument
167" call Decho("using input a:1<".a:1.">")
168 " use window position passed to this function
169 exe "silent ".a:1
170 " remove a:1 pattern from b:cecutil_winposn{b:cecutil_iwinposn} stack
171 if exists("b:cecutil_iwinposn")
172 let jwinposn= b:cecutil_iwinposn
173 while jwinposn >= 1 " search for a:1 in iwinposn..1
174 if exists("b:cecutil_winposn{jwinposn}") " if it exists
175 if a:1 == b:cecutil_winposn{jwinposn} " and the pattern matches
176 unlet b:cecutil_winposn{jwinposn} " unlet it
177 if jwinposn == b:cecutil_iwinposn " if at top-of-stack
178 let b:cecutil_iwinposn= b:cecutil_iwinposn - 1 " drop stacktop by one
179 endif
180 endif
181 endif
182 let jwinposn= jwinposn - 1
183 endwhile
184 endif
185 endif
186
187 " seems to be something odd: vertical motions after RWP
188 " cause jump to first column. Following fixes that
189 if wincol() > 1
190 silent norm! hl
191 elseif virtcol(".") < virtcol("$")
192 silent norm! lh
193 endif
194
195 let &so = so_keep
196 let &siso = siso_keep
197 let &ss = ss_keep
198
199" call Dret("RestoreWinPosn")
200endfun
201
202" ---------------------------------------------------------------------
203" GoWinbufnr: go to window holding given buffer (by number) {{{1
204" Prefers current window; if its buffer number doesn't match,
205" then will try from topleft to bottom right
206fun! GoWinbufnr(bufnum)
207" call Dfunc("GoWinbufnr(".a:bufnum.")")
208 if winbufnr(0) == a:bufnum
209" call Dret("GoWinbufnr : winbufnr(0)==a:bufnum")
210 return
211 endif
212 winc t
213 let first=1
214 while winbufnr(0) != a:bufnum && (first || winnr() != 1)
215 winc w
216 let first= 0
217 endwhile
218" call Dret("GoWinbufnr")
219endfun
220
221" ---------------------------------------------------------------------
222" SaveMark: sets up a string saving a mark position. {{{1
223" For example, SaveMark("a")
224" Also sets up a global variable, g:savemark_{markname}
225fun! SaveMark(markname)
226" call Dfunc("SaveMark(markname<".a:markname.">)")
227 let markname= a:markname
228 if strpart(markname,0,1) !~ '\a'
229 let markname= strpart(markname,1,1)
230 endif
231" call Decho("markname=".markname)
232
233 let lzkeep = &lz
234 set lz
235
236 if 1 <= line("'".markname) && line("'".markname) <= line("$")
237 let winposn = SaveWinPosn(0)
238 exe s:modifier."norm! `".markname
239 let savemark = SaveWinPosn(0)
240 let g:savemark_{markname} = savemark
241 let savemark = markname.savemark
242 call RestoreWinPosn(winposn)
243 else
244 let g:savemark_{markname} = ""
245 let savemark = ""
246 endif
247
248 let &lz= lzkeep
249
250" call Dret("SaveMark : savemark<".savemark.">")
251 return savemark
252endfun
253
254" ---------------------------------------------------------------------
255" RestoreMark: {{{1
256" call RestoreMark("a") -or- call RestoreMark(savemark)
257fun! RestoreMark(markname)
258" call Dfunc("RestoreMark(markname<".a:markname.">)")
259
260 if strlen(a:markname) <= 0
261" call Dret("RestoreMark : no such mark")
262 return
263 endif
264 let markname= strpart(a:markname,0,1)
265 if markname !~ '\a'
266 " handles 'a -> a styles
267 let markname= strpart(a:markname,1,1)
268 endif
269" call Decho("markname=".markname." strlen(a:markname)=".strlen(a:markname))
270
271 let lzkeep = &lz
272 set lz
273 let winposn = SaveWinPosn(0)
274
275 if strlen(a:markname) <= 2
276 if exists("g:savemark_{markname}") && strlen(g:savemark_{markname}) != 0
277 " use global variable g:savemark_{markname}
278" call Decho("use savemark list")
279 call RestoreWinPosn(g:savemark_{markname})
280 exe "norm! m".markname
281 endif
282 else
283 " markname is a savemark command (string)
284" call Decho("use savemark command")
285 let markcmd= strpart(a:markname,1)
286 call RestoreWinPosn(markcmd)
287 exe "norm! m".markname
288 endif
289
290 call RestoreWinPosn(winposn)
291 let &lz = lzkeep
292
293" call Dret("RestoreMark")
294endfun
295
296" ---------------------------------------------------------------------
297" DestroyMark: {{{1
298" call DestroyMark("a") -- destroys mark
299fun! DestroyMark(markname)
300" call Dfunc("DestroyMark(markname<".a:markname.">)")
301
302 " save options and set to standard values
303 let reportkeep= &report
304 let lzkeep = &lz
305 set lz report=10000
306
307 let markname= strpart(a:markname,0,1)
308 if markname !~ '\a'
309 " handles 'a -> a styles
310 let markname= strpart(a:markname,1,1)
311 endif
312" call Decho("markname=".markname)
313
314 let curmod = &mod
315 let winposn = SaveWinPosn(0)
316 1
317 let lineone = getline(".")
318 exe "k".markname
319 d
320 put! =lineone
321 let &mod = curmod
322 call RestoreWinPosn(winposn)
323
324 " restore options to user settings
325 let &report = reportkeep
326 let &lz = lzkeep
327
328" call Dret("DestroyMark")
329endfun
330
331" ---------------------------------------------------------------------
332" QArgSplitter: to avoid \ processing by <f-args>, <q-args> is needed. {{{1
333" However, <q-args> doesn't split at all, so this one returns a list
334" with splits at all whitespace (only!), plus a leading length-of-list.
335" The resulting list: qarglist[0] corresponds to a:0
336" qarglist[i] corresponds to a:{i}
337fun! QArgSplitter(qarg)
338" call Dfunc("QArgSplitter(qarg<".a:qarg.">)")
339 let qarglist = split(a:qarg)
340 let qarglistlen = len(qarglist)
341 let qarglist = insert(qarglist,qarglistlen)
342" call Dret("QArgSplitter ".string(qarglist))
343 return qarglist
344endfun
345
346" ---------------------------------------------------------------------
347" ListWinPosn:
348"fun! ListWinPosn() " Decho
349" if !exists("b:cecutil_iwinposn") || b:cecutil_iwinposn == 0 " Decho
350" call Decho("nothing on SWP stack") " Decho
351" else " Decho
352" let jwinposn= b:cecutil_iwinposn " Decho
353" while jwinposn >= 1 " Decho
354" if exists("b:cecutil_winposn{jwinposn}") " Decho
355" call Decho("winposn{".jwinposn."}<".b:cecutil_winposn{jwinposn}.">") " Decho
356" else " Decho
357" call Decho("winposn{".jwinposn."} -- doesn't exist") " Decho
358" endif " Decho
359" let jwinposn= jwinposn - 1 " Decho
360" endwhile " Decho
361" endif " Decho
362"endfun " Decho
363"com! -nargs=0 LWP call ListWinPosn() " Decho
364
365" ---------------------------------------------------------------------
366" SaveUserMaps: this function sets up a script-variable (s:restoremap) {{{1
367" which can be used to restore user maps later with
368" call RestoreUserMaps()
369"
370" mapmode - see :help maparg for its list
371" ex. "n" = Normal
372" If the first letter is u, then unmapping will be done
373" ex. "un" = Normal + unmapping
374" maplead - see mapchx
375" mapchx - "<something>" handled as a single map item.
376" ex. "<left>"
377" - "string" a string of single letters which are actually
378" multiple two-letter maps (using the maplead:
379" maplead . each_character_in_string)
380" ex. maplead="\" and mapchx="abc" saves user mappings for
381" \a, \b, and \c
382" Of course, if maplead is "", then for mapchx="abc",
383" mappings for a, b, and c are saved.
384" - :something handled as a single map item, w/o the ":"
385" ex. mapchx= ":abc" will save a mapping for "abc"
386" suffix - a string unique to your plugin
387" ex. suffix= "DrawIt"
388fun! SaveUserMaps(mapmode,maplead,mapchx,suffix)
389" call Dfunc("SaveUserMaps(mapmode<".a:mapmode."> maplead<".a:maplead."> mapchx<".a:mapchx."> suffix<".a:suffix.">)")
390
391 if !exists("s:restoremap_{a:suffix}")
392 " initialize restoremap_suffix to null string
393 let s:restoremap_{a:suffix}= ""
394 endif
395
396 " set up dounmap: if 1, then save and unmap (a:mapmode leads with a "u")
397 " if 0, save only
398 if a:mapmode =~ '^u'
399 let dounmap= 1
400 let mapmode= strpart(a:mapmode,1)
401 else
402 let dounmap= 0
403 let mapmode= a:mapmode
404 endif
405
406 " save single map :...something...
407 if strpart(a:mapchx,0,1) == ':'
408 let amap= strpart(a:mapchx,1)
409 if amap == "|" || amap == "\<c-v>"
410 let amap= "\<c-v>".amap
411 endif
412 let amap = a:maplead.amap
413 let s:restoremap_{a:suffix} = s:restoremap_{a:suffix}."|:silent! ".mapmode."unmap ".amap
414 if maparg(amap,mapmode) != ""
415 let maprhs = substitute(maparg(amap,mapmode),'|','<bar>','ge')
416 let s:restoremap_{a:suffix} = s:restoremap_{a:suffix}."|:".mapmode."map ".amap." ".maprhs
417 endif
418 if dounmap
419 exe "silent! ".mapmode."unmap ".amap
420 endif
421
422 " save single map <something>
423 elseif strpart(a:mapchx,0,1) == '<'
424 let amap = a:mapchx
425 if amap == "|" || amap == "\<c-v>"
426 let amap= "\<c-v>".amap
427 endif
428 let s:restoremap_{a:suffix} = s:restoremap_{a:suffix}."|silent! ".mapmode."unmap ".amap
429 if maparg(a:mapchx,mapmode) != ""
430 let maprhs = substitute(maparg(amap,mapmode),'|','<bar>','ge')
431 let s:restoremap_{a:suffix} = s:restoremap_{a:suffix}."|".mapmode."map ".amap." ".maprhs
432 endif
433 if dounmap
434 exe "silent! ".mapmode."unmap ".amap
435 endif
436
437 " save multiple maps
438 else
439 let i= 1
440 while i <= strlen(a:mapchx)
441 let amap= a:maplead.strpart(a:mapchx,i-1,1)
442 if amap == "|" || amap == "\<c-v>"
443 let amap= "\<c-v>".amap
444 endif
445 let s:restoremap_{a:suffix} = s:restoremap_{a:suffix}."|silent! ".mapmode."unmap ".amap
446 if maparg(amap,mapmode) != ""
447 let maprhs = substitute(maparg(amap,mapmode),'|','<bar>','ge')
448 let s:restoremap_{a:suffix} = s:restoremap_{a:suffix}."|".mapmode."map ".amap." ".maprhs
449 endif
450 if dounmap
451 exe "silent! ".mapmode."unmap ".amap
452 endif
453 let i= i + 1
454 endwhile
455 endif
456" call Dret("SaveUserMaps : restoremap_".a:suffix.": ".s:restoremap_{a:suffix})
457endfun
458
459" ---------------------------------------------------------------------
460" RestoreUserMaps: {{{1
461" Used to restore user maps saved by SaveUserMaps()
462fun! RestoreUserMaps(suffix)
463" call Dfunc("RestoreUserMaps(suffix<".a:suffix.">)")
464 if exists("s:restoremap_{a:suffix}")
465 let s:restoremap_{a:suffix}= substitute(s:restoremap_{a:suffix},'|\s*$','','e')
466 if s:restoremap_{a:suffix} != ""
467" call Decho("exe ".s:restoremap_{a:suffix})
468 exe "silent! ".s:restoremap_{a:suffix}
469 endif
470 unlet s:restoremap_{a:suffix}
471 endif
472" call Dret("RestoreUserMaps")
473endfun
474
475" ---------------------------------------------------------------------
476" Restore: {{{1
477let &cpo= s:keepcpo
478unlet s:keepcpo
479
480" ---------------------------------------------------------------------
481" Modelines: {{{1
482" vim: ts=4 fdm=marker
diff --git a/plugin/cscope.vim b/plugin/cscope.vim
new file mode 100644
index 0000000..b9ca444
--- /dev/null
+++ b/plugin/cscope.vim
@@ -0,0 +1,57 @@
1"=======================================================================================================================
2" CSCOPE: http://vim.wikia.com/wiki/Cscope
3"=======================================================================================================================
4
5augroup MAX_CSCOPE
6 if has('cscope') " compiled with cscope support?
7 set cscopetag " CTRL-] uses cscope first, then ctags
8 set cscopeverbose
9
10 if has('quickfix')
11 set cscopequickfix=s+,c+,d+,i+,t+,e+
12 endif
13
14 if has('menu')
15 1001menu &Cscope.find.c\ symbol
16 \<tab>s
17 \ :cscope find s <cword><:cR>
18 1001menu &Cscope.find.definition
19 \<tab>g
20 \ :cscope find g <cword><:cR>
21 1001menu &Cscope.find.functions\ called\ by\ this
22 \<tab>d
23 \ :cscope find d <cword><:cR>
24 1001menu &Cscope.find.functions\ calling\ this
25 \<tab>c
26 \ :cscope find c <cword><:cR>
27 1001menu &Cscope.find.text\ string
28 \<tab>t
29 \ :cscope find t <cword><:cR>
30 1001menu &Cscope.find.egrep\ pattern
31 \<tab>e
32 \ :cscope find e <cword><:cR>
33 1001menu &Cscope.find.this\ file
34 \<tab>f
35 \ :cscope find f <cword><:cR>
36 1001menu &Cscope.find.files\ including\ this\ file
37 \<tab>i
38 \ :cscope find i <cword><:cR>
39 1001menu &Cscope.find.places\ where\ this\ symbol\ is\ assigned\ a\ value
40 \<tab>a
41 \ :cscope find a <cword><:cR>
42 1001menu &Cscope.-Sep1-
43 \ :
44 1001menu &Cscope.create\ and\ add\ database
45 \ :cscope kill -1<CR>:execute '!find -type f -regex ".*\.\(c\\|h\\|cpp\\|cxx\\|hh\\|hpp\\|hxx\)$" <bar> cscope -i- -b -q -v'<CR>:cscope add .<CR>
46 1001menu &Cscope.-Sep2-
47 \ :
48 1001menu &Cscope.add\ \.
49 \ :cscope add .<CR>
50 1001menu &Cscope.show
51 \ :cscope show<CR>
52 1001menu &Cscope.reset
53 \ :cscope reset<CR>
54 endif
55 endif
56augroup END " MAX_CSCOPE
57
diff --git a/plugin/jedi.vim b/plugin/jedi.vim
new file mode 100644
index 0000000..dca8838
--- /dev/null
+++ b/plugin/jedi.vim
@@ -0,0 +1,15 @@
1" JEDI: ==============================================================================================================
2augroup JEDI
3 if has("python") || has('python3')
4 let g:jedi#completions_enabled = 0 " we do not need completions, because we have YouCompleteMe
5 let g:jedi#show_call_signatures = 1 " which sadly does not support signatures like jedi
6 let g:jedi#show_call_signatures_delay = 0
7 let g:jedi#auto_vim_configure = 0
8 let g:pymode_rope = 0 " https://github.com/davidhalter/jedi-vim/issues/163
9 " autocmd FileType python jedi.preload_module('os', 'sys', 'math')
10 " let g:pymode_options_max_line_length = 120
11 " let g:syntastic_python_flake8_args='--ignore=F821,E302,E501,E241,E301'
12
13 packadd jedi-vim
14 endif " has("python")
15augroup END
diff --git a/plugin/max-change-icon.vim b/plugin/max-change-icon.vim
new file mode 100644
index 0000000..f544a5e
--- /dev/null
+++ b/plugin/max-change-icon.vim
@@ -0,0 +1,11 @@
1
2
3
4augroup ChangeIcon
5 "if filereadable("/usr/bin/xseticon")
6 "if filereadable("~/.vim/nvim.png")
7 " autocmd VimEnter * silent :execute "!xseticon -id $WINDOWID ~/.vim/nvim.png"
8 " autocmd VimLeave * silent :execute "!xseticon -id $WINDOWID /usr/share/icons/gnome/32x32/apps/xfce-terminal.png"
9 "endif
10 "endif
11augroup END
diff --git a/plugin/max-find-bash.vim b/plugin/max-find-bash.vim
new file mode 100644
index 0000000..a5e243b
--- /dev/null
+++ b/plugin/max-find-bash.vim
@@ -0,0 +1,9 @@
1"=======================================================================================================================
2" SHELL:
3" Many scripts rely on bash. We help to find the bash binary
4"=======================================================================================================================
5if filereadable("/bin/bash")
6 set shell=/bin/bash
7elseif filereadable("/usr/local/bin/bash")
8 set shell=/usr/local/bin/bash
9endif
diff --git a/plugin/max-fix-colorschemes.vim b/plugin/max-fix-colorschemes.vim
new file mode 100644
index 0000000..ac2af76
--- /dev/null
+++ b/plugin/max-fix-colorschemes.vim
@@ -0,0 +1,49 @@
1"=======================================================================================================================
2" COLOR SCHEME:
3"=======================================================================================================================
4function! ExtendColorTheme()
5 highlight! Bold cterm=bold gui=bold
6 highlight! Italic cterm=italic gui=italic
7 highlight! Underline cterm=underline gui=underline
8 highlight! BoldUnderline cterm=bold,underline gui=bold,underline
9 highlight! BoldItalic cterm=bold,Italic gui=Bold,Italic
10 highlight! Todo cterm=bold gui=bold guibg=#ffffaa guifg=#000000
11 highlight! Error ctermbg=NONE guibg=NONE
12 highlight! SpellBad cterm=NONE gui=undercurl guibg=NONE guifg=red
13
14
15 highlight! link SpecialKey NonText | " makes tab stop (see listchars) less disturbing
16 highlight! link EndOfBuffer Ignore
17 highlight! link WildMenu Search
18 highlight! link Convention Error
19 highlight! link VertSplit NonText
20
21 highlight! link Folded LineNr
22 highlight! link SignColumn LineNr
23 highlight! link FoldColumn LineNr
24
25 highlight! link PmenuSbar Pmenu
26 highlight! PmenuThumb cterm=inverse
27 highlight! MoreMsg cterm=inverse
28
29
30endfunction
31autocmd ColorScheme * call ExtendColorTheme()
32
33
34if filereadable(expand("~/.vimrc_background")) && filereadable(expand("~/.config/base16-shell/colortest"))
35 let g:base16_shell_path = "~/.config/base16-shell/scripts"
36 let base16colorspace = 256
37 set background=dark
38 source ~/.vimrc_background
39else
40 let g:PaperColor_Theme_Options = {
41 \ 'theme': {
42 \ 'default': {
43 \ 'transparent_background': 0
44 \ }
45 \ }
46 \ }
47 set background=light
48 colorscheme PaperColor
49endif
diff --git a/plugin/max-function-menu.vim b/plugin/max-function-menu.vim
new file mode 100644
index 0000000..6c7308a
--- /dev/null
+++ b/plugin/max-function-menu.vim
@@ -0,0 +1,173 @@
1augroup MAX_FUNCTION_MENU
2 if has('menu')
3 source $VIMRUNTIME/menu.vim
4 set wildmenu
5 set cpo-=<
6 set wcm=<C-Z>
7
8 01menu &Functions.toggle\ file\ browser
9 \<Tab><leader><leader>
10 \ <leader><leader>
11 01menu &Functions.-Sep0- :
12
13 01menu &Functions.help
14 \<Tab><F1>
15 \ <F1>
16 01menu &Functions.bp:\ previous\ buffer
17 \<Tab><F2>
18 \ <F2>
19 01menu &Functions.bn:\ next\ buffer
20 \<Tab><F3>
21 \ <F3>
22 01menu &Functions.^wc\:\ close\ window
23 \<Tab><F4>
24 \ <F4>
25 01menu &Functions.-Sep1- :
26
27 01menu &Functions.make
28 \<Tab><F5>
29 \ <F5>
30 01menu &Functions.clear\ matches,\ update\ viewport
31 \<Tab><F6>
32 \ <F6>
33 01menu &Functions.copen\:\ show\ quickfix\ list
34 \<Tab><F7>
35 \ <F7>
36 01menu &Functions.lopen\:\ show\ location\ list
37 \<Tab><F8>
38 \ <F8>
39 01menu &Functions.-Sep2- :
40
41 01menu &Functions.toggle\ tagbar
42 \<Tab><F9>
43 \ <F9>
44
45 if has("gui_running") == 0
46 " in the gui F10 already triggers the menu, not in a terminal vim, so upgrade that...
47 map <F10> :emenu <C-Z>
48 endif
49 01menu &Functions.activate\ menu\ (:emenu)
50 \<Tab><F10>
51 \ <F10>
52
53 01menu &Functions.undef11
54 \<Tab><F11>
55 \ <F11>
56 01menu &Functions.undef12
57 \<Tab><F12>
58 \ <F12>
59 01menu &Functions.-Sep2- :
60
61
62 09menu &Directory.print\ current\ directory
63 \<Tab>:pwd
64 \ :pwd<CR>
65
66 09menu &Directory.-Sep- :
67
68 09menu &Directory.Change\ to\ GIT\ root
69 \<Tab>:Gcd
70 \ :Gcd<CR>:pwd<CR>
71
72 09menu &Directory.Change\ to\ current\ buffers\ directory\ (global)
73 \<tab>:cd\ %:p:h
74 \ :cd %:h<CR>:pwd<CR>
75
76 09menu &Directory.Change\ to\ current\ buffers\ directory\ (local\ window)<tab>:lcd\ %:p:h
77 \ :lcd %:p:h<CR>:pwd<CR>
78
79 menu &Git.&Display\ uncommited\ files\ in\ location\ list
80 \ :call setloclist(0, map(systemlist("git diff --name-only --pretty=''"), {_, p->{'filename': fnamemodify(p, ':.')}}))<CR>:lopen<CR>
81 menu &Git.&Display\ recently\ changed\ files\ in\ quickfix\ list
82 \ :call setqflist([], 'r', {'title': 'Recently changed in GIT', 'items':map(systemlist("git show --name-only --pretty=''"), {_, p->{'filename': fnamemodify(p, ':.')}}) })<CR>:copen<CR>
83 menu &Git.&Display\ last\ changes
84 \ :let g:signify_vcs_cmds={'git': 'git diff --no-color --no-ext-diff -U0 HEAD^ -- %f'}<CR>:SignifyRefresh<CR>
85 menu &Git.&Display\ unmerged\ files\ in\ location\ list
86 \ :call setloclist(0, map(systemlist("git diff --name-only --diff-filter=U \| uniq"), {_, p->{'filename': fnamemodify(p, ':.')}}))<CR>:lopen<CR>
87 menu &Git.&Display\ significance\ of\ changes
88 \ :!git diff --stat HEAD~1..HEAD
89 menu &Git.&Display\ Changed\ files\ compared\ to\ master
90 \ :!git diff --name-status ..master
91
92 menu &Match.Clear\ All\ Matches
93 \<Tab><F6>
94 \ :call clearmatches()<CR>
95
96 menu &Match.-Sep- :
97
98 menu &Match.&dispensable\ white\ spaces
99 \ :call matchadd("Convention", '\s\+$', 0)<CR>
100
101 menu &Match.&long\ lines\ (exeeding\ textwidth)
102 \ :call matchadd("Convention", '\%>'.&textwidth.'v.', 0)<CR>
103
104 menu &Match.Highlight\ current\ file\ name
105 \ :call matchadd("Search", escape(expand('%:t'), '.'))<CR>
106
107 " :execute ':match SpellBad /'.escape(expand('%:t'), '.').'/'<CR>
108
109 menu &Window.-Sep- :
110
111
112 menu &Window.Scratch
113 \ :Scratch<CR>
114
115
116 menu &Find.file\ under\ the\ cursor
117 \<Tab>gf
118 \ gf
119
120 menu &Find.Open\ search\ results\ in\ location\ list
121 \<Tab>:gf
122 \ :execute ':vimgrep /'.escape(getreg('/'), '.').'/g %'<CR>
123 \ :copen<CR>
124
125 menu &Changes.list
126 \<Tab>:changes
127 \ :changes<CR>
128 menu &Changes.-Sep- :
129 menu &Changes.previous
130 \<Tab>g;
131 \ g;
132 menu &Changes.next
133 \<Tab>g,
134 \ g,
135 menu &List.location.signs\ to\ list
136 \<Tab>CMD
137 \ :execute ":call setloclist(0, map(get(getbufinfo('%')[0], 'signs'), {_, p->extend(p, {'bufnr':buffer_number('.'), 'text':get(p, 'name')})}))"<CR>
138 menu &List.location.list\ to\ signs
139 \<Tab>CMD
140 \ :call execute(extend(['sign define LocationListEntry text=L', 'sign unplace *'], map(getloclist('%'), {key, val->'sign place '.(key+100).' name=LocationListEntry line='.val['lnum'].' buffer='.buffer_number('%')})))<CR>
141 menu &Jump.list
142 \<Tab>:jumps
143 \ :jumps<CR>
144 menu &Jump.-Sep1- :
145 menu &Jump.previous\ position
146 \<Tab>CTRL-O
147 \ <C-O>
148 menu &Jump.next\ position
149 \<Tab>CTRL-I
150 \ <C-I>
151 menu &Jump.-Sep2- :
152 menu &Jump.clear\ list
153 \<Tab>:clearjumps
154 \ :clearjumps
155
156 1000menu &Tag.list
157 \<Tab>:tags
158 \ :tags<CR>
159 1000menu &Tag.selection\ list
160 \<Tab>:ts
161 \ :ts<CR>
162
163 1000menu &Tag.-Sep1- :
164
165 1000menu &Tag.stack.jump\ older
166 \<Tab><C-T>
167 \ :po
168 1000menu &Tag.stack.jump\
169 \<Tab>:ta
170 \ :ta
171 endif
172augroup END " MAX_FUNCTION_MENU
173
diff --git a/plugin/max-highlight-word-under-cursor.vim b/plugin/max-highlight-word-under-cursor.vim
new file mode 100644
index 0000000..d557b40
--- /dev/null
+++ b/plugin/max-highlight-word-under-cursor.vim
@@ -0,0 +1,18 @@
1"=======================================================================================================================
2" HIGHLIGHT_WORD_UNDER_CURSOR:
3"=======================================================================================================================
4
5let w:m1 = 0
6function! HighlightWordUnderCursor()
7 if(exists('w:m1') && w:m1 > 0)
8 silent! call matchdelete(w:m1)
9 let w:m1 = 0
10 endif
11 let l:currentword = escape(expand('<cword>'), '.')
12 if(strlen(l:currentword) > 0)
13 let w:m1=100
14 silent! call matchadd('BoldUnderline', '\<'.l:currentword.'\>', -1, w:m1)
15 endif
16endfunction
17
18autocmd CursorHold,CursorHoldI * call HighlightWordUnderCursor()
diff --git a/plugin/max-set-window-title.vim b/plugin/max-set-window-title.vim
new file mode 100644
index 0000000..1a84ac3
--- /dev/null
+++ b/plugin/max-set-window-title.vim
@@ -0,0 +1,21 @@
1
2
3augroup SET_WINDOW_TITLE
4 set title
5 set titlelen=40
6
7 " set window title for screen(3)
8 " if &term == "screen" || &term == "xterm"
9 if &term == "screen"
10 set t_ts=k
11 set t_fs=\
12 endif
13
14 " autocmd BufEnter * let &titlestring = hostname() . "[vim(" . expand("%:t") . ")]"
15 " autocmd CursorHold * let &titlestring = "%t %y ".$USER."@".hostname().":%{expand("%:~:.:h")}"
16 " Fix terminal title =================================================================================================
17 " autocmd VimEnter * let &t_EI .= "\<Esc>[0 q"
18 " autocmd VimEnter * let &t_SI = "\<Esc>]12;green\x7"
19 autocmd VimLeave * silent !echo -ne "\033]112\007"
20augroup END
21
diff --git a/plugin/max-splash.vim b/plugin/max-splash.vim
new file mode 100644
index 0000000..5282679
--- /dev/null
+++ b/plugin/max-splash.vim
@@ -0,0 +1,23 @@
1"=======================================================================================================================
2" MAX_SPLASH:
3" Shows recently used files from the current directory in a location list
4"=======================================================================================================================
5
6" moved after VimEnter of statusline, so that it does not get overwritten any
7" more
8if empty(argv())
9
10 " autocmd VimEnter * call setloclist(0, filter(map(copy(v:oldfiles), {_, p->{'filename': expand(get(split(p, "'"), 0))}}), { val -> echo val}))
11
12 " from the list of recent files: make absolute paths, filter out files not
13 " contained in cwd and finally filter out directories and non-files...
14 autocmd StdinReadPre * let s:std_in=1
15 autocmd VimEnter * if !exists("s:std_in") | call setloclist(0, [], 'r',
16 \ {
17 \ 'title':'Recently used files in directory: '.getcwd(),
18 \ 'items':map(filter(filter(
19 \ map(copy(v:oldfiles),
20 \ {_, p->expand(p)}), 'v:val =~ "'.getcwd().'/"'), 'filereadable(v:val)'),
21 \ {_, p->{'filename': fnamemodify(p, ':.')}})
22 \ }) | lopen | only | setfiletype qf
23endif
diff --git a/plugin/nerdtree.vim b/plugin/nerdtree.vim
new file mode 100644
index 0000000..b9665fb
--- /dev/null
+++ b/plugin/nerdtree.vim
@@ -0,0 +1,25 @@
1augroup NERDTREE
2 " NERDTree: replaces NetRW, as long as it has so many bugs
3 let NERDTreeIgnore = ['\.aux$', '\.o$']
4 let NERDTreeCascadeSingleChildDir = 0 | " I don't get how one can use <m> to create files in that included directory
5 let NERDTreeChDirMode = 0
6 let NERDTreeHiddenFirst = 1
7 let NERDTreeMinimalUI = 1
8 let NERDTreeShowBookmarks = 1 | " show bookmarks by default (when opening for the first time)
9 let NERDTreeWinSize = 40
10 let NERDTreeQuitOnOpen = 1
11
12 " depending on if NERDTree has the focus:
13 nnoremap <expr>
14 \ <leader><leader>
15 \ bufwinnr("%")==g:NERDTree.GetWinNum() ? ':NERDTreeClose<CR>' : ':NERDTreeFind<CR>'
16 nnoremap <expr>
17 \ <F2>
18 \ bufwinnr("%")==g:NERDTree.GetWinNum() ? '<C-W><C-W>' : ':N<CR>'
19
20 nnoremap <expr>
21 \ <F3>
22 \ bufwinnr("%")==g:NERDTree.GetWinNum() ? '<C-W><C-W>' : ':n<CR>'
23
24 packadd nerdtree
25augroup END
diff --git a/plugin/netrw.vim b/plugin/netrw.vim
new file mode 100644
index 0000000..d9029cc
--- /dev/null
+++ b/plugin/netrw.vim
@@ -0,0 +1,16 @@
1augroup NETRW
2 " Deprecated with this configuration, but still useful when deactivating some Plugins
3 " NETRW: obsolete with NERDTree
4 let g:netrw_alto = 0 | " open files on the right
5 let g:netrw_altv = 1 | " open files on the right
6 let g:netrw_banner = 0 | " display help messages?
7 let g:netrw_browse_split = 4 | " 4=open in previous window
8 let g:netrw_fastbrowse = 2 | " manually refresh direcory list (avoids display errors)
9 let g:netrw_hide = 1 | " show not-hidden files only
10 let g:netrw_keepdir = 0
11 let g:netrw_list_hide = '^\..*' | " Explore mode: hide files starting with dot
12 let g:netrw_liststyle = 3 | " 3=tree
13 let g:netrw_preview = 0 | "
14 let g:netrw_winsize = 20 | " window size in percent
15 let s:treedepthstring = "│ "
16augroup END
diff --git a/plugin/signify.vim b/plugin/signify.vim
new file mode 100644
index 0000000..2ab41fe
--- /dev/null
+++ b/plugin/signify.vim
@@ -0,0 +1,35 @@
1augroup SIGNIFY
2 " displays file changes in sign column
3
4 let @l = ":let g:signify_vcs_cmds={'git': 'git diff --no-color --no-ext-diff -U0 HEAD^ -- %f'}|:SignifyRefresh"
5
6 " use signify only with git (improves speed when loading buffers, see :h signify)
7 let g:signify_vcs_list = [ 'git' ]
8
9 let g:signify_cursorhold_insert = 0
10 let g:signify_cursorhold_normal = 0
11 let g:signify_update_on_bufenter = 0
12 let g:signify_update_on_focusgained = 0
13 let g:signify_sign_show_count = 0
14
15 if has("multi_byte") && (&enc == 'utf-8' || &enc == 'utf-16' || &enc == 'ucs-4')
16 let g:signify_sign_add = '➕'
17 let g:signify_sign_delete = '➖'
18 let g:signify_sign_delete_first_line = '➖'
19 let g:signify_sign_change = '❇️'
20 let g:signify_sign_changedelete = '❇️'
21 endif
22
23 function! SignifyColorScheme()
24 highlight! SignifySignAdd ctermbg=NONE
25 highlight! link SignifySignAdd SignColumn
26 highlight! link SignifySignChange SignColumn
27 highlight! link SignifySignDelete SignColumn
28 highlight! link SignifySignChangeDelete SignColumn
29 highlight! link SignifySignDeleteFirstLine SignColumn
30 endfunction
31
32 packadd vim-signify
33
34 autocmd VimEnter,ColorScheme * call SignifyColorScheme()
35augroup END
diff --git a/plugin/snippets.vim b/plugin/snippets.vim
new file mode 100644
index 0000000..dcf265b
--- /dev/null
+++ b/plugin/snippets.vim
@@ -0,0 +1,12 @@
1
2augroup ULTISNIPS
3 if has("python") || has('python3')
4 let g:UltiSnipsExpandTrigger = '<Tab>'| " expands the snippet, be careful not to use <tab> elsewhere (ycm uses it by default, but it has been deactivated by g:ycm_key_list_select_completion)
5 let g:UltiSnipsJumpForwardTrigger = '<Tab>'|
6 let g:UltiSnipsJumpBackwardTrigger = '<S-Tab>'|
7
8 packadd vim-snippets
9 packadd ultisnips
10 endif
11augroup END
12
diff --git a/plugin/statusline.vim b/plugin/statusline.vim
new file mode 100644
index 0000000..98fc4a9
--- /dev/null
+++ b/plugin/statusline.vim
@@ -0,0 +1,125 @@
1augroup MAX_FANCYLINE
2 set noshowmode | " mode will be shown twice, in lightline and below, so we want to deactivate one
3 set laststatus=2 | " required by AirLine and Lightline, without status line does not appear until a window split
4
5 let g:status_sym_start = ''
6 let g:status_sym_end = ''
7 let g:status_sym_sep_start = ''
8 let g:status_sym_sep_end = ''
9 let g:symbol_branch = ''
10
11 if &term == "linux"
12 let g:symbol_branch = ''
13
14 let g:group_active = "StatusLineTerm"
15 let g:group_inactive = "StatusLineTermNC"
16 let g:group_tabline = "StatusLineTerm"
17 else
18 let g:group_active = "StatusLine"
19 let g:group_inactive = "StatusLineNC"
20 let g:group_tabline = "TabLine"
21 endif
22
23 " this function reverts foreground color and background color of a given
24 " highlight group and returns the name of a newly created _invert group
25 function! CreateInvertGroup(highlight_group)
26 if(synIDattr(hlID(a:highlight_group), "reverse")==1)
27 let w:color=synIDattr(hlID(a:highlight_group), "fg#")
28 else
29 let w:color=synIDattr(hlID(a:highlight_group), "bg#")
30 endif
31
32 let l:retval=a:highlight_group.'_invert'
33 if(exists('w:color') && w:color == '')
34 let w:color = 'NONE'
35 endif
36 silent! exec 'highlight '.retval.' gui=NONE guifg='.w:color.' cterm=NONE ctermfg='.w:color
37 return l:retval
38 endfunction
39
40 function! UpdateStatus(highlight_group)
41 let l:invert_group = CreateInvertGroup(a:highlight_group)
42 let l:mode = get({
43 \ 'n' : 'normal',
44 \ 'i' : 'insert',
45 \ 'R' : 'replace',
46 \ 'v' : 'visual',
47 \ "V" : 'visual line',
48 \ "\<C-V>" : 'visual block',
49 \ 'c' : 'command',
50 \ 's' : 'select',
51 \ 'S' : 'select line',
52 \ "\<C-s>" : 'select block',
53 \ 't' : 'terminal'
54 \ }, mode(), mode())
55 return ''
56 \ ."%#StatusLineHighlight#"
57 \ ."%#".a:highlight_group."#"
58 \ ."%(%w%h%q%)".' '.l:mode.' '.g:status_sym_sep_start.' '
59 \ ."%{(argc()>0\ ?\ argidx()+1.':'.argc().' '.g:status_sym_sep_start.' '\ :\ '')}"
60 \ ."%{winbufnr(0).' '.g:status_sym_sep_start}"
61 \ ."%{(&readonly\ ?\ '\ \ 🔒'\ :\ '')}"
62 \ ."%{(&modified\ ?\ '\ \ '.nr2char(0xF0C7).'\ '\ :\ '')\ }"
63 \ ."%{(haslocaldir() ?\ fnamemodify(getcwd(),\ ':.').' '.nr2char(0xe0b1)\ \:\ '')}\ "
64 \ ."%{(&buftype\ ==\ \"terminal\"\ ?\ has('nvim')?b:term_title:expand(&titlestring)\ :\ substitute(expand('%:p'),\ '^'.getcwd(-1).'/*',\ '',\ ''))\ }"
65 \ ."%1(%)"
66 \ ."%#".l:invert_group."#"
67 \ .g:status_sym_end
68 \ .''
69 \ ."%="
70 \ .''
71 \ ."%#".l:invert_group."#"
72 \ .g:status_sym_start
73 \ ."%#".a:highlight_group."#"
74 \ ."%1(%)"
75 \ ."%{(&filetype\ !=\ ''\ ?\ &filetype\ :\ &buftype)}"
76 \ ."%(\ %{g:status_sym_sep_end}\ %)"
77 \ ."%{(&spell\ ?\ &spelllang.' '.g:status_sym_sep_end\ :\ '')}"
78 \ ."%{(&fileencoding\ !=\ ''\ ?\ &fileencoding.' '.g:status_sym_sep_end.' '\ :\ '')}"
79 \ ."%{(&fileformat\ !=\ ''\ ?\ ' '.&fileformat.' '\ :\ '')}"
80 \ .g:status_sym_sep_end.' '
81 \ ."%4l:%-3c"
82 \ .g:status_sym_sep_end.' '
83 \ ."%-3p%%"
84 endfunction
85
86 function! UpdateTabline(highlight_group)
87 let l:invert_group = CreateInvertGroup(a:highlight_group)
88 return ''
89 \ ."%#".a:highlight_group."#"
90 \ ."%3( \ %)\ "
91 \ ."%{getcwd(-1)}\ "
92 \ .g:status_sym_sep_start.' '
93 \ ."%(\ ".g:symbol_branch."\ %{fugitive#head()}\ %)"
94 \ ."%#".l:invert_group."#"
95 \ .g:status_sym_end
96 \ .''
97 \ ."%="
98 \ .''
99 \ ."%#".l:invert_group."#"
100 \ .g:status_sym_start
101 \ ."%#".a:highlight_group."#"
102 \ ."%3(\ %)"
103 \ ."%(%{v:servername}\ %{v:this_session}%)"
104 \ .g:status_sym_sep_end.' '
105 \ ."%(\ \ %{tabpagenr()}/%{tabpagenr('$')}\ %)"
106 \ ."%##"
107 \ ."" " end
108 endfunction
109
110 function! ApplyColorScheme()
111 " set termguicolors | " When on, uses highlight-guifg and highlight-guibg attributes in the terminal (=24bit color) incompatible with nvim
112 " set t_ut=
113 " set up statusline, global and current window individually
114 set statusline=%!UpdateStatus(g:group_inactive)
115 setlocal statusline=%!UpdateStatus(g:group_active)
116 " set up the tabline (match colors)
117 set tabline=%!UpdateTabline(g:group_tabline)
118 endfunction
119 " apply colors from the loaded colorscheme...
120 " when changing the colorscheme also apply new colors to the statusbar...
121 autocmd VimEnter,ColorScheme * call ApplyColorScheme()
122
123 autocmd WinEnter * setlocal statusline=%!UpdateStatus(g:group_active)
124 autocmd WinLeave * setlocal statusline<
125augroup END " MAX_FANCYLINE
diff --git a/plugin/tagbar.vim b/plugin/tagbar.vim
new file mode 100644
index 0000000..2758f20
--- /dev/null
+++ b/plugin/tagbar.vim
@@ -0,0 +1,10 @@
1augroup TAGBAR
2 let g:tagbar_autoclose = 0
3 let g:tagbar_autofocus = 1
4 let g:tagbar_autoshowtag = 0
5 let g:tagbar_compact = 1
6 let g:tagbar_indent = 0
7 let g:tagbar_foldlevel = 99
8
9 packadd tagbar
10augroup END
diff --git a/plugin/terminal.vim b/plugin/terminal.vim
new file mode 100644
index 0000000..c8f02fd
--- /dev/null
+++ b/plugin/terminal.vim
@@ -0,0 +1,19 @@
1augroup TERMINAL
2 " Vim 8 has a terminal command...
3 if has('terminal')
4 " use default ESC key to leave insert mode in the internal terminal emulator
5 tnoremap <Esc> <C-W>N
6 " make terminal windows hidden by default (copied from :help terminal)
7 autocmd BufWinEnter * if &buftype == 'terminal' | setlocal bufhidden=hide | endif
8 endif
9
10 " NEOVIM_incompatible:
11 if has('nvim') " Neovim?
12 autocmd TermOpen term://* set nobuflisted
13 " use default ESC key to leave insert mode in the internal terminal emulator
14 tnoremap <Esc> <C-\><C-n>
15
16 menu &UI.&Open\ in\ Serversession
17 \ :execute ':!nvr --servername /tmp/nvimsocket --remote % +'.line('.')<CR>:stopinsert<CR>:set readonly<CR>
18 endif
19augroup END
..