aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitmodules57
-rw-r--r--GetLatest/GetLatestVimScripts.dat10
-rw-r--r--compton.conf64
-rw-r--r--gvimrc29
-rw-r--r--[l---------]init.vim36
-rw-r--r--list-commands.vim6
-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
-rw-r--r--vimpagerrc12
-rw-r--r--[l---------]vimrc50
-rw-r--r--vimrc-common355
-rw-r--r--vimrc-full1255
-rw-r--r--vimrc-minimal-statusline30
-rw-r--r--xdg-additions/applications/gvim-buffer.desktop (renamed from gvim-buffer.desktop)0
-rw-r--r--xdg-additions/applications/gvim.desktop (renamed from gvim.desktop)0
-rw-r--r--xdg-additions/applications/nvim.desktop (renamed from nvim.desktop)0
-rw-r--r--xdg-additions/applications/vim.desktop (renamed from vim.desktop)0
-rw-r--r--xdg-additions/bashrc (renamed from bashrc)0
-rw-r--r--xdg-additions/default-font.conf (renamed from default-font.conf)0
-rw-r--r--xdg-additions/gtk-3.0.css (renamed from gtk-3.0.css)0
-rw-r--r--ycm_extra_mini-conf.py138
38 files changed, 2109 insertions, 1327 deletions
diff --git a/.gitmodules b/.gitmodules
index 605d959..a24b441 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -1,3 +1,60 @@
1[submodule "autoload"] 1[submodule "autoload"]
2 path = autoload 2 path = autoload
3 url = https://github.com/junegunn/vim-plug 3 url = https://github.com/junegunn/vim-plug
4[submodule "plugin/YouCompleteMe"]
5 path = pack/vim/opt/YouCompleteMe
6 url = https://github.com/Valloric/YouCompleteMe.git
7[submodule "plugin/vim-remote-menu"]
8 path = pack/_all/start/vim-remote-menu
9 url = https://github.com/coderonline/vim-remote-menu.git
10[submodule "plugin/base16-vim"]
11 path = pack/_all/start/base16-vim
12 url = https://github.com/chriskempson/base16-vim.git
13[submodule "plugin/papercolor-theme"]
14 path = pack/_all/start/papercolor-theme
15 url = https://github.com/NLKNguyen/papercolor-theme.git
16[submodule "plugin/vim-signify"]
17 path = pack/_all/opt/vim-signify
18 url = https://github.com/mhinz/vim-signify.git
19[submodule "plugin/vim-fugitive"]
20 path = pack/_all/start/vim-fugitive
21 url = https://github.com/tpope/vim-fugitive.git
22[submodule "plugin/tabular"]
23 path = pack/_all/start/tabular
24 url = https://github.com/godlygeek/tabular.git
25[submodule "plugin/tagbar"]
26 path = pack/_all/opt/tagbar
27 url = https://github.com/majutsushi/tagbar.git
28[submodule "plugin/vim-surround"]
29 path = pack/_all/start/vim-surround
30 url = https://github.com/tpope/vim-surround.git
31[submodule "plugin/nerdtree"]
32 path = pack/_all/opt/nerdtree
33 url = https://github.com/scrooloose/nerdtree.git
34[submodule "plugin/ultisnips"]
35 path = pack/_all/opt/ultisnips
36 url = https://github.com/SirVer/ultisnips.git
37[submodule "plugin/vim-snippets"]
38 path = pack/_all/opt/vim-snippets
39 url = https://github.com/honza/vim-snippets.git
40[submodule "plugin-neovim/deoplete.nvim"]
41 path = pack/neovim/start/deoplete.nvim
42 url = https://github.com/Shougo/deoplete.nvim.git
43[submodule "plugin-neovim/echodoc.vim"]
44 path = pack/neovim/start/echodoc.vim
45 url = https://github.com/Shougo/echodoc.vim.git
46[submodule "plugin-neovim/LanguageClient-neovim"]
47 path = pack/neovim/start/LanguageClient-neovim
48 url = https://github.com/autozimu/LanguageClient-neovim.git
49[submodule "plugin-neovim/ale"]
50 path = pack/neovim/start/ale
51 url = https://github.com/w0rp/ale.git
52[submodule "plugin-vim/syntastic"]
53 path = pack/vim/opt/syntastic
54 url = https://github.com/vim-syntastic/syntastic.git
55[submodule "plugin/jedi-vim"]
56 path = pack/_all/opt/jedi-vim
57 url = https://github.com/davidhalter/jedi-vim.git
58[submodule "plugin/vim-operator-user"]
59 path = pack/_all/start/vim-operator-user
60 url = https://github.com/kana/vim-operator-user.git
diff --git a/GetLatest/GetLatestVimScripts.dat b/GetLatest/GetLatestVimScripts.dat
new file mode 100644
index 0000000..aff0816
--- /dev/null
+++ b/GetLatest/GetLatestVimScripts.dat
@@ -0,0 +1,10 @@
1ScriptID SourceID Filename
2--------------------------
3294 19633 :AutoInstall: Align.vim
4120 9388 Decho.vim
540 21108 DrawIt.tar.gz
6451 9231 EasyAccents.vim
7195 6351 engspchk.vim
8642 15781 GetLatestVimScripts.vim
9489 16670 Manpageview.vim
101066 7618 :AutoInstall: cecutil.vim
diff --git a/compton.conf b/compton.conf
deleted file mode 100644
index 1d3025d..0000000
--- a/compton.conf
+++ /dev/null
@@ -1,64 +0,0 @@
1backend = "xrender";
2#backend = "glx";
3paint-on-overlay = true;
4glx-no-stencil = true;
5# glx-no-rebind-pixmap = true; # does not work! definitelly!
6# vsync = "opengl-swc";
7vsync = "drm";
8# vsync-use-glfinish = true
9
10# These are important. The first one enables the opengl backend. The last one is the vsync method. Depending on the driver you might need to use a different method.
11# The other options are smaller performance tweaks that work well in most cases.
12# You can find the rest of the options here: https://github.com/chjj/compton/wiki/perf-guide, and here: https://github.com/chjj/compton/wiki/vsync-guide
13
14
15# Shadow
16#shadow = true; # Enabled client-side shadows on windows.
17shadow = false; # Enabled client-side shadows on windows.
18#no-dock-shadow = true; # Avoid drawing shadows on dock/panel windows.
19#no-dnd-shadow = true; # Don't draw shadows on DND windows.
20# clear-shadow = true; # Zero the part of the shadow's mask behind the window (experimental).
21shadow-radius = 7; # The blur radius for shadows. (default 12)
22shadow-offset-x = -7; # The left offset for shadows. (default -15)
23shadow-offset-y = -7; # The top offset for shadows. (default -15)
24shadow-exclude = [
25 "! name~=''",
26 "n:e:Notification",
27 "n:e:Plank",
28 "n:e:Docky",
29 "g:e:Synapse",
30 "g:e:Kupfer",
31 "g:e:Conky",
32 "n:w:*Firefox*",
33 "n:w:*Chrome*",
34 "n:w:*Chromium*",
35 "class_g ?= 'Notify-osd'",
36 "class_g ?= 'Cairo-dock'",
37 "class_g ?= 'Xfce4-notifyd'",
38 "class_g ?= 'Xfce4-power-manager'",
39 "x = 0 && y = 0 && override_redirect = true"
40];
41
42# The shadow exclude options are helpful if you have shadows enabled. Due to the way compton draws its shadows, certain applications will have visual glitches
43# (most applications are fine, only apps that do weird things with xshapes or argb are affected).
44# This list includes all the affected apps I found in my testing. The "! name~=''" part excludes shadows on any "Unknown" windows, this prevents a visual glitch with the XFWM alt tab switcher.
45
46# Fading
47# fading = true; # Fade windows during opacity changes.
48fade-delta = 8; # The time between steps in a fade in milliseconds. (default 10).
49fade-in-step = 0.03; # Opacity change between steps while fading in. (default 0.028).
50fade-out-step = 0.03; # Opacity change between steps while fading out. (default 0.03).
51#no-fading-openclose = true; # Fade windows in/out when opening/closing
52
53detect-client-opacity = true; # This prevents opacity being ignored for some apps. For example without this enabled my xfce4-notifyd is 100% opacity no matter what.
54
55# Window type settings
56wintypes:
57{
58 tooltip = { fade = true; shadow = true; };
59};
60
61#opacity-rule = ["90:class_g = 'URxvt'", "90:class_g = ''" ];
62
63
64opacity-rule = ["90:class_g = 'xfce4-terminal'", "95:class_g = 'Xfce4-terminal'", "90:class_g = 'termite'", "90:class_g = 'i3bar'", "90:class_g = 'i3-frame'", "90:class_g = 'Gnome-terminal'", "90:class_g = 'gnome-terminal-server'" ];
diff --git a/gvimrc b/gvimrc
new file mode 100644
index 0000000..b4f2d70
--- /dev/null
+++ b/gvimrc
@@ -0,0 +1,29 @@
1" ======================================================================================================================
2" GUI_DEFAULTS:
3" We want to have a minimal UI
4" ======================================================================================================================
5
6if has("gui_running")
7 set guicursor=a:block-blinkon100
8 set browsedir=buffer
9 set toolbar+=text
10 set guiheadroom=0
11 set guioptions+=eig
12 set guioptions-=T | " toolbar
13 set guioptions+=c | " use console dialogues instead of popups
14 set guioptions+=a | " auto select: copy&paste using middle click
15 set guioptions+=m | " remove menu
16 set guioptions-=e | " do not display tabs
17 set guioptions-=L | " do not show left scrollbar
18 set guioptions-=r | " do not show right scrollbar
19 set winaltkeys=menu | " behave like other windows: ALT-key can be used to open the menu (and cannot be :remaped)
20 " set selectmode=mouse,key,cmd | " enters vim's select mode when pressing shift-left or shift-END
21 " set keymodel=startsel,stopsel | " makes shift-left, shift-right available for selecting text
22
23 " its possible to define alternative fonts (order matters), but we will
24 " use the systems default font and cofigure that if necessary
25 set guifont=Monospace\ 10
26
27 " like in the terminal: use Ctrl-shift-v for paste in vim's command editor
28 cnoremap <c-s-v> <c-r>*
29endif
diff --git a/init.vim b/init.vim
index c9a3c9c..67bdf65 120000..100644
--- a/init.vim
+++ b/init.vim
@@ -1 +1,35 @@
1vimrc \ No newline at end of file 1exec ':source '.fnamemodify($MYVIMRC,':h').'/vimrc-common'
2
3set packpath+=pack/neovim
4
5"=======================================================================================================================
6augroup DEOPLETE
7 inoremap <silent><expr> <C-Space> deoplete#mappings#manual_complete()
8
9 let g:deoplete#enable_at_startup = 1
10 let g:echodoc#enable_at_startup = 1
11 let g:LanguageClient_serverCommands = {
12 \ 'cpp': ['clangd'],
13 \ 'c': ['clangd']
14 \ }
15
16 packadd deoplete.nvim
17 packadd LanguageClient-neovim
18 packadd echodoc.vim
19augroup END
20
21"=======================================================================================================================
22augroup ALE
23 let g:ale_set_highlights = 0
24
25 let g:ale_sign_error = ''
26 let g:ale_sign_style_error = ''
27 let g:ale_sign_info = ''
28 let g:ale_sign_warning = ''
29
30 highlight! link ALEWarningSign FoldColumn
31
32 packadd ale
33augroup END
34
35
diff --git a/list-commands.vim b/list-commands.vim
new file mode 100644
index 0000000..0dd4bca
--- /dev/null
+++ b/list-commands.vim
@@ -0,0 +1,6 @@
1
2
3
4for s in sort(getcompletion('', 'function'))
5 echo getcompletion(s, 'function')
6endfor
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
diff --git a/vimpagerrc b/vimpagerrc
index 9516d3c..89cdb4f 100644
--- a/vimpagerrc
+++ b/vimpagerrc
@@ -1,10 +1,10 @@
1let g:vimpager = {} 1let g:vimpager = {}
2let g:less = {} 2let g:less = {}
3let g:less.enabled = 0 3let g:less.enabled = 0
4let g:less.number = 1 4let g:less.number = 1
5let g:less.hlsearch = 0 5let g:less.hlsearch = 0
6let g:vimpager.ansiesc = 0 6let g:vimpager.ansiesc = 0
7let g:less.enabled = 0 7let g:less.enabled = 0
8 8
9set noswapfile 9set noswapfile
10set viminfo+=% | " restore buffer list 10set viminfo+=% | " restore buffer list
diff --git a/vimrc b/vimrc
index 9a5cefb..1b9f20b 120000..100644
--- a/vimrc
+++ b/vimrc
@@ -1 +1,49 @@
1vimrc-full \ No newline at end of file 1exec ':source '.fnamemodify($MYVIMRC,':h').'/vimrc-common'
2
3set packpath+=pack/vim
4
5
6set ttymouse=xterm2
7set ttyscroll=100 | " improves speed for terminal vim, incompatible with nvim
8set ttyfast | " improves speed for terminal vim (incompatible with nvim)
9set nottybuiltin | " use external termcaps
10set restorescreen | " restores the console after exiting vim (intentionally not in nvim)
11
12autocmd VimLeave * call system("echo -n $'" . escape(getreg(), "'") . "' | xsel -ib")
13
14
15" scripts from the default vim installation, which do not get loaded by default, but are useful.
16if filereadable($VIMRUNTIME.'/macros/editexisting.vim')
17 packadd! editexisting
18endif
19
20" load default plugin 'matchit' to allow % to jump between tags
21if filereadable($VIMRUNTIME.'/macros/matchit.vim')
22 packadd! matchit
23endif
24
25"=======================================================================================================================
26augroup YOUCOMPLETEME
27 let g:ycm_error_symbol = '✖' " insert this as an error symbol in the gutter bar/sign column
28 let g:ycm_warning_symbol = '➔' " insert this as a warning symbol in the gutter bar/sign coloumn
29
30 let g:ycm_autoclose_preview_window_after_insertion = 0
31 let g:ycm_auto_trigger = 1
32 let g:ycm_collect_identifiers_from_tags_files = 1 " Let YCM read tags from Ctags file
33 let g:ycm_confirm_extra_conf = 0 " security is overrated ;)
34 let g:ycm_always_populate_location_list = 0 " we can manually run :YcmDiags to do that
35
36 let g:ycm_key_list_previous_completion = ['Up']
37 let g:ycm_key_list_select_completion = ['Down']
38
39 let g:ycm_semantic_triggers =
40 \ {
41 \ 'c': [ 're!\w{2}' ]
42 \ } " per language configurations
43
44
45 packadd YouCompleteMe
46augroup END
47
48
49
diff --git a/vimrc-common b/vimrc-common
new file mode 100644
index 0000000..00c7996
--- /dev/null
+++ b/vimrc-common
@@ -0,0 +1,355 @@
1"=======================================================================================================================
2" GENERAL:
3" It is likely, that you will want to overwrite these settings with a
4" project-local .vimrc file (activated with exrc setting)
5"=======================================================================================================================
6
7set exrc | " enable exrc, a specific .exrc per project, which can contain usual .vimrc commands
8set modeline | " set variables specific to a file, like indentation by adding a comment
9set textwidth=0 | " better done with modeline or local exrc and not here
10set ts=4 sts=4 sw=4 expandtab | " better done with a modeline or local exrc
11set virtualedit=all | " virtual edit should be default behaviour, because I don't see any reason against
12set nonumber norelativenumber | " do not show numbers by default, because that causes a performance loss, instead activate them on a file type basis
13set ignorecase smartcase | " search with ignore case by default, but use case sensitive search when one capital char is contained and highlight while typing (even though its slower)
14set hlsearch incsearch | " highlight pattern while entering it (performance wise this isn't that good)
15set cindent cinoptions+=(0 | " indent at parentheses
16
17set path+=** | " allow recursive searches for files
18let &path = &path.",/usr/lib/modules/".substitute(system('uname -r'), "\n", "", "")."/build/include"
19
20filetype on
21filetype plugin on
22filetype indent on
23
24syntax on | " enable syntax highlighting
25syntax sync minlines=60 | " how many preceding lines will be parsed? (has performance impact)
26
27"=======================================================================================================================
28" SPELL_CHECKING:
29"=======================================================================================================================
30let g:spellfile_URL='http://ftp.vim.org/vim/runtime/spell'
31" add local user default spell file as primary source for words
32let &spellfile=fnamemodify($MYVIMRC, ":p:h")."/spell/spellfile-user.UTF-8.add"
33
34set nospell | " disable spell checker by default
35set spelllang=en,de | " languages for the spell checker
36set spellsuggest=10 | " how many words will z= suggest?
37set thesaurus+=~/.vim/thesaurus/php.txt
38
39
40"=======================================================================================================================
41" UNDO:
42" Persistent undo behaviour, also keeps undo history between starts
43"=======================================================================================================================
44if has('persistent_undo')
45 if isdirectory('/dev/shm')
46 set undodir=/dev/shm/ | " save undo file in memory. That is volatile, but fast and we have GIT for longer lasting undoes
47 set directory=/dev/shm/ | " swap file directory to RAM
48 set swapfile
49 elseif isdirectory('/tmp/')
50 set undodir=/tmp/
51 endif
52 set undofile | " preserve undo history when closing and reopening buffers (see :help undo-persistence)
53endif
54
55
56"=======================================================================================================================
57" MULTI_BYTE:
58"=======================================================================================================================
59if has("multi_byte")
60 scriptencoding utf-8 | " tell vim that we are using UTF-8 here
61 set encoding=utf-8 | " we need default UTF-8 encoding to use cool chars as line break and so on (see below)
62 set termencoding=utf-8 | " we just assume that this is supported.
63
64 set fillchars= | " initialize empty fillchars
65 set listchars= | " initialize empty listchars
66
67 if &term == "linux"
68 set fillchars+=vert:\│ | " cool vertical split char
69 else
70 set fillchars+=vert:\║ | " cool vertical split char
71 endif
72
73 set fillchars+=fold:\ | "
74 set fillchars+=diff:\ | " a white space gets used here
75
76 set listchars+=extends:» | " symbols used when using :set list (which displays non-printable chars)
77 set listchars+=precedes:« | " symbols used when using :set list (which displays non-printable chars)
78
79 set listchars+=tab:▏\ | "
80 set listchars+=trail:· | " symbols used when using :set list (which displays non-printable chars)
81 " set listchars+=eol:↲ | " symbols used when using :set list (which displays non-printable chars)
82 " set listchars+=space:· | " symbols used when using :set list (which displays non-printable chars)
83 set showbreak+=› | " symbol used in the beginning of a wrapped line
84
85 " automatically enter list mode when going in insert mode (makes above syntax command temporarily ineffective)
86 set nolist
87
88 autocmd InsertEnter * set list
89 autocmd InsertLeave * set list&
90
91
92 autocmd InsertEnter * set colorcolumn=80,120
93 autocmd InsertLeave * set colorcolumn&
94
95
96 " set fillchars+=stlnc:\― | "
97end
98
99" ======================================================================================================================
100" SETTINGS:
101" ======================================================================================================================
102set breakindent | " Every wrapped line will continue visually indented
103set clipboard=unnamedplus | " makes copy and paste work (autoselectplus might work as well)
104set concealcursor=nc | " limits the display of concealed text to normal and command mode
105set conceallevel=2 | " replace escaped chars by their UTF-8 representation (useful for LaTeX)
106set confirm | " asks 'do you want to save?'
107set cpoptions+=P | " makes :w filename set the current buffer to filename
108set hidden | " allows switching buffers even if the current buffer contains changes (displays +)
109set linebreak | " wrap long lines at char 'breakat', not inside words
110set mousemodel=popup | " only in gvim: right click opens a pop-up-menu
111set mouse=n | " allow mouse in normal mode only, so one can use the terminals c&p feature in insert mode
112set noautochdir | " When on, Vim will change the current working directory
113set nostartofline | " when scrolling: do not move the cursor to column 1
114set nowrap | " but do not (by default) wrap long lines around
115set nrformats+=alpha | " allows CTRL-A & CTRL-X to increment and decrement letters, not just numbers
116
117if has('nvim') " Neovim?
118 set inccommand=nosplit | " preview substitute and such things in real time
119endif
120
121set pumheight=8 | " Determines the maximum number of items to show in the pop-up menu for
122set scrolljump=5 | " how many lines get scrolled into view when cursor reaches the screens edge
123set scrolloff=0 | " keeps cursor centered
124set shiftround | " indent/un-indent snaps to multiple of shiftwidths
125set writedelay=0
126
127" display and performance
128set lazyredraw | " disables redraw during macro execution (improves performance)
129set cmdheight=2 | " sets the command line's height
130set signcolumn=auto | " auto=auto hide, yes=always, no=never show the column with error indicators
131set nocursorcolumn | " turn visual cursor column off (improves performance)
132set updatetime=80 | " updates the screen more often
133set redrawtime=1500 | " Timeout in milliseconds for redrawing the screen (switches syntax off when ssh too slow) / CTRL+L to retry
134set notimeout | " improves performance but is known to cause problems on slow terminals
135set ttimeout ttimeoutlen=150 | " set Esc key timeout in ms-
136set showcmd | " essential: show keys of combined commands in the lower right corner (BUT SLOW, makes cursor flickering)
137set showtabline=2 | " 0: never, 1: only if there are at least two tabs, 2:always
138set shortmess+=I | " don't give the intro message when starting Vim |:intro|.
139set wildmenu | " use a menu in the command line
140set wildmode=longest:full | " do not preselect any entry and show all possible
141
142" code completion
143" set dictionary=/usr/share/dict/cracklib-small
144" set complete+=k " make default completer <C-N> respect the dictionary
145set complete-=u " scan current and included files
146set complete+=i " scan current and included files
147set complete+=d " scan current and included files for defined name or macro
148set complete+=d | " scan current and included files for defined name or macro
149set complete+=i | " scan current and included files for completions
150set completeopt+=noinsert | " Do not insert any text for a match until the user selects one
151set completeopt+=noselect | " Do not select a completion from the menu, let the user do that
152set tagcase=match | " tagcase match, because we mostly use ^] to jump around and that variant respects the upper/lower case [followscs, followic, match, ignore]
153set tags+=../tags
154
155" code folding...
156set nofoldenable | " disable folding, because we have zi to toggle foldenable :)
157set foldclose=all | " automatically fold, when the cursor leaves the folded area
158set foldcolumn=2 | " I think I don't need this second indicator
159" set numberwidth=5
160" set foldmethod=syntax | " foldlevel: syntax, indent, manual / foldmethod=syntax makes Vim incredible slow
161set foldnestmax=1 | " top level folding only
162set foldopen=block,hor,search | " when do we unfold?
163set foldtext=printf('%*s%.*S',indent(v:foldstart),'',&textwidth-indent(v:foldstart),substitute(substitute(join(getline(v:foldstart,v:foldend),'\ '),'[[:space:]]\\+','\ ','g'),'^[[:space:]*]','','g'))
164
165" works ...
166" set foldexpr=match(synIDattr(synID(v:lnum,indent(v:lnum)+1,0),'name'),'Comment')>-1
167set foldexpr=!empty(filter(synstack(v:lnum,indent(v:lnum)+1),{_,val->match(synIDattr(val,'name'),'Comment')>-1}))
168
169
170" vim window behaviour
171set splitbelow | " open new windows below the current one (i find that more intuitive)
172set splitright | " this also works for me and makes better use of the scren space I think
173set winminwidth=0 | " (and all other windows, so TODO: watch out)
174set winwidth=30 | " keep NERDTreeWindow at least this size
175
176
177" vim session handling and restore behaviour
178set viminfo+=% | " restore buffer list
179set sessionoptions=
180set sessionoptions+=buffers
181set sessionoptions+=curdir
182set sessionoptions+=folds
183set sessionoptions+=resize
184set sessionoptions+=slash
185set sessionoptions+=tabpages
186set sessionoptions+=unix
187set sessionoptions+=winpos
188set sessionoptions+=winsize
189
190" set nocindent smartindent | " use smart indent rather then cindent
191set noautoindent
192set nosmartindent
193
194set noshiftround | " indent/un-indent sna=ps to multiple of shiftwidths
195set noequalalways | " do not evenly size windows when opening new or closing old
196set nocursorline | " turn visual cursor line off (improves performance)
197
198"=======================================================================================================================
199if has("autocmd")
200 " use the shada/viminfo file to return the cursor to where it was...
201 autocmd BufReadPost * call setpos(".", getpos("'\""))
202 autocmd BufWinEnter * if &previewwindow | setlocal nonumber nolist signcolumn=no filetype=c nobuflisted | endif
203 autocmd TextYankPost * echo '> text yanked to '.
204 \ (get(v:event,'regname') == ''
205 \ ? 'default register'
206 \ : 'register '.get(v:event,'regname'))
207
208
209 autocmd InsertLeave * silent! call matchadd('Convention', ' \+$', -1, 101, { 'conceal': '⟶' })
210 autocmd InsertEnter * silent! call matchdelete(101)
211
212
213 "====================================================================================================================
214 augroup FILETYPES
215 " indent within <script> and <style> (default is a zero indent)
216 let g:html_indent_script1 = "inc"
217 let g:html_indent_style1 = "inc"
218
219 let g:loaded_ruby_provider = 1 " disable ruby support
220 let g:loaded_python_provider = 1 " disable python 3
221
222 let g:LatexBox_latexmk_preview_continuously = 1
223 let g:LatexBox_viewer = "evince"
224
225 autocmd FileType python setlocal keywordprg=pydoc
226 autocmd FileType vim setlocal keywordprg=:help |.
227 autocmd FileType conf setlocal isfname-==
228 autocmd FileType c,cpp setlocal equalprg=clang-format
229 autocmd FileType c,cpp setlocal breakat-=-
230 autocmd FileType c,cpp setlocal keywordprg=man\ 3
231 autocmd FileType c,cpp map <buffer> = :pyf /usr/share/clang/clang-format.py<CR>
232 autocmd Filetype css command! CSSsort :g/{/+1;/}/-1 sort
233 autocmd Filetype html,markdown,xml iabbrev </ </<C-X><C-O>
234
235 autocmd Filetype html,htmldjango,xml
236 \ :nnoremap
237 \ <M-Down>
238 \ :call search('^ *<', 'e')<CR>:nohlsearch<CR>|
239 \ :nnoremap
240 \ <M-Up>
241 \ :call search('^ *<', 'eb')<CR>:nohlsearch<CR>|
242 \ :nnoremap
243 \ <leader>=
244 \ vat:'<,'>!tidy -xml --wrap 0 --sort-attributes alpha 2>/dev/null<CR>vat=
245
246 if filereadable("/usr/bin/vendor_perl/ack")
247 autocmd FileType c,cpp set grepprg=/usr/bin/vendor_perl/ack\ --type=cc\ --nogroup\ --column\ $*
248 autocmd FileType c,cpp set grepformat=%f:%l:%c:%m
249 endif
250 augroup END
251endif
252
253" ======================================================================================================================
254augroup CUSTOM_COMMANDS
255 command! Vimls
256 \ call setloclist(0, map(getbufinfo({'buflisted':1}),
257 \ "{'bufnr': v:val.bufnr,
258 \ 'lnum': v:val.lnum,
259 \ 'text': '='.printf('%*s, % 3d: %s [%s]', winwidth(0) / 2, '', v:val.bufnr, v:val.name, getbufvar(v:val.bufnr, '&buftype')),
260 \ 'pattern': 'not loaded'}
261 \ "))
262 command! Ctoggle
263 \ if(get(getqflist({'winid':1}), 'winid') == win_getid())|cclose|else|botright copen|endif
264 command! Ltoggle
265 \ if(get(getloclist(0, {'winid':1}), 'winid') == win_getid())|lclose|else|lopen|endif
266 command! BuffersToArg :exec ':args '.join(map(range(0, bufnr('$')), 'fnameescape(fnamemodify(bufname(v:val), ":."))'))
267 command! BufToArg :argadd %:.
268 command! Gbranch call setqflist([], 'r', {'title':'Git branch selector','items':map(systemlist("git branch"), {_, p->{'filename':'branch','module': fnamemodify(p, ':.')}})})
269 " the following command opens a preview-window and shows the declaration of
270 " the function under the cursor. It also highlights the word to make it easier
271 " to spot within a great file
272 command! Helpme au! CursorHold * nested let @/=expand('<cword>')|exe "silent! psearch ".expand("<cword>")
273 command! FindInAllBuffers cex [] | bufdo vimgrepadd //g % | cw
274augroup END
275
276"=======================================================================================================================
277augroup KEYBOARD_MAPPING
278 " map CTRL-PageUp/Down to next/previous buffer
279 " and Shift-PageUp/Down to next/previous arglist file
280 nnoremap <C-PageUp> :bn<CR>
281 nnoremap <C-PageDown> :bp<CR>
282 nnoremap <S-PageUp> :N<CR>
283 nnoremap <S-PageDown> :n<CR>
284
285
286 nnoremap <F4> :wincmd c<CR>
287
288 nnoremap <F5> :make!<CR>
289 nnoremap <F6> :silent syntax sync fromstart<CR>:nohlsearch<CR>:silent match<CR>:silent 2match<CR>:silent 3match<CR>
290 nnoremap <F7> :Ltoggle<CR>
291 nnoremap <F8> :Ctoggle<CR>
292
293 nnoremap <F9> :TagbarToggle<CR>
294 nnoremap <F12> :Vimls<CR>:Ltoggle<CR>
295
296 " close current buffer with <leader>q...
297 nnoremap <leader>q :bp<bar>sp<bar>bn<bar>bd<CR>.
298 nnoremap <leader>r :syntax sync fromstart
299
300 nnoremap <silent> <A-Up> :wincmd k<CR>
301 nnoremap <silent> <A-Down> :wincmd j<CR>
302 nnoremap <silent> <A-Left> :wincmd h<CR>
303 nnoremap <silent> <A-Right> :wincmd l<CR>
304
305
306 inoremap <C-S> <C-O>:w<CR>
307
308 " exec current line as a command, insert output of command (from: https://youtu.be/MquaityA1SM?t=35m45s)
309 nnoremap <leader>Q !!$SHELL<CR>
310 " google the word under the cursor
311 nnoremap <leader>G :execute ":!xdg-open https://google.de/search?q=".expand("<cword>")
312 " display highlight group under the cursor
313 nnoremap <leader>h :echo map(synstack(line('.'), col('.')), 'synIDattr(v:val, "name")')<CR>
314
315
316 " ======================================================================================================================
317 " SHORTCUTS: custom shortcuts
318 " inoremap <C-Space> <C-x><C-o>
319 " inoremap <C-@> <C-Space>
320
321 " Bind CTRL+Backspace to vim's version (CTRL+W) in " <CR> insert mode (only works with gvim)
322 inoremap
323 \ <C-Backspace>
324 \ <C-W>
325
326 " INDENTATION: allows un-indenting a selected block and keeps selection
327 vnoremap < <gv
328 vnoremap > >gv
329
330 " make shift-home select to the beginning of the line
331 nnoremap <s-home> v^
332 nnoremap <s-end> v$
333
334 nnoremap <s-down> vj
335 vnoremap <s-down> j
336 nnoremap <s-up> vk
337 vnoremap <s-up> k
338
339
340
341 " INSERT_MODE_MAPPINGS:
342 " default copy&paste insert key binding (just in insert mode, so it doesn't conflict
343 " with visual block mode)- would have been nice, but collides with c-w for digraphs
344 " inoremap <C-V> <C-R>+
345
346 " NEOVIM_SPECIFIC:
347 if has('nvim') " only neovim...
348 " shortcut \t opens a terminal in a horizontal split
349 nnoremap <leader>t :new +terminal<CR>
350 endif
351augroup END
352
353"=======================================================================================================================
354" v modeline, do not chnage v
355" vim: noai:ts=2:sw=2:sts=2 iskeyword+=\:,\<,\>,\-,\& number
diff --git a/vimrc-full b/vimrc-full
deleted file mode 100644
index 7512908..0000000
--- a/vimrc-full
+++ /dev/null
@@ -1,1255 +0,0 @@
1" vim: noai:ts=2:sw=2:sts=2 iskeyword+=\:,\<,\>,\-,\& number
2
3"=======================================================================================================================
4" GENERAL:
5"=======================================================================================================================
6set exrc | " enable exrc, a specific .exrc per project, which can contain usual .vimrc commands
7set textwidth=0 | " better done with modeline or local exrc and not here
8set ts=4 sts=4 sw=4 expandtab | " better done with a modeline or local exrc
9set virtualedit=all | " virtual edit should be default behaviour, because I don't see any reason against
10set nonumber norelativenumber | " do not show numbers by default, because that causes a performance loss, instead activate them on a file type basis
11set ignorecase smartcase hlsearch | " search with ignore case by default, but use case sensitive search when one capital char is contained and highlight while typing (even though its slower)
12set cindent cinoptions+=(0 | " indent at parentheses
13
14
15set path+=** | " allow recursive searches for files
16let &path = &path.",/usr/lib/modules/".substitute(system('uname -r'), "\n", "", "")."/build/include"
17
18"=======================================================================================================================
19" SHELL
20"=======================================================================================================================
21if filereadable("/bin/bash")
22 set shell=/bin/bash | " many scripts rely on bash, but its path varies why it is commented out here
23elseif filereadable("/usr/local/bin/bash")
24 set shell=/usr/local/bin/bash
25endif
26
27"=======================================================================================================================
28" Persistent undo
29"=======================================================================================================================
30if has('persistent_undo')
31 if isdirectory('/dev/shm')
32 set undodir=/dev/shm/ | " save undo file in memory. That is volatile, but fast and we have GIT for longer lasting undoes
33 set directory=/dev/shm/ | " swap file directory to RAM
34 set swapfile
35 elseif isdirectory('/tmp/')
36 set undodir=/tmp/
37 endif
38 set undofile | " preserve undo history when closing and reopening buffers (see :help undo-persistence)
39endif
40
41"=======================================================================================================================
42" multi byte
43"=======================================================================================================================
44if has("multi_byte")
45 scriptencoding utf-8 | " tell vim that we are using UTF-8 here
46 set encoding=utf-8 | " we need default UTF-8 encoding to use cool chars as line break and so on (see below)
47 let &termencoding=&encoding | " once we use special chars we assume everybody uses a terminal supporting those
48
49 set fillchars= | " initialize empty fillchars
50 set listchars= | " initialize empty listchars
51
52 if &term == "linux"
53 set fillchars+=vert:\│ | " cool vertical split char
54 else
55 set fillchars+=vert:\║ | " cool vertical split char
56 endif
57
58 set fillchars+=fold:\ | "
59 set fillchars+=diff:\ | " a white space gets used here
60
61 set listchars+=extends:» | " symbols used when using :set list (which displays non-printable chars)
62 set listchars+=precedes:« | " symbols used when using :set list (which displays non-printable chars)
63
64 set listchars+=tab:▏\ | "
65 set listchars+=trail:· | " symbols used when using :set list (which displays non-printable chars)
66 " set listchars+=eol:↲ | " symbols used when using :set list (which displays non-printable chars)
67 " set listchars+=space:· | " symbols used when using :set list (which displays non-printable chars)
68 set showbreak+=› | " symbol used in the beginning of a wrapped line
69
70 " automatically enter list mode when going in insert mode (makes above syntax command temporarily ineffective)
71 set nolist
72 autocmd InsertEnter * set list
73 autocmd InsertLeave * set nolist
74" set fillchars+=stlnc:\― | "
75end
76
77
78"=======================================================================================================================
79" SPELL_CHECKING
80"=======================================================================================================================
81let g:spellfile_URL='http://ftp.vim.org/vim/runtime/spell'
82" add local user default spell file as primary source for words
83let &spellfile=fnamemodify($MYVIMRC, ":p:h")."/spell/spellfile-user.UTF-8.add"
84
85set nospell | " disable spell checker by default
86set spelllang=en,de | " languages for the spell checker
87set spellsuggest=10 | " how many words will z= suggest?
88set thesaurus+=~/.vim/thesaurus/php.txt
89
90"=======================================================================================================================
91" cscope
92"=======================================================================================================================
93" http://vim.wikia.com/wiki/Cscope
94if has('cscope') " compiled with cscope support?
95 set cscopetag " CTRL-] uses cscope first, then ctags
96 set cscopeverbose
97
98 if has('quickfix')
99 set cscopequickfix=s+,c+,d+,i+,t+,e+
100 endif
101
102 if has('menu')
103 1001menu &Cscope.find.c\ symbol
104 \<tab>s
105 \ :cscope find s <cword><:cR>
106 1001menu &Cscope.find.definition
107 \<tab>g
108 \ :cscope find g <cword><:cR>
109 1001menu &Cscope.find.functions\ called\ by\ this
110 \<tab>d
111 \ :cscope find d <cword><:cR>
112 1001menu &Cscope.find.functions\ calling\ this
113 \<tab>c
114 \ :cscope find c <cword><:cR>
115 1001menu &Cscope.find.text\ string
116 \<tab>t
117 \ :cscope find t <cword><:cR>
118 1001menu &Cscope.find.egrep\ pattern
119 \<tab>e
120 \ :cscope find e <cword><:cR>
121 1001menu &Cscope.find.this\ file
122 \<tab>f
123 \ :cscope find f <cword><:cR>
124 1001menu &Cscope.find.files\ including\ this\ file
125 \<tab>i
126 \ :cscope find i <cword><:cR>
127 1001menu &Cscope.find.places\ where\ this\ symbol\ is\ assigned\ a\ value
128 \<tab>a
129 \ :cscope find a <cword><:cR>
130 1001menu &Cscope.-Sep1-
131 \ :
132 1001menu &Cscope.create\ and\ add\ database
133 \ :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>
134 1001menu &Cscope.-Sep2-
135 \ :
136 1001menu &Cscope.add\ \.
137 \ :cscope add .<CR>
138 1001menu &Cscope.show
139 \ :cscope show<CR>
140 1001menu &Cscope.reset
141 \ :cscope reset<CR>
142 endif
143endif
144
145" ======================================================================================================================
146" GUI_VERSION
147" ======================================================================================================================
148if has("gui_running")
149 set guicursor=a:block-blinkon100
150 set browsedir=buffer
151 set toolbar+=text
152 set guiheadroom=0
153 set guioptions+=eig
154 set guioptions-=T | " toolbar
155 set guioptions+=c | " use console dialogues instead of popups
156 set guioptions+=a | " auto select: copy&paste using middle click
157 set guioptions+=m | " remove menu
158 set guioptions-=e | " do not display tabs
159 set guioptions-=L | " do not show left scrollbar
160 set guioptions-=r | " do not show right scrollbar
161 set winaltkeys=menu | " behave like other windows: ALT-key can be used to open the menu (and cannot be :remaped)
162" set selectmode=mouse,key,cmd | " enters vim's select mode when pressing shift-left or shift-END
163" set keymodel=startsel,stopsel | " makes shift-left, shift-right available for selecting text
164
165
166 " its possible to define alternative fonts (order matters)
167 set guifont=Monospace\ 10
168 set guifont+=Noto\ Sans\ Mono\ Bold
169 set guifont+=Noto\ Sans\ Mono\ Bold
170 set guifont+=Hasklug\ Nerd\ Font\ Mono\ Semi-Bold\ 10
171 set guifont+=Hasklig\ Semi-Bold\ 10
172 set guifont+=Bitstream\ Vera\ Sans\ Mono\ 10
173 set guifont+=FuraMono\ Nerd\ Font\ Mono\ Medium\ 11
174 set guifont+=Source\ Code\ Pro\ for\ Powerline\ SemiBold\ 10
175 set guifont+=LiterationMono\ Nerd\ Font\ Mono\ 10
176 set guifont+=RobotoMono\ Nerd\ Font\ Medium\ 10
177 set guifont+=Source\ Code\ Pro\ Semi-Bold\ 10
178 set guifont+=Dejavu\ Sans\ Mono\ for\ Powerline\ Semibold
179 set guifont+=Droid\ Sans\ Mono\ for\ Powerline\ 10
180 set guifont+=Meslo\ LG\ M\ for\ Powerline\ 10
181
182 " like in the terminal: use Ctrl-shift-v for paste in vim's command editor
183 cnoremap <c-s-v> <c-r>*
184endif
185
186" ======================================================================================================================
187" SETTINGS:
188" ======================================================================================================================
189set breakindent | " Every wrapped line will continue visually indented
190set clipboard=unnamedplus | " makes copy and paste work (autoselectplus might work as well)
191set concealcursor=nc | " limits the display of concealed text to normal and command mode
192set conceallevel=2 | " replace escaped chars by their UTF-8 representation (useful for LaTeX)
193set confirm | " asks 'do you want to save?'
194set cpoptions+=P | " makes :w filename set the current buffer to filename
195set hidden | " allows switching buffers even if the current buffer contains changes (displays +)
196set linebreak | " wrap long lines at char 'breakat', not inside words
197set mousemodel=popup | " only in gvim: right click opens a pop-up-menu
198set mouse=n | " allow mouse in normal mode only, so one can use the terminals c&p feature in insert mode
199set noautochdir | " When on, Vim will change the current working directory
200set nostartofline | " when scrolling: do not move the cursor to column 1
201set nowrap | " but do not (by default) wrap long lines around
202set nrformats+=alpha | " allows CTRL-A & CTRL-X to increment and decrement letters, not just numbers
203set incsearch | " highlight pattern while entering it (performance wise this isn't that good)
204
205if has('nvim') " Neovim?
206set inccommand=nosplit | " preview substitute and such things in real time
207endif
208
209set pumheight=8 | " Determines the maximum number of items to show in the pop-up menu for
210set scrolljump=5 | " how many lines get scrolled into view when cursor reaches the screens edge
211set scrolloff=0 | " keeps cursor centered
212set shiftround | " indent/un-indent snaps to multiple of shiftwidths
213set writedelay=0
214
215" display and performance
216set lazyredraw | " disables redraw during macro execution (improves performance)
217set cmdheight=2 | " sets the command line's height
218set signcolumn=yes | " auto=auto hide, yes=always, no=never show the column with error indicators
219set nocursorcolumn | " turn visual cursor column off (improves performance)
220set updatetime=80 | " updates the screen more often
221set redrawtime=1500 | " Timeout in milliseconds for redrawing the screen (switches syntax off when ssh too slow) / CTRL+L to retry
222set notimeout | " improves performance but is known to cause problems on slow terminals
223set ttimeout ttimeoutlen=150 | " set Esc key timeout in ms-
224set showcmd | " essential: show keys of combined commands in the lower right corner (BUT SLOW, makes cursor flickering)
225set showtabline=2 | " 0: never, 1: only if there are at least two tabs, 2:always
226set shortmess+=I | " don't give the intro message when starting Vim |:intro|.
227set wildmenu | " use a menu in the command line
228set wildmode=longest:full | " do not preselect any entry and show all possible
229
230" code completion
231" set dictionary=/usr/share/dict/cracklib-small
232" set complete+=k " make default completer <C-N> respect the dictionary
233set complete-=u " scan current and included files
234set complete+=i " scan current and included files
235set complete+=d " scan current and included files for defined name or macro
236set complete+=d | " scan current and included files for defined name or macro
237set complete+=i | " scan current and included files for completions
238set completeopt+=noinsert | " Do not insert any text for a match until the user selects one
239set completeopt+=noselect | " Do not select a completion from the menu, let the user do that
240set tagcase=match | " tagcase match, because we mostly use ^] to jump around and that variant respects the upper/lower case [followscs, followic, match, ignore]
241set tags+=../tags
242
243" code folding...
244set nofoldenable | " disable folding, because we have zi to toggle foldenable :)
245set foldclose=all | " automatically fold, when the cursor leaves the folded area
246set foldcolumn=2 | " I think I don't need this second indicator
247" set numberwidth=5
248" set foldmethod=syntax | " foldlevel: syntax, indent, manual / foldmethod=syntax makes Vim incredible slow
249set foldnestmax=1 | " top level folding only
250set foldopen=block,hor,search | " when do we unfold?
251" set foldtext=Foldtext() | "
252" set foldtext=v:folddashes.substitute(getline(v:foldstart),'\\v^/[/*]\','','g')
253" set foldtext='⊞\ '.substitute(getline(v:foldstart),'^[\ '.printf(&cms,'').']*','','').'↵'.getline(v:foldstart+1).'↵'.getline(v:foldstart+2)
254" set foldtext=repeat('',indent(v:foldstart)).substitute(substitute(substitute(join(getline(v:foldstart,v:foldend)),'\\s\\s\\+\\\|\[\*\/\]','\ ','g'),'\^\\s\\+','','g'),\ '\\s\\s\\+',\ '\ ',\ 'g')
255set foldtext=printf('%*s%.*S',indent(v:foldstart),'',&textwidth-indent(v:foldstart),substitute(substitute(join(getline(v:foldstart,v:foldend),'\ '),'[[:space:]]\\+','\ ','g'),'^[[:space:]*]','','g'))
256
257" works ...
258" set foldexpr=match(synIDattr(synID(v:lnum,indent(v:lnum)+1,0),'name'),'Comment')>-1
259set foldexpr=!empty(filter(synstack(v:lnum,indent(v:lnum)+1),{_,val->match(synIDattr(val,'name'),'Comment')>-1}))
260
261" set foldtext=printf('%*s%.'.eval(&textwidth-indent(v:foldstart)).'S',indent(v:foldstart),'',substitute(substitute(substitute(join(getline(v:foldstart,v:foldend)),'\\s\\s\\+\\\|\[\*\/\]','\ ','g'),'\^\\s\\+','','g'),\ '\\s\\s\\+',\ '\ ',\ 'g'))
262
263" vim window behaviour
264set splitbelow | " open new windows below the current one (i find that more intuitive)
265set splitright | " this also works for me and makes better use of the scren space I think
266set winminwidth=0 | " (and all other windows, so TODO: watch out)
267set winwidth=30 | " keep NERDTreeWindow at least this size
268
269
270" vim session handling and restore behaviour
271set viminfo+=% | " restore buffer list
272set sessionoptions=
273set sessionoptions+=buffers
274set sessionoptions+=curdir
275set sessionoptions+=folds
276set sessionoptions+=resize
277set sessionoptions+=slash
278set sessionoptions+=tabpages
279set sessionoptions+=unix
280set sessionoptions+=winpos
281set sessionoptions+=winsize
282
283
284" set nocindent smartindent | " use smart indent rather then cindent
285set noautoindent
286set nosmartindent
287
288set noshiftround | " indent/un-indent sna=ps to multiple of shiftwidths
289set noequalalways | " do not evenly size windows when opening new or closing old
290set nocursorline | " turn visual cursor line off (improves performance)
291"=======================================================================================================================
292
293" Vim 8 has a terminal command...
294if has('terminal')
295 " use default ESC key to leave insert mode in the internal terminal emulator
296 tnoremap <Esc> <C-W>N
297 " make terminal windows hidden by default (copied from :help terminal)
298 autocmd BufWinEnter * if &buftype == 'terminal' | setlocal bufhidden=hide | endif
299endif
300
301
302" NEOVIM_incompatible:
303"
304if has('nvim') " Neovim?
305 autocmd TermOpen term://* set nobuflisted
306 " use default ESC key to leave insert mode in the internal terminal emulator
307 tnoremap <Esc> <C-\><C-n>
308" set shada+=n~/.vim/shada | " shada file to use
309"
310 menu &UI.&Open\ in\ Serversession
311 \ :execute ':!nvr --servername /tmp/nvimsocket --remote % +'.line('.')<CR>:stopinsert<CR>:set readonly<CR>
312
313else " default Vim?
314 autocmd VimLeave * call system("echo -n $'" . escape(getreg(), "'") . "' | xsel -ib")
315
316 set ttymouse=xterm2
317 set ttyscroll=100 | " improves speed for terminal vim, incompatible with nvim
318 set ttyfast | " improves speed for terminal vim (incompatible with nvim)
319 set nottybuiltin | " use external termcaps
320 set restorescreen | " restores the console after exiting vim (intentionally not in nvim)
321 "
322 let g:loaded_ruby_provider = 1 " disable ruby support
323 let g:loaded_python_provider = 1 " disable python 3
324
325 if version >= 702 " clean up (see: http://vim.wikia.com/wiki/VimTip396)
326 autocmd BufWinLeave * call clearmatches()
327 endif
328
329
330 " scripts from the default vim installation, which do not get loaded by default, but are useful.
331 if filereadable($VIMRUNTIME.'/macros/editexisting.vim')
332 packadd! editexisting
333 endif
334
335 " load default plugin 'matchit' to allow % to jump between tags
336 if filereadable($VIMRUNTIME.'/macros/matchit.vim')
337 packadd! matchit
338 endif
339
340endif
341
342
343if has("autocmd")
344 set modeline | " set variables specific to a file, like indentation by adding a comment
345 " set default completion function in case YouCompleteMe cannot help
346 " set omnifunc=syntaxcomplete#Complete
347
348 augroup set_window_title " {
349 " autocmd BufEnter * let &titlestring = hostname() . "[vim(" . expand("%:t") . ")]"
350 autocmd CursorHold * let &titlestring = "%t %y ".$USER."@".hostname().":%{expand(\"%:~:.:h\")}"
351 set title
352 " autocmd CursorHold * let &titlestring = "Vim (".airline#extensions#tagbar#currenttag().")"
353
354 " set window title for screen(3)
355 if &term == "screen"
356 set t_ts=k
357 set t_fs=\
358 endif
359 if &term == "screen" || &term == "xterm"
360 set titlelen=40
361 set title
362 endif
363 augroup END
364
365 augroup ChangeIcon
366 "if filereadable("/usr/bin/xseticon")
367 "if filereadable("~/.vim/nvim.png")
368 " autocmd VimEnter * silent :execute "!xseticon -id $WINDOWID ~/.vim/nvim.png"
369 " autocmd VimLeave * silent :execute "!xseticon -id $WINDOWID /usr/share/icons/gnome/32x32/apps/xfce-terminal.png"
370 "endif
371 "endif
372 augroup END
373
374 " Fix terminal title =================================================================================================
375 " autocmd VimEnter * let &t_EI .= "\<Esc>[0 q"
376 " autocmd VimEnter * let &t_SI = "\<Esc>]12;green\x7"
377 autocmd VimLeave * silent !echo -ne "\033]112\007"
378
379 " highlight word under the cursor ====================================================================================
380 let w:m1 = 0
381 function! HighlightWordUnderCursor()
382 if(exists('w:m1') && w:m1 > 0)
383 silent! call matchdelete(w:m1)
384 let w:m1 = 0
385 endif
386 let l:currentword = escape(expand('<cword>'), '.')
387 if(strlen(l:currentword) > 0)
388 let w:m1=100
389 silent! call matchadd('BoldUnderline', '\<'.l:currentword.'\>', -1, w:m1)
390 endif
391 endfunction
392 autocmd! CursorHold,CursorHoldI * call HighlightWordUnderCursor()
393
394 " hitting K over a keyword shows a help in a buffer.
395 " Here we define the commands used to look those keywords up
396 " as per file type...
397 augroup filetype_specific
398 autocmd FileType python setlocal keywordprg=pydoc
399 autocmd FileType vim setlocal keywordprg=:help |.
400 autocmd FileType c,cpp setlocal equalprg=clang-format
401 autocmd FileType c,cpp setlocal breakat-=-
402
403 if filereadable("/usr/bin/vendor_perl/ack")
404 autocmd FileType c,cpp set grepprg=/usr/bin/vendor_perl/ack\ --type=cc\ --nogroup\ --column\ $*
405 autocmd FileType c,cpp set grepformat=%f:%l:%c:%m
406 endif
407
408 autocmd BufWinEnter * if &previewwindow | setlocal nonumber nolist signcolumn=no filetype=c nobuflisted | endif
409
410
411 " autocmd FileType c,cpp setlocal iskeyword-=_
412
413 " the following helps to make file=/etc/something work with gf, but disallows filenames with an equal sign in them
414 autocmd FileType conf setlocal isfname-==
415
416
417 autocmd Filetype css command! CSSsort :g/{/+1;/}/-1 sort
418
419 " keyboard mapping for xml alike languages
420 " Alt-Up : Move cursor up one tag
421 " Alt-Down: Move cursor down one tag
422 " leader-=: tidies currently selected tag and subtags and sorts attributes by name (alphabetically)
423 autocmd Filetype html,markdown,xml iabbrev </ </<C-X><C-O>
424 autocmd Filetype html,htmldjango,xml
425 \ :nnoremap
426 \ <M-Down>
427 \ :call search('^ *<', 'e')<CR>:nohlsearch<CR>|
428 \ :nnoremap
429 \ <M-Up>
430 \ :call search('^ *<', 'eb')<CR>:nohlsearch<CR>|
431 \ :nnoremap
432 \ <leader>=
433 \ vat:'<,'>!tidy -xml --wrap 0 --sort-attributes alpha 2>/dev/null<CR>vat=
434 augroup END
435
436 " autocmd BufNewFile set nobuflisted
437 " use the shada/viminfo file to return the cursor to where it was...
438 autocmd BufReadPost * call setpos(".", getpos("'\""))
439
440 augroup CurrentFileName
441 " highlight the current files name inside the document...
442 let @g = ":exe ':match SpellBad /'.escape(expand('%:t'), '.').'/'"
443 " put the current files name after the cursor...
444 let @f = ":exe ':normal a'.expand('%:t')"
445
446 " grep all buffers for a given string and return result in a quickfix window
447 let @q = ":cex [] | bufdo vimgrepadd /foo/g % | cw"
448
449 let @l = ":let g:signify_vcs_cmds={'git': 'git diff --no-color --no-ext-diff -U0 HEAD^ -- %f'}|:SignifyRefresh"
450
451 if has('menu')
452 source $VIMRUNTIME/menu.vim
453 set wildmenu
454 set cpo-=<
455 set wcm=<C-Z>
456
457 01menu &Functions.toggle\ file\ browser
458 \<Tab><leader><leader>
459 \ <leader><leader>
460 01menu &Functions.-Sep0- :
461
462 01menu &Functions.help
463 \<Tab><F1>
464 \ <F1>
465 01menu &Functions.bp:\ previous\ buffer
466 \<Tab><F2>
467 \ <F2>
468 01menu &Functions.bn:\ next\ buffer
469 \<Tab><F3>
470 \ <F3>
471 01menu &Functions.^wc\:\ close\ window
472 \<Tab><F4>
473 \ <F4>
474 01menu &Functions.-Sep1- :
475
476 01menu &Functions.make
477 \<Tab><F5>
478 \ <F5>
479 01menu &Functions.clear\ matches,\ update\ viewport
480 \<Tab><F6>
481 \ <F6>
482 01menu &Functions.copen\:\ show\ quickfix\ list
483 \<Tab><F7>
484 \ <F7>
485 01menu &Functions.lopen\:\ show\ location\ list
486 \<Tab><F8>
487 \ <F8>
488 01menu &Functions.-Sep2- :
489
490 01menu &Functions.toggle\ tagbar
491 \<Tab><F9>
492 \ <F9>
493
494 if has("gui_running") == 0
495 " in the gui F10 already triggers the menu, not in a terminal vim, so upgrade that...
496 map <F10> :emenu <C-Z>
497 endif
498 01menu &Functions.activate\ menu\ (:emenu)
499 \<Tab><F10>
500 \ <F10>
501
502 01menu &Functions.undef11
503 \<Tab><F11>
504 \ <F11>
505 01menu &Functions.undef12
506 \<Tab><F12>
507 \ <F12>
508 01menu &Functions.-Sep2- :
509
510
511 09menu &Directory.print\ current\ directory
512 \<Tab>:pwd
513 \ :pwd<CR>
514
515 09menu &Directory.-Sep- :
516
517 09menu &Directory.Change\ to\ GIT\ root
518 \<Tab>:Gcd
519 \ :Gcd<CR>:pwd<CR>
520
521 09menu &Directory.Change\ to\ current\ buffers\ directory\ (global)
522 \<tab>:cd\ %:p:h
523 \ :cd %:h<CR>:pwd<CR>
524
525 09menu &Directory.Change\ to\ current\ buffers\ directory\ (local\ window)<tab>:lcd\ %:p:h
526 \ :lcd %:p:h<CR>:pwd<CR>
527
528 menu &Git.&Display\ uncommited\ files\ in\ location\ list
529 \ :call setloclist(0, map(systemlist("git diff --name-only --pretty=''"), {_, p->{'filename': fnamemodify(p, ':.')}}))<CR>:lopen<CR>
530 menu &Git.&Display\ recently\ changed\ files\ in\ quickfix\ list
531 \ :call setqflist([], 'r', {'title': 'Recently changed in GIT', 'items':map(systemlist("git show --name-only --pretty=''"), {_, p->{'filename': fnamemodify(p, ':.')}}) })<CR>:copen<CR>
532 menu &Git.&Display\ last\ changes
533 \ :let g:signify_vcs_cmds={'git': 'git diff --no-color --no-ext-diff -U0 HEAD^ -- %f'}<CR>:SignifyRefresh<CR>
534 menu &Git.&Display\ unmerged\ files\ in\ location\ list
535 \ :call setloclist(0, map(systemlist("git diff --name-only --diff-filter=U \| uniq"), {_, p->{'filename': fnamemodify(p, ':.')}}))<CR>:lopen<CR>
536 menu &Git.&Display\ significance\ of\ changes
537 \ :!git diff --stat HEAD~1..HEAD
538 menu &Git.&Display\ Changed\ files\ compared\ to\ master
539 \ :!git diff --name-status ..master
540
541 menu &Match.Clear\ All\ Matches
542 \<Tab><F6>
543 \ :call clearmatches()<CR>
544
545 menu &Match.-Sep- :
546
547 menu &Match.&dispensable\ white\ spaces
548 \ :call matchadd("Convention", '\s\+$', 0)<CR>
549
550 menu &Match.&long\ lines\ (exeeding\ textwidth)
551 \ :call matchadd("Convention", '\%>'.&textwidth.'v.', 0)<CR>
552
553 menu &Match.Highlight\ current\ file\ name
554 \ :call matchadd("Search", escape(expand('%:t'), '.'))<CR>
555
556 " :execute ':match SpellBad /'.escape(expand('%:t'), '.').'/'<CR>
557
558 menu &Window.-Sep- :
559
560
561 menu &Window.Scratch
562 \ :Scratch<CR>
563
564
565 menu &Find.file\ under\ the\ cursor
566 \<Tab>gf
567 \ gf
568
569 menu &Find.Open\ search\ results\ in\ location\ list
570 \<Tab>:gf
571 \ :execute ':vimgrep /'.escape(getreg('/'), '.').'/g %'<CR>
572 \ :copen<CR>
573
574 menu &Changes.list
575 \<Tab>:changes
576 \ :changes<CR>
577 menu &Changes.-Sep- :
578 menu &Changes.previous
579 \<Tab>g;
580 \ g;
581 menu &Changes.next
582 \<Tab>g,
583 \ g,
584 menu &List.location.signs\ to\ list
585 \<Tab>CMD
586 \ :execute ":call setloclist(0, map(get(getbufinfo('%')[0], 'signs'), {_, p->extend(p, {'bufnr':buffer_number('.'), 'text':get(p, 'name')})}))"<CR>
587 menu &List.location.list\ to\ signs
588 \<Tab>CMD
589 \ :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>
590 menu &Jump.list
591 \<Tab>:jumps
592 \ :jumps<CR>
593 menu &Jump.-Sep1- :
594 menu &Jump.previous\ position
595 \<Tab>CTRL-O
596 \ <C-O>
597 menu &Jump.next\ position
598 \<Tab>CTRL-I
599 \ <C-I>
600 menu &Jump.-Sep2- :
601 menu &Jump.clear\ list
602 \<Tab>:clearjumps
603 \ :clearjumps
604
605 1000menu &Tag.list
606 \<Tab>:tags
607 \ :tags<CR>
608 1000menu &Tag.selection\ list
609 \<Tab>:ts
610 \ :ts<CR>
611
612 1000menu &Tag.-Sep1- :
613
614 1000menu &Tag.stack.jump\ older
615 \<Tab><C-T>
616 \ :po
617 1000menu &Tag.stack.jump\
618 \<Tab>:ta
619 \ :ta
620 endif
621
622 " autocmd BufEnter * @f
623 augroup END
624
625 " autocmd VimEnter * set nobuflisted
626endif
627
628
629" ======================================================================================================================
630" SHORTCUTS: custom shortcuts
631" inoremap <C-Space> <C-x><C-o>
632" inoremap <C-@> <C-Space>
633
634" Bind CTRL+Backspace to vim's version (CTRL+W) in " <CR> insert mode (only works with gvim)
635inoremap
636 \ <C-Backspace>
637 \ <C-W>
638
639" INDENTATION: allows un-indenting a selected block and keeps selection
640vnoremap < <gv
641vnoremap > >gv
642
643" make shift-home select to the beginning of the line
644nnoremap <s-home> v^
645nnoremap <s-end> v$
646
647nnoremap <s-down> vj
648vnoremap <s-down> j
649nnoremap <s-up> vk
650vnoremap <s-up> k
651
652
653" close current buffer with <leader>q...
654nnoremap <leader>q :bp<bar>sp<bar>bn<bar>bd<CR>.
655" google the word under the cursor
656nnoremap <leader>G :execute ":!xdg-open https://google.de/search?q=".expand("<cword>")
657
658nnoremap <silent> <F5> :make!<CR>
659nnoremap <silent> <F6> :silent syntax sync fromstart<CR>:nohlsearch<CR>:silent match<CR>:silent 2match<CR>:silent 3match<CR>
660nnoremap <leader>r :syntax sync fromstart
661
662nnoremap <silent> <A-Up> :wincmd k<CR>
663nnoremap <silent> <A-Down> :wincmd j<CR>
664nnoremap <silent> <A-Left> :wincmd h<CR>
665nnoremap <silent> <A-Right> :wincmd l<CR>
666
667" INSERT_MODE_MAPPINGS:
668" default copy&paste insert key binding (just in insert mode, so it doesn't conflict
669" with visual block mode)- would have been nice, but collides with c-w for digraphs
670" inoremap <C-V> <C-R>+
671"
672inoremap <C-S> <C-O>:w<CR>
673
674" NEOVIM_SPECIFIC:
675if has('nvim') " only neovim...
676 " shortcut \t opens a terminal in a horizontal split
677 nnoremap <leader>t :new +terminal<CR>
678endif
679
680
681
682" ======================================================================================================================
683" START: LOADING PLUGINS
684" ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
685call plug#begin()
686" Colorschemes:
687Plug 'coderonline/vim-remote-menu'
688" Plug 'bbchung/clighter8'
689" Plug 'octol/vim-cpp-enhanced-highlight'
690" Plug 'vim-scripts/TagHighlight'
691" if ! exists('g:TagHighlightSettings')
692" let g:TagHighlightSettings = {}
693" endif
694" let g:TagHighlightSettings['TagFileName'] = 'tags'
695" let g:TagHighlightSettings['CtagsExecutable'] = 'ctags'
696
697Plug 'chriskempson/base16-vim' | " not just one high quality color scheme (all named base16-*)
698Plug 'NLKNguyen/papercolor-theme' | " the one I like the most
699
700Plug 'mhinz/vim-signify' | " uses the sign column to indicate added, modified and removed lines
701Plug 'tpope/vim-fugitive' | " the most complete GIT integration plugin
702Plug 'godlygeek/tabular' | " align code on a sign, like :Tab/=
703Plug 'tpope/vim-surround' | " plugin makes cs"' inside a line replace " with '
704let g:signify_vcs_list = [ 'git' ] | " use signify only with git (improves speed when loading buffers, see :h signify)
705let g:signify_cursorhold_insert = 0
706let g:signify_cursorhold_normal = 0
707let g:signify_update_on_bufenter = 0
708let g:signify_update_on_focusgained = 0
709let g:signify_sign_show_count = 0
710
711let g:signify_sign_add = '➕'
712let g:signify_sign_delete = '➖'
713let g:signify_sign_delete_first_line = '➖'
714let g:signify_sign_change = '❗'
715let g:signify_sign_changedelete = g:signify_sign_change
716
717
718" NERDTree: replaces NetRW, as long as it has so many bugs
719Plug 'scrooloose/nerdtree' | "
720let NERDTreeIgnore = ['\.aux$', '\.o$']
721let NERDTreeCascadeSingleChildDir = 0 | " I don't get how one can use <m> to create files in that included directory
722let NERDTreeChDirMode = 0
723let NERDTreeHiddenFirst = 1
724let NERDTreeMinimalUI = 1
725let NERDTreeShowBookmarks = 1 | " show bookmarks by default (when opening for the first time)
726let NERDTreeWinSize = 40
727let NERDTreeQuitOnOpen = 1
728
729" depending on if NERDTree has the focus:
730nnoremap <expr>
731 \ <leader><leader>
732 \ bufwinnr("%")==g:NERDTree.GetWinNum() ? ':NERDTreeClose<CR>' : ':NERDTreeFind<CR>'
733nnoremap <expr>
734 \ <F2>
735 \ bufwinnr("%")==g:NERDTree.GetWinNum() ? '<C-W><C-W>' : ':N<CR>'
736
737nnoremap <expr>
738 \ <F3>
739 \ bufwinnr("%")==g:NERDTree.GetWinNum() ? '<C-W><C-W>' : ':n<CR>'
740
741nnoremap <F4>
742 \ :wincmd c<CR>
743" close NERDTree if it is the last remaining window (taken from the official documentation)
744" autocmd bufenter *
745" \ if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
746"
747" map CTRL-PageUp/Down to next/previous buffer
748" and Shift-PageUp/Down to next/previous arglist file
749nnoremap <C-PageUp> :bn<CR>
750nnoremap <C-PageDown> :bp<CR>
751nnoremap <S-PageUp> :N<CR>
752nnoremap <S-PageDown> :n<CR>
753
754" indent within <script> and <style> (default is a zero indent)
755let g:html_indent_script1 = "inc"
756let g:html_indent_style1 = "inc"
757
758Plug 'majutsushi/tagbar' " superseeds taglist-plus, which isn't maintained any more
759let g:tagbar_autoclose = 0
760let g:tagbar_autofocus = 1
761let g:tagbar_autoshowtag = 0
762let g:tagbar_compact = 1
763let g:tagbar_indent = 0
764let g:tagbar_foldlevel = 99
765
766nnoremap <F9> :TagbarToggle<CR>| " bind TagBar to hotkey F9
767
768" Autocompleter: =====================================
769if has("python") || has('python3')
770
771 " ULTISNIPS: code snippet ============================================================================================
772 Plug 'honza/vim-snippets' " dependency of ultisnips (see below)
773 Plug 'SirVer/ultisnips' " replaces loremipsum (and many more)
774 " 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)
775 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)
776
777 let g:UltiSnipsJumpForwardTrigger = '<Tab>'|
778 let g:UltiSnipsJumpBackwardTrigger = '<S-Tab>'|
779 "d let g:UltiSnipsJumpForwardTrigger = '<PageDown>'
780 " let g:UltiSnipsJumpBackwardTrigger = '<PageUp>'
781 "let g:UltiSnipsExpandTrigger = '<C-j>'| " Trigger configuration. Do not use <tab> if you use https://github.com/Valloric/YouCompleteMe.
782 "let g:UltiSnipsJumpForwardTrigger = '<C-j>'| " \
783 "let g:UltiSnipsJumpBackwardTrigger = '<C-k>'| " \
784 "let g:UltiSnipsListSnippets = '<C-`>'| " YouCompleteMe includes those, so this isn't necessary
785 "let g:UltiSnipsListSnippets = '<leader><leader>'| " YouCompleteMe includes those, so this isn't necessary
786 """ Ultisnips
787 " let g:UltiSnipsExpandTrigger="<c-tab>"
788 " let g:UltiSnipsListSnippets="<c-s-tab>"
789
790 if has('nvim')
791 Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
792 " Use deoplete.
793 let g:deoplete#enable_at_startup = 1
794 inoremap <silent><expr> <C-Space> deoplete#mappings#manual_complete()
795
796 Plug 'Shougo/echodoc.vim'
797 let g:echodoc#enable_at_startup = 1
798
799 " Plug 'Rip-Rip/clang_complete'
800 " Plug 'tweekmonster/deoplete-clang2'
801 " Plug 'zchee/deoplete-clang'
802 " let g:deoplete#sources#clang#libclang_path = "/usr/lib/libclang.so"
803 " let g:deoplete#sources#clang#clang_header = "/usr/lib/clang/6.0.0"
804 " let g:deoplete#sources#clang#std#cpp = 'c++1z'
805 " let g:deoplete#sources#clang#clang_complete_database = "/home/max/src"
806 " Plug 'Shougo/neoinclude.vim' " makes vim slow - unfortunatelly
807
808 " Plug 'Shougo/deoplete-clangx' " mentioned in Q&A of deoplete
809 Plug 'autozimu/LanguageClient-neovim', {
810 \ 'branch': 'next',
811 \ 'do': 'bash install.sh',
812 \ }
813
814 let g:LanguageClient_serverCommands = {
815 \ 'cpp': ['clangd'],
816 \ 'c': ['clangd']
817 \ }
818 " Plug 'roxma/nvim-completion-manager' unmaintained python version
819 else
820 " YouCompleteMe: =====================================================================================================
821 " Plug 'Valloric/MatchTagAlways' " highlights the closing tag/brace/...
822 Plug 'Valloric/YouCompleteMe', {
823 \ 'do' : 'python install.py --clang-completer --system-libclang --quiet',
824 \ }
825 let g:ycm_error_symbol = '✖' " insert this as an error symbol in the gutter bar/sign column
826 let g:ycm_warning_symbol = '➔' " insert this as a warning symbol in the gutter bar/sign coloumn
827
828 let g:ycm_autoclose_preview_window_after_insertion = 0
829 let g:ycm_auto_trigger = 1
830 let g:ycm_collect_identifiers_from_tags_files = 1 " Let YCM read tags from Ctags file
831 let g:ycm_confirm_extra_conf = 0 " security is overrated ;)
832 let g:ycm_always_populate_location_list = 0 " we can manually run :YcmDiags to do that
833
834 let g:ycm_key_list_previous_completion = ['Up']
835 let g:ycm_key_list_select_completion = ['Down']
836
837 let g:ycm_semantic_triggers = {
838 \ 'c': [ 're!\w{2}' ]
839 \ }
840
841 " Plug 'vim-scripts/dbext.vim' " dependency to allow db related completions
842 " let g:ycm_server_python_interpreter = 'python3'
843 " let g:ycm_python_binary_path = '/usr/bin/python3' " the python interpreter of choice (for code checking)
844 " let g:ycm_add_preview_to_completeopt = 1 " reuse existing preview window
845 " let g:ycm_seed_identifiers_with_syntax = 1 " Completion for programming language's keyword
846 " let g:ycm_complete_in_comments = 1 " Completion in comments
847 " let g:ycm_complete_in_strings = 1 " Completion in string
848 " let g:ycm_min_num_of_chars_for_completion = 6 " we normally avoid identifier based completion, it just helps with long words. Use semantic completions with <C-Space> instead (terrible idea, html snippets not working!)
849 " let g:ycm_min_num_identifier_candidate_chars = 4
850 " let g:ycm_max_num_identifier_candidates = 10
851 " let g:ycm_max_num_candidates = 50
852 " let g:ycm_use_ultisnips_completer = 1 " Default 1, just ensure
853 " let g:ycm_key_list_select_completion = ['<Down>']
854 " let g:ycm_key_list_previous_completion = ['<Up>']
855 " let g:ycm_global_ycm_extra_conf = '.ycm_extra_conf.py'
856 " let g:ycm_semantic_triggers = { 'c': [ 're!.' ] }
857 " let g:ycm_disable_for_files_larger_than_kb = 16384 " we have faaast computers, don't we?
858 " let g:ycm_show_diagnostics_ui = 0
859 " " disable <tab>-key for YCM so that it can be used with ultisnips
860 " let g:ycm_key_list_select_completion=[]
861 " let g:ycm_key_list_previous_completion=[]
862 endif
863
864
865 " SYNTASTIC: =========================================================================================================
866 if has('nvim')
867 Plug 'w0rp/ale'
868 let g:ale_set_highlights = 0
869 highlight! link ALEWarningSign FoldColumn
870 let g:ale_sign_error = ''
871 let g:ale_sign_style_error = ''
872 let g:ale_sign_info = ''
873 let g:ale_sign_warning = ''
874 else
875 Plug 'scrooloose/syntastic'
876 " set statusline+=%#warningmsg#
877 " set statusline+=%{SyntasticStatuslineFlag()}
878 let g:LatexBox_latexmk_preview_continuously = 1
879 let g:LatexBox_viewer = "evince"
880 let g:syntastic_always_populate_loc_list = 1
881 let g:syntastic_auto_loc_list = 0
882 let g:syntastic_check_on_open = 1
883 let g:syntastic_check_on_wq = 0
884 " let g:syntastic_quiet_messages = {"type":"style"}
885 "
886 " E221: multiple spaces before Operator
887 let g:syntastic_python_flake8_args = '--max-complexity=10 --max-line-length=120 --exclude venv --doctests --exit-zero --ignore=E221'
888 " filter ( = do not display) style/formatting errors and warnings
889 let g:syntastic_error_symbol = '✖'
890 let g:syntastic_style_error_symbol = '✗'
891 let g:syntastic_warning_symbol = '➔'
892 let g:syntastic_style_warning_symbol = '≈'
893 endif
894
895 " JEDI: ==============================================================================================================
896 Plug 'davidhalter/jedi-vim' " jedi gets used to display python function signatures
897 let g:jedi#completions_enabled = 0 " we do not need completions, because we have YouCompleteMe
898 let g:jedi#show_call_signatures = 1 " which sadly does not support signatures like jedi
899 let g:jedi#show_call_signatures_delay = 0
900 let g:jedi#auto_vim_configure = 0
901 let g:pymode_rope = 0 " https://github.com/davidhalter/jedi-vim/issues/163
902 " autocmd FileType python jedi.preload_module('os', 'sys', 'math')
903 " let g:pymode_options_max_line_length = 120
904 " let g:syntastic_python_flake8_args='--ignore=F821,E302,E501,E241,E301'
905
906endif " has("python")
907
908"=======================================================================================================================
909" TESTING: | " plugins which I am currently trying...
910"=======================================================================================================================
911" Plug 'rhysd/vim-clang-format' | unnecessary, because we can just :pyf /usr/share/clang/clang-format.py
912Plug 'kana/vim-operator-user' " dependency, which allows overriding the = operator for indentation
913
914" TODO: check if this is unrequired, when set equalprog is set to that py file
915autocmd FileType c,cpp,objc map <buffer> = :pyf /usr/share/clang/clang-format.py<CR>
916
917" let g:clang_format#detect_style_file = 1
918" autocmd FileType c,cpp,objc map <buffer> = <Plug>(operator-clang-format)
919
920" Plug 'tpope/vim-characterize' | " normal mode: make ga show character names of Unicode chars (ga shows hex and dec values)
921" Plug 'rkitover/vimpager'
922" found this command instead (use as PAGER):
923" man -P 'nvim -R -u NORC -c":%!col -b" -c":set buftype=nowrite filetype=man" -' ls
924
925command BuffersToArg :exec ':args '.join(map(range(0, bufnr('$')), 'fnameescape(fnamemodify(bufname(v:val), ":."))'))
926command BufToArg :argadd %:.
927command Gbranch call setqflist([], 'r', {'title':'Git branch selector','items':map(systemlist("git branch"), {_, p->{'filename':'branch','module': fnamemodify(p, ':.')}})})
928
929" the following command opens a preview-window and shows the declaration of
930" the function under the cursor. It also highlights the word to make it easier
931" to spot within a great file
932command Helpme au! CursorHold * nested let @/=expand('<cword>')|exe "silent! psearch ".expand("<cword>")
933
934"=======================================================================================================================
935call plug#end() | " all plugins are getting loaded on this line, don't remove!
936
937" ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑
938" END: LOADING PLUGINS
939" ======================================================================================================================
940
941" Deprecated with this configuration, but still useful when deactivating some Plugins
942" NETRW: obsolete with NERDTree
943let g:netrw_alto = 0 | " open files on the right
944let g:netrw_altv = 1 | " open files on the right
945let g:netrw_banner = 0 | " display help messages?
946let g:netrw_browse_split = 4 | " 4=open in previous window
947let g:netrw_fastbrowse = 2 | " manually refresh direcory list (avoids display errors)
948let g:netrw_hide = 1 | " show not-hidden files only
949let g:netrw_keepdir = 0
950let g:netrw_list_hide = '^\..*' | " Explore mode: hide files starting with dot
951let g:netrw_liststyle = 3 | " 3=tree
952let g:netrw_preview = 0 | "
953let g:netrw_winsize = 20 | " window size in percent
954
955" ======================================================================================================================
956" COLORSCHEME:
957" ======================================================================================================================
958
959function! ExtendColorTheme()
960 filetype on
961 filetype plugin on
962 filetype indent on
963
964 syntax on | " enable syntax highlighting
965 syntax sync minlines=60 | " how many preceding lines will be parsed? (has performance impact)
966
967 highlight! SignifySignAdd ctermbg=NONE
968 highlight! Bold cterm=bold gui=bold
969 highlight! Italic cterm=italic gui=italic
970 highlight! Underline cterm=underline gui=underline
971 highlight! BoldUnderline cterm=bold,underline gui=bold,underline
972 highlight! BoldItalic cterm=bold,Italic gui=Bold,Italic
973 highlight! Todo cterm=bold gui=bold guibg=#ffffaa guifg=#000000
974 highlight! Error ctermbg=NONE guibg=NONE
975 highlight! SpellBad cterm=NONE gui=undercurl guibg=NONE guifg=red
976
977
978 highlight! link SpecialKey NonText | " makes tab stop (see listchars) less disturbing
979 highlight! link EndOfBuffer Ignore
980 highlight! link WildMenu Search
981 highlight! link Convention Error
982 highlight! link YcmErrorSign SpellBad
983 highlight! link YcmWarningSign Spellbad
984 highlight! link SignifySignAdd SignColumn
985 highlight! link SignifySignChange SignColumn
986 highlight! link SignifySignDelete SignColumn
987 highlight! link SignifySignChangeDelete SignColumn
988 highlight! link SignifySignDeleteFirstLine SignColumn
989 highlight! link VertSplit NonText
990 highlight! link LineNr Comment
991 highlight! link Folded LineNr
992 highlight! link SignColumn Comment
993 highlight! link FoldColumn Comment
994 highlight! link PmenuSbar Pmenu
995 highlight! PmenuThumb cterm=inverse
996 highlight! MoreMsg cterm=inverse
997
998 autocmd InsertEnter * silent! call matchdelete(101)
999 autocmd InsertLeave * silent! call matchadd('Convention', ' \+$', -1, 101, { 'conceal': '⟶' })
1000
1001 autocmd InsertEnter * set colorcolumn=80,120
1002 autocmd InsertLeave * set colorcolumn&
1003
1004 " execute 'highlight! StatusLine'
1005 " \ .' guibg=NONE'
1006 " \ .' guifg='.g:status_bg
1007 " \ .' gui=inverse'
1008 " let g:status_fg=synIDattr(hlID('Cursor'), 'fg#')
1009 " let g:status_bg=synIDattr(hlID('Cursor'), 'bg#')
1010 " let g:status_sel=synIDattr(hlID('Text'), 'fg#')
1011 " let g:status_sel='#ffffff'
1012 " " execute 'highlight! User1 gui=NONE'
1013 " execute 'highlight! User1 guibg='.g:status_sel
1014 " execute 'highlight! User1 guifg='.g:status_fg
1015 " execute 'highlight! User2 gui=NONE'
1016 " execute 'highlight! User2 guibg='.g:status_sel
1017 " execute 'highlight! User2 guifg=NONE'
1018 " use the default terminal background color as background (allows transparency)
1019 " highlight! Normal guibg=NONE ctermbg=NONE
1020 " highlight! NonText guibg=NONE guifg=black ctermbg=NONE ctermfg=black
1021 " makes the ~ (tilde) indicator invisible, which usually marks the EOF
1022 " highlight! CursorLineNr cterm=inverse | " ctermbg=black ctermfg=NONE
1023 " highlight! Pmenu ctermbg=LightYellow ctermfg=DarkGrey
1024 " highlight! PmenuSel ctermbg=blue ctermfg=LightYellow cterm=bold
1025 " highlight! Folded ctermbg=NONE
1026 " highlight! Cursor guibg=#729fcf ctermbg=yellow
1027 " highlight! SpellBad ctermbg=none
1028 " highlight! SpecialKey ctermfg=19
1029 " highlight! WhiteSpace ctermfg=19
1030 " highlight! link TabLine LineNr
1031 " highlight! TabLineSel ctermbg=blue ctermfg=black
1032 " highlight! link TabLineFill LineNr
1033 " highlight! Search ctermbg=LightYellow ctermfg=12 guibg=#fefd86 guifg=#222222
1034 " generic, which should exist but don't
1035 " autocmd InsertLeave * call matchadd('Conceal', ' \+$', -1, 101, { 'conceal': '⟶' })
1036 " Show trailing whitepace and spaces before a tab as part of the syntax highlighting
1037 " autocmd BufEnter,InsertLeave * syntax match Convention /\s\+$\| \+\ze\t/ containedin=ALL
1038 " autocmd Syntax * syntax match Convention /\s\+$\| \+\ze\t/ containedin=ALL
1039 " autocmd BufEnter,BufWritePost * syntax match Convention /\s\+$\| \+\ze\t/ containedin=ALL
1040 " autocmd InsertEnter * syntax clear Convention
1041 " autocmd BufEnter,InsertLeave * execute ':syntax match Convention /\%>'.&textwidth.'v./ containedin=ALL'
1042 " set colorcolumn= | " not used, because we have a :match directive for textwidth
1043" if argc() == 0
1044 " rv
1045 " autocmd VimEnter * split +bro\ ol
1046 " endif
1047endfunction
1048autocmd! ColorScheme * call ExtendColorTheme()
1049
1050
1051
1052" ======================================================================================================================
1053" CONVENIENCE:
1054" ======================================================================================================================
1055command Vimls
1056 \ call setloclist(0, map(getbufinfo({'buflisted':1}),
1057 \ "{'bufnr': v:val.bufnr,
1058 \ 'lnum': v:val.lnum,
1059 \ 'text': '='.printf('%*s, % 3d: %s [%s]', winwidth(0) / 2, '', v:val.bufnr, v:val.name, getbufvar(v:val.bufnr, '&buftype')),
1060 \ 'pattern': 'not loaded'}
1061 \ "))
1062
1063command Ctoggle
1064 \ if(get(getqflist({'winid':1}), 'winid') == win_getid())|cclose|else|botright copen|endif
1065command Ltoggle
1066 \ if(get(getloclist(0, {'winid':1}), 'winid') == win_getid())|lclose|else|lopen|endif
1067
1068
1069
1070" nnoremap <silent> <ESC> :lclose<CR> " brings vim into REPLACE mode (R)
1071nnoremap <silent> <F7> :Ltoggle<CR>
1072nnoremap <silent> <F8> :Ctoggle<CR>
1073nnoremap <silent> <F12> :Vimls<CR>:Ltoggle<CR>
1074
1075" exec current line as a command, insert output of command (from: https://youtu.be/MquaityA1SM?t=35m45s)
1076nnoremap Q !!$SHELL<CR>
1077
1078
1079" ======================================================================================================================
1080" TESTING:
1081" ======================================================================================================================
1082autocmd TextYankPost * echo '> text yanked to '.(
1083 \ get(v:event,'regname') == ''
1084 \ ? 'default register'
1085 \ : 'register '.get(v:event,'regname'))
1086
1087autocmd VimEnter,WinEnter * exec ':set scrolljump='.winheight(0)/2
1088
1089" display highlight group under the cursor
1090map <leader>h :echo map(synstack(line('.'), col('.')), 'synIDattr(v:val, "name")')<CR>
1091
1092if filereadable(expand("~/.vimrc_background")) && filereadable(expand("~/.config/base16-shell/colortest"))
1093 let g:base16_shell_path="~/.config/base16-shell/scripts"
1094 let base16colorspace=256
1095 " let syntax_cmd="skip" " vim internal, use base16 and no default colors
1096 set background=dark
1097 source ~/.vimrc_background
1098else
1099 let g:PaperColor_Theme_Options = {
1100 \ 'theme': {
1101 \ 'default': {
1102 \ 'transparent_background': 0
1103 \ }
1104 \ }
1105 \ }
1106 set background=light
1107 colorscheme PaperColor
1108endif
1109
1110
1111augroup status
1112 set noshowmode | " mode will be shown twice, in lightline and below, so we want to deactivate one
1113 set laststatus=2 | " required by AirLine and Lightline, without status line does not appear until a window split
1114
1115 let g:status_sym_start = ''
1116 let g:status_sym_end = ''
1117 let g:status_sym_sep_start = ''
1118 let g:status_sym_sep_end = ''
1119 let g:symbol_branch = ''
1120
1121 if &term == "linux"
1122 let g:symbol_branch = ''
1123
1124 let g:group_active = "StatusLineTerm"
1125 let g:group_inactive = "StatusLineTermNC"
1126 let g:group_tabline = "StatusLineTerm"
1127 else
1128 let g:group_active = "StatusLine"
1129 let g:group_inactive = "StatusLineNC"
1130 let g:group_tabline = "TabLine"
1131 endif
1132
1133 " this function reverts foreground color and background color of a given
1134 " highlight group and returns the name of a newly created _invert group
1135 function! CreateInvertGroup(highlight_group)
1136 if(synIDattr(hlID(a:highlight_group), "reverse")==1)
1137 let w:color=synIDattr(hlID(a:highlight_group), "fg#")
1138 else
1139 let w:color=synIDattr(hlID(a:highlight_group), "bg#")
1140 endif
1141
1142 let l:retval=a:highlight_group.'_invert'
1143 if(exists('w:color') && w:color == '')
1144 let w:color = 'NONE'
1145 endif
1146 silent! exec 'highlight '.retval.' gui=NONE guifg='.w:color.' cterm=NONE ctermfg='.w:color
1147 return l:retval
1148 endfunction
1149
1150 function! UpdateStatus(highlight_group)
1151 let l:invert_group = CreateInvertGroup(a:highlight_group)
1152 let l:mode = get({
1153 \ 'n' : 'normal',
1154 \ 'i' : 'insert',
1155 \ 'R' : 'replace',
1156 \ 'v' : 'visual',
1157 \ "V" : 'visual line',
1158 \ "\<C-V>" : 'visual block',
1159 \ 'c' : 'command',
1160 \ 's' : 'select',
1161 \ 'S' : 'select line',
1162 \ "\<C-s>" : 'select block',
1163 \ 't' : 'terminal'
1164 \ }, mode(), mode())
1165 return ''
1166 \ ."%#StatusLineHighlight#"
1167 \ ."%#".a:highlight_group."#"
1168 \ ."%(%w%h%q%)".' '.l:mode.' '.g:status_sym_sep_start.' '
1169 \ ."%{(argc()>0\ ?\ argidx()+1.':'.argc().' '.g:status_sym_sep_start.' '\ :\ '')}"
1170 \ ."%{winbufnr(0).' '.g:status_sym_sep_start}"
1171 \ ."%{(&readonly\ ?\ '\ \ 🔒'\ :\ '')}"
1172 \ ."%{(&modified\ ?\ '\ \ '.nr2char(0xF0C7).'\ '\ :\ '')\ }"
1173 \ ."%{(haslocaldir() ?\ fnamemodify(getcwd(),\ ':.').' '.nr2char(0xe0b1)\ \:\ '')}\ "
1174 \ ."%{(&buftype\ ==\ \"terminal\"\ ?\ has('nvim')?b:term_title:expand(&titlestring)\ :\ substitute(expand('%:p'),\ '^'.getcwd(-1).'/*',\ '',\ ''))\ }"
1175 \ ."%1(%)"
1176 \ ."%#".l:invert_group."#"
1177 \ .g:status_sym_end
1178 \ .''
1179 \ ."%="
1180 \ .''
1181 \ ."%#".l:invert_group."#"
1182 \ .g:status_sym_start
1183 \ ."%#".a:highlight_group."#"
1184 \ ."%1(%)"
1185 \ ."%{(&filetype\ !=\ ''\ ?\ &filetype\ :\ &buftype)}"
1186 \ ."%(\ %{g:status_sym_sep_end}\ %)"
1187 \ ."%{(&spell\ ?\ &spelllang.' '.g:status_sym_sep_end\ :\ '')}"
1188 \ ."%{(&fileencoding\ !=\ ''\ ?\ &fileencoding.' '.g:status_sym_sep_end.' '\ :\ '')}"
1189 \ ."%{(&fileformat\ !=\ ''\ ?\ ' '.&fileformat.' '\ :\ '')}"
1190 \ .g:status_sym_sep_end.' '
1191 \ ."%4l:%-3c"
1192 \ .g:status_sym_sep_end.' '
1193 \ ."%-3p%%"
1194 endfunction
1195
1196 function! UpdateTabline(highlight_group)
1197 let l:invert_group = CreateInvertGroup(a:highlight_group)
1198 return ''
1199 \ ."%#".a:highlight_group."#"
1200 \ ."%3( \ %)\ "
1201 \ ."%{getcwd(-1)}\ "
1202 \ .g:status_sym_sep_start.' '
1203 \ ."%(\ ".g:symbol_branch."\ %{fugitive#head()}\ %)"
1204 \ ."%#".l:invert_group."#"
1205 \ .g:status_sym_end
1206 \ .''
1207 \ ."%="
1208 \ .''
1209 \ ."%#".l:invert_group."#"
1210 \ .g:status_sym_start
1211 \ ."%#".a:highlight_group."#"
1212 \ ."%3(\ %)"
1213 \ ."%(%{v:servername}\ %{v:this_session}%)"
1214 \ .g:status_sym_sep_end.' '
1215 \ ."%(\ \ %{tabpagenr()}/%{tabpagenr('$')}\ %)"
1216 \ ."%##"
1217 \ ."" " end
1218 endfunction
1219
1220 function! ApplyColorScheme()
1221 " set termguicolors | " When on, uses highlight-guifg and highlight-guibg attributes in the terminal (=24bit color) incompatible with nvim
1222 " set t_ut=
1223 " set up statusline, global and current window individually
1224 set statusline=%!UpdateStatus(g:group_inactive)
1225 setlocal statusline=%!UpdateStatus(g:group_active)
1226 " set up the tabline (match colors)
1227 set tabline=%!UpdateTabline(g:group_tabline)
1228 endfunction
1229 " apply colors from the loaded colorscheme...
1230 " when changing the colorscheme also apply new colors to the statusbar...
1231 autocmd VimEnter,ColorScheme * call ApplyColorScheme()
1232
1233 autocmd WinEnter * setlocal statusline=%!UpdateStatus(g:group_active)
1234 autocmd WinLeave * setlocal statusline<
1235augroup END " status
1236
1237" moved after VimEnter of statusline, so that it does not get overwritten any
1238" more
1239if empty(argv())
1240
1241 " autocmd VimEnter * call setloclist(0, filter(map(copy(v:oldfiles), {_, p->{'filename': expand(get(split(p, "'"), 0))}}), { val -> echo val}))
1242
1243 " from the list of recent files: make absolute paths, filter out files not
1244 " contained in cwd and finally filter out directories and non-files...
1245 autocmd StdinReadPre * let s:std_in=1
1246 autocmd VimEnter * if !exists("s:std_in") | call setloclist(0, [], 'r',
1247 \ {
1248 \ 'title':'Recently used files in directory: '.getcwd(),
1249 \ 'items':map(filter(filter(
1250 \ map(copy(v:oldfiles),
1251 \ {_, p->expand(p)}), 'v:val =~ "'.getcwd().'/"'), 'filereadable(v:val)'),
1252 \ {_, p->{'filename': fnamemodify(p, ':.')}})
1253 \ }) | lopen | only | setfiletype qf
1254endif
1255
diff --git a/vimrc-minimal-statusline b/vimrc-minimal-statusline
new file mode 100644
index 0000000..8a8656e
--- /dev/null
+++ b/vimrc-minimal-statusline
@@ -0,0 +1,30 @@
1set nocompatible
2
3
4filetype plugin indent on
5
6set omnifunc=syntaxcomplete#Complete
7
8syntax on
9
10
11set ts=2 sw=2 expandtab
12
13set ignorecase smartcase
14
15set hidden
16
17let g:status_fg="#ffffff"
18let g:status_bg="#000000"
19let g:status_sel='#ffff00'
20
21execute 'highlight! StatusLine'
22 \ .' guibg='.g:status_sel
23 \ .' guifg=NONE'
24
25execute 'highlight! User1 guibg='.g:status_bg
26execute 'highlight! User1 guifg='.g:status_fg
27
28execute 'highlight! User2 guibg='.g:status_sel
29execute 'highlight! User2 guifg='.g:status_bg
30colorscheme coderonline
diff --git a/gvim-buffer.desktop b/xdg-additions/applications/gvim-buffer.desktop
index 5cd2cbf..5cd2cbf 100644
--- a/gvim-buffer.desktop
+++ b/xdg-additions/applications/gvim-buffer.desktop
diff --git a/gvim.desktop b/xdg-additions/applications/gvim.desktop
index 37c6e58..37c6e58 100644
--- a/gvim.desktop
+++ b/xdg-additions/applications/gvim.desktop
diff --git a/nvim.desktop b/xdg-additions/applications/nvim.desktop
index 21f0090..21f0090 100644
--- a/nvim.desktop
+++ b/xdg-additions/applications/nvim.desktop
diff --git a/vim.desktop b/xdg-additions/applications/vim.desktop
index f8efe76..f8efe76 100644
--- a/vim.desktop
+++ b/xdg-additions/applications/vim.desktop
diff --git a/bashrc b/xdg-additions/bashrc
index 24c51a0..24c51a0 100644
--- a/bashrc
+++ b/xdg-additions/bashrc
diff --git a/default-font.conf b/xdg-additions/default-font.conf
index b1de279..b1de279 100644
--- a/default-font.conf
+++ b/xdg-additions/default-font.conf
diff --git a/gtk-3.0.css b/xdg-additions/gtk-3.0.css
index f347a83..f347a83 100644
--- a/gtk-3.0.css
+++ b/xdg-additions/gtk-3.0.css
diff --git a/ycm_extra_mini-conf.py b/ycm_extra_mini-conf.py
new file mode 100644
index 0000000..0583c73
--- /dev/null
+++ b/ycm_extra_mini-conf.py
@@ -0,0 +1,138 @@
1# Generated by YCM Generator at 2017-02-03 00:22:04.774052
2
3# This file is NOT licensed under the GPLv3, which is the license for the rest
4# of YouCompleteMe.
5#
6# Here's the license text for this file:
7#
8# This is free and unencumbered software released into the public domain.
9#
10# Anyone is free to copy, modify, publish, use, compile, sell, or
11# distribute this software, either in source code form or as a compiled
12# binary, for any purpose, commercial or non-commercial, and by any
13# means.
14#
15# In jurisdictions that recognize copyright laws, the author or authors
16# of this software dedicate any and all copyright interest in the
17# software to the public domain. We make this dedication for the benefit
18# of the public at large and to the detriment of our heirs and
19# successors. We intend this dedication to be an overt act of
20# relinquishment in perpetuity of all present and future rights to this
21# software under copyright law.
22#
23# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
26# IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
27# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
28# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
29# OTHER DEALINGS IN THE SOFTWARE.
30#
31# For more information, please refer to <http://unlicense.org/>
32
33import os
34import ycm_core
35
36flags = [
37 '-x',
38 'c',
39 '-Wall',
40]
41
42
43# Set this to the absolute path to the folder (NOT the file!) containing the
44# compile_commands.json file to use that instead of 'flags'. See here for
45# more details: http://clang.llvm.org/docs/JSONCompilationDatabase.html
46#
47# You can get CMake to generate this file for you by adding:
48# set( CMAKE_EXPORT_COMPILE_COMMANDS 1 )
49# to your CMakeLists.txt file.
50#
51# Most projects will NOT need to set this to anything; you can just change the
52# 'flags' list of compilation flags. Notice that YCM itself uses that approach.
53compilation_database_folder = ''
54
55if os.path.exists( compilation_database_folder ):
56 database = ycm_core.CompilationDatabase( compilation_database_folder )
57else:
58 database = None
59
60SOURCE_EXTENSIONS = [ '.cpp', '.cxx', '.cc', '.c', '.m', '.mm' ]
61
62def DirectoryOfThisScript():
63 return os.path.dirname( os.path.abspath( __file__ ) )
64
65
66def MakeRelativePathsInFlagsAbsolute( flags, working_directory ):
67 if not working_directory:
68 return list( flags )
69 new_flags = []
70 make_next_absolute = False
71 path_flags = [ '-isystem', '-I', '-iquote', '--sysroot=' ]
72 for flag in flags:
73 new_flag = flag
74
75 if make_next_absolute:
76 make_next_absolute = False
77 if not flag.startswith( '/' ):
78 new_flag = os.path.join( working_directory, flag )
79
80 for path_flag in path_flags:
81 if flag == path_flag:
82 make_next_absolute = True
83 break
84
85 if flag.startswith( path_flag ):
86 path = flag[ len( path_flag ): ]
87 new_flag = path_flag + os.path.join( working_directory, path )
88 break
89
90 if new_flag:
91 new_flags.append( new_flag )
92 return new_flags
93
94
95def IsHeaderFile( filename ):
96 extension = os.path.splitext( filename )[ 1 ]
97 return extension in [ '.h', '.hxx', '.hpp', '.hh' ]
98
99
100def GetCompilationInfoForFile( filename ):
101 # The compilation_commands.json file generated by CMake does not have entries
102 # for header files. So we do our best by asking the db for flags for a
103 # corresponding source file, if any. If one exists, the flags for that file
104 # should be good enough.
105 if IsHeaderFile( filename ):
106 basename = os.path.splitext( filename )[ 0 ]
107 for extension in SOURCE_EXTENSIONS:
108 replacement_file = basename + extension
109 if os.path.exists( replacement_file ):
110 compilation_info = database.GetCompilationInfoForFile(
111 replacement_file )
112 if compilation_info.compiler_flags_:
113 return compilation_info
114 return None
115 return database.GetCompilationInfoForFile( filename )
116
117
118def FlagsForFile( filename, **kwargs ):
119 if database:
120 # Bear in mind that compilation_info.compiler_flags_ does NOT return a
121 # python list, but a "list-like" StringVec object
122 compilation_info = GetCompilationInfoForFile( filename )
123 if not compilation_info:
124 return None
125
126 final_flags = MakeRelativePathsInFlagsAbsolute(
127 compilation_info.compiler_flags_,
128 compilation_info.compiler_working_dir_ )
129
130 else:
131 relative_to = DirectoryOfThisScript()
132 final_flags = MakeRelativePathsInFlagsAbsolute( flags, relative_to )
133
134 return {
135 'flags': final_flags,
136 'do_cache': True
137 }
138
..