diff options
Diffstat (limited to 'vimrc-custom-statusline')
| -rw-r--r-- | vimrc-custom-statusline | 1221 |
1 files changed, 0 insertions, 1221 deletions
diff --git a/vimrc-custom-statusline b/vimrc-custom-statusline deleted file mode 100644 index 19942cd..0000000 --- a/vimrc-custom-statusline +++ /dev/null | |||
| @@ -1,1221 +0,0 @@ | |||
| 1 | " vim: noai:ts=2:sw=2:sts=2 iskeyword+=\:,\!,\<,\>,\-,\& number | ||
| 2 | |||
| 3 | "======================================================================================================================= | ||
| 4 | " GENERAL: | ||
| 5 | "======================================================================================================================= | ||
| 6 | set exrc | " enable exrc, a specific .exrc per project, which can contain usual .vimrc commands | ||
| 7 | set textwidth=0 | " better done with modeline or local exrc and not here | ||
| 8 | set ts=4 sts=4 sw=4 expandtab | " better done with a modeline or local exrc | ||
| 9 | set virtualedit=all | " virtual edit should be default behaviour, because I don't see any reason against | ||
| 10 | set nonumber norelativenumber | " do not show numbers by default, because that causes a performance loss, instead activate them on a file type basis | ||
| 11 | set 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) | ||
| 12 | set cindent cinoptions+=(0 | " indent at parentheses | ||
| 13 | |||
| 14 | |||
| 15 | set path+=** | " allow recursive searches for files | ||
| 16 | let &path = &path.",/usr/lib/modules/".substitute(system('uname -r'), "\n", "", "")."/build/include" | ||
| 17 | |||
| 18 | "======================================================================================================================= | ||
| 19 | " SHELL | ||
| 20 | "======================================================================================================================= | ||
| 21 | if filereadable("/bin/bash") | ||
| 22 | set shell=/bin/bash | " many scripts rely on bash, but its path varies why it is commented out here | ||
| 23 | elseif filereadable("/usr/local/bin/bash") | ||
| 24 | set shell=/usr/local/bin/bash | ||
| 25 | endif | ||
| 26 | |||
| 27 | "======================================================================================================================= | ||
| 28 | " Persistent undo | ||
| 29 | "======================================================================================================================= | ||
| 30 | if 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) | ||
| 39 | endif | ||
| 40 | |||
| 41 | "======================================================================================================================= | ||
| 42 | " multi byte | ||
| 43 | "======================================================================================================================= | ||
| 44 | if 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+=fold:\ | " | ||
| 50 | set fillchars+=vert:\║ | " cool vertical split char | ||
| 51 | set fillchars+=diff:\ | " a white space gets used here | ||
| 52 | |||
| 53 | set listchars= | " initialize empty listchars | ||
| 54 | set listchars+=extends:» | " symbols used when using :set list (which displays non-printable chars) | ||
| 55 | set listchars+=precedes:« | " symbols used when using :set list (which displays non-printable chars) | ||
| 56 | |||
| 57 | set listchars+=tab:▏\ | " | ||
| 58 | set listchars+=trail:· | " symbols used when using :set list (which displays non-printable chars) | ||
| 59 | " set listchars+=eol:↲ | " symbols used when using :set list (which displays non-printable chars) | ||
| 60 | " set listchars+=space:· | " symbols used when using :set list (which displays non-printable chars) | ||
| 61 | set showbreak+=› | " symbol used in the beginning of a wrapped line | ||
| 62 | |||
| 63 | " automatically enter list mode when going in insert mode (makes above syntax command temporarily ineffective) | ||
| 64 | set nolist | ||
| 65 | autocmd InsertEnter * set list | ||
| 66 | autocmd InsertLeave * set nolist | ||
| 67 | " set fillchars+=stlnc:\― | " | ||
| 68 | end | ||
| 69 | |||
| 70 | |||
| 71 | "======================================================================================================================= | ||
| 72 | " SPELL_CHECKING | ||
| 73 | "======================================================================================================================= | ||
| 74 | let g:spellfile_URL='http://ftp.vim.org/vim/runtime/spell' | ||
| 75 | " add local user default spell file as primary source for words | ||
| 76 | let &spellfile=fnamemodify($MYVIMRC, ":p:h")."/spell/spellfile-user.UTF-8.add" | ||
| 77 | |||
| 78 | set nospell | " disable spell checker by default | ||
| 79 | set spelllang=en,de | " languages for the spell checker | ||
| 80 | set spellsuggest=10 | " how many words will z= suggest? | ||
| 81 | set thesaurus+=~/.vim/thesaurus/php.txt | ||
| 82 | |||
| 83 | "======================================================================================================================= | ||
| 84 | " cscope | ||
| 85 | "======================================================================================================================= | ||
| 86 | " http://vim.wikia.com/wiki/Cscope | ||
| 87 | if has('cscope') " compiled with cscope support? | ||
| 88 | set cscopetag " CTRL-] uses cscope first, then ctags | ||
| 89 | set cscopeverbose | ||
| 90 | |||
| 91 | if has('quickfix') | ||
| 92 | set cscopequickfix=s+,c+,d+,i+,t+,e+ | ||
| 93 | endif | ||
| 94 | |||
| 95 | if has('menu') | ||
| 96 | 1001menu &Cscope.find.c\ symbol | ||
| 97 | \<tab>s | ||
| 98 | \ :cscope find s <cword><:cR> | ||
| 99 | 1001menu &Cscope.find.definition | ||
| 100 | \<tab>g | ||
| 101 | \ :cscope find g <cword><:cR> | ||
| 102 | 1001menu &Cscope.find.functions\ called\ by\ this | ||
| 103 | \<tab>d | ||
| 104 | \ :cscope find d <cword><:cR> | ||
| 105 | 1001menu &Cscope.find.functions\ calling\ this | ||
| 106 | \<tab>c | ||
| 107 | \ :cscope find c <cword><:cR> | ||
| 108 | 1001menu &Cscope.find.text\ string | ||
| 109 | \<tab>t | ||
| 110 | \ :cscope find t <cword><:cR> | ||
| 111 | 1001menu &Cscope.find.egrep\ pattern | ||
| 112 | \<tab>e | ||
| 113 | \ :cscope find e <cword><:cR> | ||
| 114 | 1001menu &Cscope.find.this\ file | ||
| 115 | \<tab>f | ||
| 116 | \ :cscope find f <cword><:cR> | ||
| 117 | 1001menu &Cscope.find.files\ including\ this\ file | ||
| 118 | \<tab>i | ||
| 119 | \ :cscope find i <cword><:cR> | ||
| 120 | 1001menu &Cscope.find.places\ where\ this\ symbol\ is\ assigned\ a\ value | ||
| 121 | \<tab>a | ||
| 122 | \ :cscope find a <cword><:cR> | ||
| 123 | 1001menu &Cscope.-Sep1- | ||
| 124 | \ : | ||
| 125 | 1001menu &Cscope.create\ and\ add\ database | ||
| 126 | \ :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> | ||
| 127 | 1001menu &Cscope.-Sep2- | ||
| 128 | \ : | ||
| 129 | 1001menu &Cscope.add\ \. | ||
| 130 | \ :cscope add .<CR> | ||
| 131 | 1001menu &Cscope.show | ||
| 132 | \ :cscope show<CR> | ||
| 133 | 1001menu &Cscope.reset | ||
| 134 | \ :cscope reset<CR> | ||
| 135 | endif | ||
| 136 | endif | ||
| 137 | |||
| 138 | " ====================================================================================================================== | ||
| 139 | " GUI_VERSION | ||
| 140 | " ====================================================================================================================== | ||
| 141 | if has("gui_running") | ||
| 142 | set guicursor=a:block-blinkon100 | ||
| 143 | set browsedir=buffer | ||
| 144 | set toolbar+=text | ||
| 145 | set guiheadroom=0 | ||
| 146 | set guioptions+=eig | ||
| 147 | set guioptions-=T | " toolbar | ||
| 148 | set guioptions+=c | " use console dialogues instead of popups | ||
| 149 | set guioptions+=a | " auto select: copy&paste using middle click | ||
| 150 | set guioptions+=m | " remove menu | ||
| 151 | set guioptions-=e | " do not display tabs | ||
| 152 | set guioptions-=L | " do not show left scrollbar | ||
| 153 | set guioptions-=r | " do not show right scrollbar | ||
| 154 | set winaltkeys=menu | " behave like other windows: ALT-key can be used to open the menu (and cannot be :remaped) | ||
| 155 | " set selectmode=mouse,key,cmd | " enters vim's select mode when pressing shift-left or shift-END | ||
| 156 | " set keymodel=startsel,stopsel | " makes shift-left, shift-right available for selecting text | ||
| 157 | |||
| 158 | |||
| 159 | " its possible to define alternative fonts (order matters) | ||
| 160 | set guifont=Hasklug\ Nerd\ Font\ Mono\ Semi-Bold\ 10 | ||
| 161 | set guifont+=Hasklig\ Semi-Bold\ 10 | ||
| 162 | set guifont+=Bitstream\ Vera\ Sans\ Mono\ 10 | ||
| 163 | set guifont+=Monospace\ 10 | ||
| 164 | set guifont+=FuraMono\ Nerd\ Font\ Mono\ Medium\ 11 | ||
| 165 | set guifont+=Source\ Code\ Pro\ for\ Powerline\ SemiBold\ 10 | ||
| 166 | set guifont+=LiterationMono\ Nerd\ Font\ Mono\ 10 | ||
| 167 | set guifont+=RobotoMono\ Nerd\ Font\ Medium\ 10 | ||
| 168 | set guifont+=Source\ Code\ Pro\ Semi-Bold\ 10 | ||
| 169 | set guifont+=Dejavu\ Sans\ Mono\ for\ Powerline\ Semibold | ||
| 170 | set guifont+=Droid\ Sans\ Mono\ for\ Powerline\ 10 | ||
| 171 | set guifont+=Meslo\ LG\ M\ for\ Powerline\ 10 | ||
| 172 | |||
| 173 | " like in the terminal: use Ctrl-shift-v for paste in vim's command editor | ||
| 174 | cnoremap <c-s-v> <c-r>* | ||
| 175 | endif | ||
| 176 | |||
| 177 | " ====================================================================================================================== | ||
| 178 | " SETTINGS: | ||
| 179 | " ====================================================================================================================== | ||
| 180 | set breakindent | " Every wrapped line will continue visually indented | ||
| 181 | set clipboard=unnamedplus | " makes copy and paste work (autoselectplus might work as well) | ||
| 182 | set concealcursor=nc | " limits the display of concealed text to normal and command mode | ||
| 183 | set conceallevel=2 | " replace escaped chars by their UTF-8 representation (useful for LaTeX) | ||
| 184 | set confirm | " asks 'do you want to save?' | ||
| 185 | set cpoptions+=P | " makes :w filename set the current buffer to filename | ||
| 186 | set hidden | " allows switching buffers even if the current buffer contains changes (displays +) | ||
| 187 | set linebreak | " wrap long lines at char 'breakat', not inside words | ||
| 188 | set mousemodel=popup | " only in gvim: right click opens a pop-up-menu | ||
| 189 | set mouse=n | " allow mouse in normal mode only, so one can use the terminals c&p feature in insert mode | ||
| 190 | set noautochdir | " When on, Vim will change the current working directory | ||
| 191 | set nostartofline | " when scrolling: do not move the cursor to column 1 | ||
| 192 | set nowrap | " but do not (by default) wrap long lines around | ||
| 193 | set nrformats+=alpha | " allows CTRL-A & CTRL-X to increment and decrement letters, not just numbers | ||
| 194 | set incsearch | " highlight pattern while entering it (performance wise this isn't that good) | ||
| 195 | |||
| 196 | if has('nvim') " Neovim? | ||
| 197 | set inccommand=nosplit | " preview substitute and such things in real time | ||
| 198 | endif | ||
| 199 | |||
| 200 | set pumheight=8 | " Determines the maximum number of items to show in the pop-up menu for | ||
| 201 | set scrolljump=5 | " how many lines get scrolled into view when cursor reaches the screens edge | ||
| 202 | set scrolloff=0 | " keeps cursor centered | ||
| 203 | set shiftround | " indent/un-indent snaps to multiple of shiftwidths | ||
| 204 | set writedelay=0 | ||
| 205 | |||
| 206 | " display and performance | ||
| 207 | set lazyredraw | " disables redraw during macro execution (improves performance) | ||
| 208 | set cmdheight=2 | " sets the command line's height | ||
| 209 | set signcolumn=auto | " auto=auto hide, yes=always, no=never show the column with error indicators | ||
| 210 | set nocursorcolumn | " turn visual cursor column off (improves performance) | ||
| 211 | set updatetime=80 | " updates the screen more often | ||
| 212 | set redrawtime=1500 | " Timeout in milliseconds for redrawing the screen (switches syntax off when ssh too slow) / CTRL+L to retry | ||
| 213 | set notimeout | " improves performance but is known to cause problems on slow terminals | ||
| 214 | set ttimeout ttimeoutlen=150 | " set Esc key timeout in ms- | ||
| 215 | set showcmd | " essential: show keys of combined commands in the lower right corner (BUT SLOW, makes cursor flickering) | ||
| 216 | set showtabline=2 | " 0: never, 1: only if there are at least two tabs, 2:always | ||
| 217 | set shortmess+=I | " don't give the intro message when starting Vim |:intro|. | ||
| 218 | set wildmenu | " use a menu in the command line | ||
| 219 | set wildmode=longest:full | " do not preselect any entry and show all possible | ||
| 220 | |||
| 221 | " code completion | ||
| 222 | " set dictionary=/usr/share/dict/cracklib-small | ||
| 223 | " set complete+=k " make default completer <C-N> respect the dictionary | ||
| 224 | set complete-=u " scan current and included files | ||
| 225 | set complete+=i " scan current and included files | ||
| 226 | set complete+=d " scan current and included files for defined name or macro | ||
| 227 | set complete+=d | " scan current and included files for defined name or macro | ||
| 228 | set complete+=i | " scan current and included files for completions | ||
| 229 | set tagcase=match | " tagcase match, because we mostly use ^] to jump around and that variant respects the upper/lower case [followscs, followic, match, ignore] | ||
| 230 | set tags+=../tags | ||
| 231 | |||
| 232 | " code folding... | ||
| 233 | set nofoldenable | " disable folding, because we have zi to toggle foldenable :) | ||
| 234 | set foldclose=all | " automatically fold, when the cursor leaves the folded area | ||
| 235 | set foldcolumn=0 | " I think I don't need this second indicator | ||
| 236 | " set foldmethod=syntax | " foldlevel: syntax, indent, manual / foldmethod=syntax makes Vim incredible slow | ||
| 237 | set foldnestmax=1 | " top level folding only | ||
| 238 | set foldopen=block,hor,search | " when do we unfold? | ||
| 239 | " set foldtext=Foldtext() | " | ||
| 240 | " set foldtext=v:folddashes.substitute(getline(v:foldstart),'\\v^/[/*]\','','g') | ||
| 241 | " set foldtext='⊞\ '.substitute(getline(v:foldstart),'^[\ '.printf(&cms,'').']*','','').'↵'.getline(v:foldstart+1).'↵'.getline(v:foldstart+2) | ||
| 242 | set foldtext='⊞\ '.substitute(join(getline(v:foldstart,v:foldend),'↵'),'\[*\/\]','','g') | ||
| 243 | |||
| 244 | " vim window behaviour | ||
| 245 | set splitbelow | " open new windows below the current one (i find that more intuitive) | ||
| 246 | set winminwidth=0 | " (and all other windows, so TODO: watch out) | ||
| 247 | set winwidth=30 | " keep NERDTreeWindow at least this size | ||
| 248 | |||
| 249 | |||
| 250 | " vim session handling and restore behaviour | ||
| 251 | set viminfo+=% | " restore buffer list | ||
| 252 | set sessionoptions= | ||
| 253 | set sessionoptions+=buffers | ||
| 254 | set sessionoptions+=curdir | ||
| 255 | set sessionoptions+=folds | ||
| 256 | set sessionoptions+=resize | ||
| 257 | set sessionoptions+=slash | ||
| 258 | set sessionoptions+=tabpages | ||
| 259 | set sessionoptions+=unix | ||
| 260 | set sessionoptions+=winpos | ||
| 261 | set sessionoptions+=winsize | ||
| 262 | |||
| 263 | |||
| 264 | " set nocindent smartindent | " use smart indent rather then cindent | ||
| 265 | set noautoindent | ||
| 266 | set nosmartindent | ||
| 267 | |||
| 268 | set noshiftround | " indent/un-indent sna=ps to multiple of shiftwidths | ||
| 269 | set noequalalways | " do not evenly size windows when opening new or closing old | ||
| 270 | set nocursorline | " turn visual cursor line off (improves performance) | ||
| 271 | "======================================================================================================================= | ||
| 272 | |||
| 273 | " Vim 8 has a terminal command... | ||
| 274 | if has('terminal') | ||
| 275 | " use default ESC key to leave insert mode in the internal terminal emulator | ||
| 276 | tnoremap <Esc> <C-W>N | ||
| 277 | " make terminal windows hidden by default (copied from :help terminal) | ||
| 278 | autocmd BufWinEnter * if &buftype == 'terminal' | setlocal bufhidden=hide | endif | ||
| 279 | endif | ||
| 280 | |||
| 281 | |||
| 282 | " NEOVIM_incompatible: | ||
| 283 | " | ||
| 284 | if has('nvim') " Neovim? | ||
| 285 | autocmd TermOpen term://* set nobuflisted | ||
| 286 | " use default ESC key to leave insert mode in the internal terminal emulator | ||
| 287 | tnoremap <Esc> <C-\><C-n> | ||
| 288 | " set shada+=n~/.vim/shada | " shada file to use | ||
| 289 | " | ||
| 290 | menu &UI.&Open\ in\ Serversession | ||
| 291 | \ :execute ':!nvr --servername /tmp/nvimsocket --remote % +'.line('.')<CR>:stopinsert<CR>:set readonly<CR> | ||
| 292 | |||
| 293 | else " default Vim? | ||
| 294 | autocmd VimLeave * call system("echo -n $'" . escape(getreg(), "'") . "' | xsel -ib") | ||
| 295 | |||
| 296 | set ttymouse=xterm2 | ||
| 297 | set ttyscroll=100 | " improves speed for terminal vim, incompatible with nvim | ||
| 298 | set ttyfast | " improves speed for terminal vim (incompatible with nvim) | ||
| 299 | set nottybuiltin | " use external termcaps | ||
| 300 | set restorescreen | " restores the console after exiting vim (intentionally not in nvim) | ||
| 301 | " | ||
| 302 | let g:loaded_ruby_provider = 1 " disable ruby support | ||
| 303 | let g:loaded_python_provider = 1 " disable python 3 | ||
| 304 | |||
| 305 | if version >= 702 " clean up (see: http://vim.wikia.com/wiki/VimTip396) | ||
| 306 | autocmd BufWinLeave * call clearmatches() | ||
| 307 | endif | ||
| 308 | |||
| 309 | |||
| 310 | " scripts from the default vim installation, which do not get loaded by default, but are useful. | ||
| 311 | if filereadable($VIMRUNTIME.'/macros/editexisting.vim') | ||
| 312 | packadd! editexisting | ||
| 313 | endif | ||
| 314 | |||
| 315 | " load default plugin 'matchit' to allow % to jump between tags | ||
| 316 | if filereadable($VIMRUNTIME.'/macros/matchit.vim') | ||
| 317 | packadd! matchit | ||
| 318 | endif | ||
| 319 | |||
| 320 | endif | ||
| 321 | |||
| 322 | |||
| 323 | if has("autocmd") | ||
| 324 | set modeline | " set variables specific to a file, like indentation by adding a comment | ||
| 325 | " set default completion function in case YouCompleteMe cannot help | ||
| 326 | " set omnifunc=syntaxcomplete#Complete | ||
| 327 | |||
| 328 | augroup set_window_title " { | ||
| 329 | " autocmd BufEnter * let &titlestring = hostname() . "[vim(" . expand("%:t") . ")]" | ||
| 330 | autocmd CursorHold * let &titlestring = "%t %y ".$USER."@".hostname().":%{expand(\"%:~:.:h\")}" | ||
| 331 | set title | ||
| 332 | " autocmd CursorHold * let &titlestring = "Vim (".airline#extensions#tagbar#currenttag().")" | ||
| 333 | |||
| 334 | " set window title for screen(3) | ||
| 335 | if &term == "screen" | ||
| 336 | set t_ts=k | ||
| 337 | set t_fs=\ | ||
| 338 | endif | ||
| 339 | if &term == "screen" || &term == "xterm" | ||
| 340 | set titlelen=40 | ||
| 341 | set title | ||
| 342 | endif | ||
| 343 | augroup END | ||
| 344 | |||
| 345 | augroup ChangeIcon | ||
| 346 | "if filereadable("/usr/bin/xseticon") | ||
| 347 | "if filereadable("~/.vim/nvim.png") | ||
| 348 | " autocmd VimEnter * silent :execute "!xseticon -id $WINDOWID ~/.vim/nvim.png" | ||
| 349 | " autocmd VimLeave * silent :execute "!xseticon -id $WINDOWID /usr/share/icons/gnome/32x32/apps/xfce-terminal.png" | ||
| 350 | "endif | ||
| 351 | "endif | ||
| 352 | augroup END | ||
| 353 | |||
| 354 | " Fix terminal title ================================================================================================= | ||
| 355 | " autocmd VimEnter * let &t_EI .= "\<Esc>[0 q" | ||
| 356 | " autocmd VimEnter * let &t_SI = "\<Esc>]12;green\x7" | ||
| 357 | autocmd VimLeave * silent !echo -ne "\033]112\007" | ||
| 358 | |||
| 359 | " highlight word under the cursor ==================================================================================== | ||
| 360 | let w:m1 = 0 | ||
| 361 | function! HighlightWordUnderCursor() | ||
| 362 | if(exists('w:m1') && w:m1 > 0) | ||
| 363 | silent! call matchdelete(w:m1) | ||
| 364 | let w:m1 = 0 | ||
| 365 | endif | ||
| 366 | let l:currentword = escape(expand('<cword>'), '.') | ||
| 367 | if(strlen(l:currentword) > 0) | ||
| 368 | let w:m1=100 | ||
| 369 | silent! call matchadd('BoldUnderline', '\<'.l:currentword.'\>', -1, w:m1) | ||
| 370 | endif | ||
| 371 | endfunction | ||
| 372 | autocmd! CursorHold,CursorHoldI * call HighlightWordUnderCursor() | ||
| 373 | |||
| 374 | " hitting K over a keyword shows a help in a buffer. | ||
| 375 | " Here we define the commands used to look those keywords up | ||
| 376 | " as per file type... | ||
| 377 | augroup filetype_specific | ||
| 378 | autocmd FileType python setlocal keywordprg=pydoc | ||
| 379 | autocmd FileType vim setlocal keywordprg=:help |. | ||
| 380 | autocmd FileType c,cpp setlocal equalprg=clang-format | ||
| 381 | autocmd FileType c,cpp setlocal breakat-=- | ||
| 382 | |||
| 383 | if filereadable("/usr/bin/vendor_perl/ack") | ||
| 384 | autocmd FileType c,cpp set grepprg=/usr/bin/vendor_perl/ack\ --type=cc\ --nogroup\ --column\ $* | ||
| 385 | autocmd FileType c,cpp set grepformat=%f:%l:%c:%m | ||
| 386 | endif | ||
| 387 | |||
| 388 | autocmd BufWinEnter * if &previewwindow | setlocal nonumber signcolumn=no filetype=c nobuflisted | endif | ||
| 389 | |||
| 390 | |||
| 391 | " autocmd FileType c,cpp setlocal iskeyword-=_ | ||
| 392 | |||
| 393 | " the following helps to make file=/etc/something work with gf, but disallows filenames with an equal sign in them | ||
| 394 | autocmd FileType conf setlocal isfname-== | ||
| 395 | |||
| 396 | |||
| 397 | autocmd Filetype css command! CSSsort :g/{/+1;/}/-1 sort | ||
| 398 | |||
| 399 | " keyboard mapping for xml alike languages | ||
| 400 | " Alt-Up : Move cursor up one tag | ||
| 401 | " Alt-Down: Move cursor down one tag | ||
| 402 | " leader-=: tidies currently selected tag and subtags and sorts attributes by name (alphabetically) | ||
| 403 | autocmd Filetype html,markdown,xml iabbrev </ </<C-X><C-O> | ||
| 404 | autocmd Filetype html,htmldjango,xml | ||
| 405 | \ :nnoremap | ||
| 406 | \ <M-Down> | ||
| 407 | \ :call search('^ *<', 'e')<CR>:nohlsearch<CR>| | ||
| 408 | \ :nnoremap | ||
| 409 | \ <M-Up> | ||
| 410 | \ :call search('^ *<', 'eb')<CR>:nohlsearch<CR>| | ||
| 411 | \ :nnoremap | ||
| 412 | \ <leader>= | ||
| 413 | \ vat:'<,'>!tidy -xml --wrap 0 --sort-attributes alpha 2>/dev/null<CR>vat= | ||
| 414 | augroup END | ||
| 415 | |||
| 416 | " autocmd BufNewFile set nobuflisted | ||
| 417 | " use the shada/viminfo file to return the cursor to where it was... | ||
| 418 | autocmd BufReadPost * call setpos(".", getpos("'\"")) | ||
| 419 | |||
| 420 | augroup CurrentFileName | ||
| 421 | " highlight the current files name inside the document... | ||
| 422 | let @g = ":exe ':match SpellBad /'.escape(expand('%:t'), '.').'/'" | ||
| 423 | " put the current files name after the cursor... | ||
| 424 | let @f = ":exe ':normal a'.expand('%:t')" | ||
| 425 | |||
| 426 | " grep all buffers for a given string and return result in a quickfix window | ||
| 427 | let @q = ":cex [] | bufdo vimgrepadd /foo/g % | cw" | ||
| 428 | |||
| 429 | let @l = ":let g:signify_vcs_cmds={'git': 'git diff --no-color --no-ext-diff -U0 HEAD^ -- %f'}|:SignifyRefresh" | ||
| 430 | |||
| 431 | if has('menu') | ||
| 432 | source $VIMRUNTIME/menu.vim | ||
| 433 | set wildmenu | ||
| 434 | set cpo-=< | ||
| 435 | set wcm=<C-Z> | ||
| 436 | |||
| 437 | 01menu &Functions.toggle\ file\ browser | ||
| 438 | \<Tab><leader><leader> | ||
| 439 | \ <leader><leader> | ||
| 440 | 01menu &Functions.-Sep0- : | ||
| 441 | |||
| 442 | 01menu &Functions.help | ||
| 443 | \<Tab><F1> | ||
| 444 | \ <F1> | ||
| 445 | 01menu &Functions.bp:\ previous\ buffer | ||
| 446 | \<Tab><F2> | ||
| 447 | \ <F2> | ||
| 448 | 01menu &Functions.bn:\ next\ buffer | ||
| 449 | \<Tab><F3> | ||
| 450 | \ <F3> | ||
| 451 | 01menu &Functions.^wc\:\ close\ window | ||
| 452 | \<Tab><F4> | ||
| 453 | \ <F4> | ||
| 454 | 01menu &Functions.-Sep1- : | ||
| 455 | |||
| 456 | 01menu &Functions.make | ||
| 457 | \<Tab><F5> | ||
| 458 | \ <F5> | ||
| 459 | 01menu &Functions.clear\ matches,\ update\ viewport | ||
| 460 | \<Tab><F6> | ||
| 461 | \ <F6> | ||
| 462 | 01menu &Functions.copen\:\ show\ quickfix\ list | ||
| 463 | \<Tab><F7> | ||
| 464 | \ <F7> | ||
| 465 | 01menu &Functions.lopen\:\ show\ location\ list | ||
| 466 | \<Tab><F8> | ||
| 467 | \ <F8> | ||
| 468 | 01menu &Functions.-Sep2- : | ||
| 469 | |||
| 470 | 01menu &Functions.toggle\ tagbar | ||
| 471 | \<Tab><F9> | ||
| 472 | \ <F9> | ||
| 473 | |||
| 474 | if has("gui_running") == 0 | ||
| 475 | " in the gui F10 already triggers the menu, not in a terminal vim, so upgrade that... | ||
| 476 | map <F10> :emenu <C-Z> | ||
| 477 | endif | ||
| 478 | 01menu &Functions.activate\ menu\ (:emenu) | ||
| 479 | \<Tab><F10> | ||
| 480 | \ <F10> | ||
| 481 | |||
| 482 | 01menu &Functions.undef11 | ||
| 483 | \<Tab><F11> | ||
| 484 | \ <F11> | ||
| 485 | 01menu &Functions.undef12 | ||
| 486 | \<Tab><F12> | ||
| 487 | \ <F12> | ||
| 488 | 01menu &Functions.-Sep2- : | ||
| 489 | |||
| 490 | |||
| 491 | 09menu &Directory.print\ current\ directory | ||
| 492 | \<Tab>:pwd | ||
| 493 | \ :pwd<CR> | ||
| 494 | |||
| 495 | 09menu &Directory.-Sep- : | ||
| 496 | |||
| 497 | 09menu &Directory.Change\ to\ GIT\ root | ||
| 498 | \<Tab>:Gcd | ||
| 499 | \ :Gcd<CR>:pwd<CR> | ||
| 500 | |||
| 501 | 09menu &Directory.Change\ to\ current\ buffers\ directory\ (global) | ||
| 502 | \<tab>:cd\ %:p:h | ||
| 503 | \ :cd %:h<CR>:pwd<CR> | ||
| 504 | |||
| 505 | 09menu &Directory.Change\ to\ current\ buffers\ directory\ (local\ window)<tab>:lcd\ %:p:h | ||
| 506 | \ :lcd %:p:h<CR>:pwd<CR> | ||
| 507 | |||
| 508 | menu &Git.&Display\ last\ changes | ||
| 509 | \ :let g:signify_vcs_cmds={'git': 'git diff --no-color --no-ext-diff -U0 HEAD^ -- %f'}<CR>:SignifyRefresh<CR> | ||
| 510 | menu &Git.&Display\ significance\ of\ changes | ||
| 511 | \ :!git diff --stat HEAD~1..HEAD | ||
| 512 | menu &Git.&Display\ Changed\ files\ compared\ to\ master | ||
| 513 | \ :!git diff --name-status ..master | ||
| 514 | |||
| 515 | menu &Match.Clear\ All\ Matches | ||
| 516 | \<Tab><F6> | ||
| 517 | \ :call clearmatches()<CR> | ||
| 518 | |||
| 519 | menu &Match.-Sep- : | ||
| 520 | |||
| 521 | menu &Match.&dispensable\ white\ spaces | ||
| 522 | \ :call matchadd("Convention", '\s\+$', 0)<CR> | ||
| 523 | |||
| 524 | menu &Match.&long\ lines\ (exeeding\ textwidth) | ||
| 525 | \ :call matchadd("Convention", '\%>'.&textwidth.'v.', 0)<CR> | ||
| 526 | |||
| 527 | menu &Match.Highlight\ current\ file\ name | ||
| 528 | \ :call matchadd("Search", escape(expand('%:t'), '.'))<CR> | ||
| 529 | |||
| 530 | " :execute ':match SpellBad /'.escape(expand('%:t'), '.').'/'<CR> | ||
| 531 | |||
| 532 | menu &Window.-Sep- : | ||
| 533 | |||
| 534 | |||
| 535 | menu &Window.Scratch | ||
| 536 | \ :Scratch<CR> | ||
| 537 | |||
| 538 | |||
| 539 | menu &Find.file\ under\ the\ cursor | ||
| 540 | \<Tab>gf | ||
| 541 | \ gf | ||
| 542 | |||
| 543 | menu &Find.Open\ search\ results\ in\ location\ list | ||
| 544 | \<Tab>:gf | ||
| 545 | \ :execute ':vimgrep /'.escape(getreg('/'), '.').'/g %'<CR> | ||
| 546 | \ :copen<CR> | ||
| 547 | |||
| 548 | menu &Changes.list | ||
| 549 | \<Tab>:changes | ||
| 550 | \ :changes<CR> | ||
| 551 | menu &Changes.-Sep- : | ||
| 552 | menu &Changes.previous | ||
| 553 | \<Tab>g; | ||
| 554 | \ g; | ||
| 555 | menu &Changes.next | ||
| 556 | \<Tab>g, | ||
| 557 | \ g, | ||
| 558 | |||
| 559 | menu &Jump.list | ||
| 560 | \<Tab>:jumps | ||
| 561 | \ :jumps<CR> | ||
| 562 | menu &Jump.-Sep1- : | ||
| 563 | menu &Jump.previous\ position | ||
| 564 | \<Tab>CTRL-O | ||
| 565 | \ <C-O> | ||
| 566 | menu &Jump.next\ position | ||
| 567 | \<Tab>CTRL-I | ||
| 568 | \ <C-I> | ||
| 569 | menu &Jump.-Sep2- : | ||
| 570 | menu &Jump.clear\ list | ||
| 571 | \<Tab>:clearjumps | ||
| 572 | \ :clearjumps | ||
| 573 | |||
| 574 | 1000menu &Tag.list | ||
| 575 | \<Tab>:tags | ||
| 576 | \ :tags<CR> | ||
| 577 | 1000menu &Tag.selection\ list | ||
| 578 | \<Tab>:ts | ||
| 579 | \ :ts<CR> | ||
| 580 | |||
| 581 | 1000menu &Tag.-Sep1- : | ||
| 582 | |||
| 583 | 1000menu &Tag.stack.jump\ older | ||
| 584 | \<Tab><C-T> | ||
| 585 | \ :po | ||
| 586 | 1000menu &Tag.stack.jump\ | ||
| 587 | \<Tab>:ta | ||
| 588 | \ :ta | ||
| 589 | endif | ||
| 590 | |||
| 591 | " autocmd BufEnter * @f | ||
| 592 | augroup END | ||
| 593 | |||
| 594 | " autocmd VimEnter * set nobuflisted | ||
| 595 | endif | ||
| 596 | |||
| 597 | |||
| 598 | " ====================================================================================================================== | ||
| 599 | " SHORTCUTS: custom shortcuts | ||
| 600 | " inoremap <C-Space> <C-x><C-o> | ||
| 601 | " inoremap <C-@> <C-Space> | ||
| 602 | |||
| 603 | " Bind CTRL+Backspace to vim's version (CTRL+W) in " <CR> insert mode (only works with gvim) | ||
| 604 | inoremap | ||
| 605 | \ <C-Backspace> | ||
| 606 | \ <C-W> | ||
| 607 | |||
| 608 | " INDENTATION: allows un-indenting a selected block and keeps selection | ||
| 609 | vnoremap < <gv | ||
| 610 | vnoremap > >gv | ||
| 611 | |||
| 612 | " make shift-home select to the beginning of the line | ||
| 613 | nnoremap <s-home> v^ | ||
| 614 | nnoremap <s-end> v$ | ||
| 615 | |||
| 616 | nnoremap <s-down> vj | ||
| 617 | vnoremap <s-down> j | ||
| 618 | nnoremap <s-up> vk | ||
| 619 | vnoremap <s-up> k | ||
| 620 | |||
| 621 | |||
| 622 | " close current buffer with <leader>q... | ||
| 623 | nnoremap <leader>q :bp<bar>sp<bar>bn<bar>bd<CR>. | ||
| 624 | " google the word under the cursor | ||
| 625 | nnoremap <leader>G :execute ":!xdg-open https://google.de/search?q=".expand("<cword>") | ||
| 626 | |||
| 627 | nnoremap <silent> <F5> :make!<CR> | ||
| 628 | nnoremap <silent> <F6> :silent syntax sync fromstart<CR>:nohlsearch<CR>:silent match<CR>:silent 2match<CR>:silent 3match<CR> | ||
| 629 | nnoremap <leader>r :syntax sync fromstart | ||
| 630 | |||
| 631 | nnoremap <silent> <A-Up> :wincmd k<CR> | ||
| 632 | nnoremap <silent> <A-Down> :wincmd j<CR> | ||
| 633 | nnoremap <silent> <A-Left> :wincmd h<CR> | ||
| 634 | nnoremap <silent> <A-Right> :wincmd l<CR> | ||
| 635 | |||
| 636 | " INSERT_MODE_MAPPINGS: | ||
| 637 | " default copy&paste insert key binding (just in insert mode, so it doesn't conflict | ||
| 638 | " with visual block mode)- would have been nice, but collides with c-w for digraphs | ||
| 639 | " inoremap <C-V> <C-R>+ | ||
| 640 | " | ||
| 641 | inoremap <C-S> <C-O>:w<CR> | ||
| 642 | |||
| 643 | " NEOVIM_SPECIFIC: | ||
| 644 | if has('nvim') " only neovim... | ||
| 645 | " shortcut \t opens a terminal in a horizontal split | ||
| 646 | nnoremap <leader>t :new +terminal<CR> | ||
| 647 | endif | ||
| 648 | |||
| 649 | |||
| 650 | |||
| 651 | " ====================================================================================================================== | ||
| 652 | " START: LOADING PLUGINS | ||
| 653 | " ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ | ||
| 654 | call plug#begin() | ||
| 655 | " Colorschemes: | ||
| 656 | Plug 'coderonline/vim-remote-menu' | ||
| 657 | " Plug 'bbchung/clighter8' | ||
| 658 | " Plug 'octol/vim-cpp-enhanced-highlight' | ||
| 659 | " Plug 'vim-scripts/TagHighlight' | ||
| 660 | " if ! exists('g:TagHighlightSettings') | ||
| 661 | " let g:TagHighlightSettings = {} | ||
| 662 | " endif | ||
| 663 | " let g:TagHighlightSettings['TagFileName'] = 'tags' | ||
| 664 | " let g:TagHighlightSettings['CtagsExecutable'] = 'ctags' | ||
| 665 | |||
| 666 | Plug 'chriskempson/base16-vim' | " not just one high quality color scheme (all named base16-*) | ||
| 667 | Plug 'NLKNguyen/papercolor-theme' | " the one I like the most | ||
| 668 | |||
| 669 | Plug 'mhinz/vim-signify' | " uses the sign column to indicate added, modified and removed lines | ||
| 670 | Plug 'tpope/vim-fugitive' | " the most complete GIT integration plugin | ||
| 671 | Plug 'godlygeek/tabular' | " align code on a sign, like :Tab/= | ||
| 672 | Plug 'severin-lemaignan/vim-minimap' | ||
| 673 | Plug 'tpope/vim-surround' | " plugin makes cs"' inside a line replace " with ' | ||
| 674 | let g:signify_vcs_list = [ 'git' ] | " use signify only with git (improves speed when loading buffers, see :h signify) | ||
| 675 | let g:signify_cursorhold_insert = 0 | ||
| 676 | let g:signify_cursorhold_normal = 0 | ||
| 677 | let g:signify_update_on_bufenter = 0 | ||
| 678 | let g:signify_update_on_focusgained = 0 | ||
| 679 | let g:signify_sign_show_count = 1 | ||
| 680 | |||
| 681 | " NERDTree: replaces NetRW, as long as it has so many bugs | ||
| 682 | Plug 'scrooloose/nerdtree' | " | ||
| 683 | let NERDTreeIgnore = ['\.aux$', '\.o$'] | ||
| 684 | let NERDTreeCascadeSingleChildDir = 0 | " I don't get how one can use <m> to create files in that included directory | ||
| 685 | let NERDTreeChDirMode = 0 | ||
| 686 | let NERDTreeHiddenFirst = 1 | ||
| 687 | let NERDTreeMinimalUI = 1 | ||
| 688 | let NERDTreeShowBookmarks = 1 | " show bookmarks by default (when opening for the first time) | ||
| 689 | let NERDTreeWinSize = 40 | ||
| 690 | let NERDTreeQuitOnOpen = 1 | ||
| 691 | |||
| 692 | " depending on if NERDTree has the focus: | ||
| 693 | nnoremap <expr> | ||
| 694 | \ <leader><leader> | ||
| 695 | \ bufwinnr("%")==g:NERDTree.GetWinNum() ? ':NERDTreeClose<CR>' : ':NERDTreeFind<CR>' | ||
| 696 | nnoremap <expr> | ||
| 697 | \ <F2> | ||
| 698 | \ bufwinnr("%")==g:NERDTree.GetWinNum() ? '<C-W><C-W>' : ':N<CR>' | ||
| 699 | |||
| 700 | nnoremap <expr> | ||
| 701 | \ <F3> | ||
| 702 | \ bufwinnr("%")==g:NERDTree.GetWinNum() ? '<C-W><C-W>' : ':n<CR>' | ||
| 703 | |||
| 704 | nnoremap <F4> | ||
| 705 | \ :wincmd c<CR> | ||
| 706 | " close NERDTree if it is the last remaining window (taken from the official documentation) | ||
| 707 | " autocmd bufenter * | ||
| 708 | " \ if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif | ||
| 709 | " | ||
| 710 | |||
| 711 | |||
| 712 | " map CTRL-PageUp/Down to next/previous buffer | ||
| 713 | " and Shift-PageUp/Down to next/previous arglist file | ||
| 714 | nnoremap <C-PageUp> :bn<CR> | ||
| 715 | nnoremap <C-PageDown> :bp<CR> | ||
| 716 | nnoremap <S-PageUp> :N<CR> | ||
| 717 | nnoremap <S-PageDown> :n<CR> | ||
| 718 | |||
| 719 | |||
| 720 | " Additional: ========================================. | ||
| 721 | Plug 'sheerun/vim-polyglot' " better syntax highlighting/indentation for multiple languages | ||
| 722 | let g:javascript_conceal_function = "ƒ" | ||
| 723 | let g:javascript_conceal_null = "ø" | ||
| 724 | let g:javascript_conceal_this = "@" | ||
| 725 | let g:javascript_conceal_return = "⇚" | ||
| 726 | let g:javascript_conceal_undefined = "¿" | ||
| 727 | let g:javascript_conceal_NaN = "ℕ" | ||
| 728 | let g:javascript_conceal_prototype = "¶" | ||
| 729 | let g:javascript_conceal_static = "•" | ||
| 730 | let g:javascript_conceal_super = "Ω" | ||
| 731 | let g:javascript_conceal_arrow_function = "⇒" | ||
| 732 | |||
| 733 | Plug 'majutsushi/tagbar' " superseeds taglist-plus, which isn't maintained any more | ||
| 734 | let g:tagbar_autoclose = 0 | ||
| 735 | let g:tagbar_autofocus = 1 | ||
| 736 | let g:tagbar_autoshowtag = 0 | ||
| 737 | let g:tagbar_compact = 1 | ||
| 738 | let g:tagbar_indent = 0 | ||
| 739 | let g:tagbar_foldlevel = 99 | ||
| 740 | |||
| 741 | nnoremap <F9> :TagbarToggle<CR>| " bind TagBar to hotkey F9 | ||
| 742 | |||
| 743 | |||
| 744 | " LIGHTLINE: a fancy status line ======================================================================================= | ||
| 745 | " | ||
| 746 | set noshowmode | " mode will be shown twice, in lightline and below, so we want to deactivate one | ||
| 747 | set laststatus=2 | " required by AirLine and Lightline, without status line does not appear until a window split | ||
| 748 | |||
| 749 | " set statusline=\ %##%{(&modified?nr2char(0xF0C7):'')}%{(&readonly\ ?\ ''\ :\ '')}%)%{fnamemodify(getcwd(),':~')}%{nr2char(0x20)}%{nr2char(0xE0B1)}%{nr2char(0x20)}%f%{nr2char(0xf05b)}%y%*%=%l:%c(%p%%) | ||
| 750 | " | ||
| 751 | |||
| 752 | |||
| 753 | set statusline= | ||
| 754 | set statusline+=%#StatusLineHighlight# | ||
| 755 | set statusline+=%1* | ||
| 756 | set statusline+=%{(&readonly\ ?\ '\ \ \ '\ :\ '')} | ||
| 757 | set statusline+=%{(&modified\ ?\ nr2char(0xF0C7).'\ '\ :\ '')} | ||
| 758 | set statusline+=%(%w%h%q\ %-8{mode()}%) | ||
| 759 | set statusline+=%{nr2char(0xe621)} | ||
| 760 | set statusline+=%(\ %{fnamemodify(getcwd(),\ ':~')}\ %) | ||
| 761 | set statusline+=%{nr2char(0xf44a)} | ||
| 762 | set statusline+=%(\ %f\ %) | ||
| 763 | set statusline+=%2* | ||
| 764 | set statusline+=%{nr2char(0xE0B4)\ } | ||
| 765 | |||
| 766 | set statusline+=%= | ||
| 767 | |||
| 768 | set statusline+=%2* | ||
| 769 | set statusline+=%{nr2char(0xE0B6)} | ||
| 770 | set statusline+=%1* | ||
| 771 | set statusline+=%1(%) " a single space | ||
| 772 | set statusline+=%{\ &filetype} | ||
| 773 | set statusline+=%(\ %{nr2char(0xe621)}\ %) | ||
| 774 | set statusline+=%{&fileencoding} | ||
| 775 | set statusline+=%(\ %{nr2char(0xe621)}\ %) | ||
| 776 | set statusline+=%{&fileformat} | ||
| 777 | set statusline+=%(\ %{nr2char(0xe621)}\ %) | ||
| 778 | set statusline+=%4l:%-4c | ||
| 779 | set statusline+=%-3p%% | ||
| 780 | |||
| 781 | |||
| 782 | set tabline= | ||
| 783 | set tabline+=%1* | ||
| 784 | set tabline+=%3(\ %) | ||
| 785 | set tabline+=%{nr2char(0xe621)} | ||
| 786 | set tabline+=%(%{v:servername}\ %{v:this_session}%) | ||
| 787 | set tabline+=%2* | ||
| 788 | set tabline+=%{nr2char(0xE0B4)\ } | ||
| 789 | |||
| 790 | set tabline+=%= | ||
| 791 | |||
| 792 | set tabline+=%2* | ||
| 793 | set tabline+=%{nr2char(0xE0B6)} | ||
| 794 | set tabline+=%1* | ||
| 795 | set tabline+=%(\ \ %{fugitive#head()}\ %) | ||
| 796 | set tabline+=%{nr2char(0xe621)} | ||
| 797 | set tabline+=%(\ \ %{tabpagenr()}/%{tabpagenr('$')}\ %) | ||
| 798 | set tabline+=%## | ||
| 799 | " set statusline+=%t%m | ||
| 800 | " set statusline+=%{TagInStatusLine()} | ||
| 801 | " set statusline+=%#warningmsg# | ||
| 802 | " set statusline+=%{SyntasticStatuslineFlag()} | ||
| 803 | |||
| 804 | " Plug 'itchyny/lightline.vim' | ||
| 805 | |||
| 806 | " lightline-buffer ui settings | ||
| 807 | " replace these symbols with ASCII characters if your environment does not support unicode | ||
| 808 | let g:lightline_buffer_logo = '' | ||
| 809 | let g:lightline_buffer_readonly_icon = '' | ||
| 810 | let g:lightline_buffer_modified_icon = '✭' | ||
| 811 | let g:lightline_buffer_git_icon = ' ' | ||
| 812 | let g:lightline_buffer_ellipsis_icon = '..' | ||
| 813 | let g:lightline_buffer_active_buffer_left_icon = ' ' | ||
| 814 | let g:lightline_buffer_active_buffer_right_icon = '' | ||
| 815 | " let g:lightline_buffer_separator_icon = 'XX' | ||
| 816 | |||
| 817 | " lightline-buffer function settings | ||
| 818 | let g:lightline_buffer_show_bufnr = 0 | ||
| 819 | let g:lightline_buffer_rotate = 0 | ||
| 820 | let g:lightline_buffer_fname_mod = ':t' | ||
| 821 | let g:lightline_buffer_excludes = ['vimfiler'] | ||
| 822 | let g:lightline_buffer_maxflen = 30 | ||
| 823 | let g:lightline_buffer_maxfextlen = 3 | ||
| 824 | let g:lightline_buffer_minflen = 16 | ||
| 825 | let g:lightline_buffer_minfextlen = 3 | ||
| 826 | let g:lightline_buffer_reservelen = 20 | ||
| 827 | |||
| 828 | " \ ['warnings', 'errors', 'syntastic'] | ||
| 829 | " \ 'left': [ [ 'bufferinfo' ], [ 'bufferbefore', 'buffercurrent', 'bufferafter' ], ], | ||
| 830 | let g:lightline = { | ||
| 831 | \ 'tabline': { | ||
| 832 | \ 'left': [ [ 'servername', 'sessionname' ] ], | ||
| 833 | \ 'right': [ [], ['gitbranch', 'tabnumber'] ], | ||
| 834 | \ }, | ||
| 835 | \ 'colorscheme': 'Tomorrow_Night', | ||
| 836 | \ 'separator': { 'left': "\uE0B4", 'right': "\uE0B6" }, | ||
| 837 | \ 'subseparator': { 'left': "\uE0b1", 'right': "\uE0b3" }, | ||
| 838 | \ 'inactive': { | ||
| 839 | \ 'left': [ [ 'pwd', 'relativepath'] ], | ||
| 840 | \ 'right': [] | ||
| 841 | \ }, | ||
| 842 | \ 'active': { | ||
| 843 | \ 'left': [ [ 'mode', 'register', 'paste' ], [ 'pwd', 'relativepath' ] , ['tagbar']], | ||
| 844 | \ 'right': [ [ 'lineinfo', 'percent' ], [ 'filetype', 'readonly', 'spell', 'fileencoding', 'fileformat' ] ] | ||
| 845 | \ }, | ||
| 846 | \ 'component': { | ||
| 847 | \ 'tagbar': '%{substitute(tagbar#currenttag("%s", "", "fs"), "\(.*\)", "", "")}', | ||
| 848 | \ 'ycmparent': '%{substitute(execute("YcmComplete GetParent"), "\(.*\)", "", "")}', | ||
| 849 | \ 'filename': '%t', | ||
| 850 | \ 'buffer_alt': '%{expand("#:t")}', | ||
| 851 | \ 'servername': ' %{v:servername}', | ||
| 852 | \ 'sessionname': '%{v:this_session}', | ||
| 853 | \ 'gitbranch': ' %{fugitive#head()}', | ||
| 854 | \ 'tabnumber': " %{tabpagenr()}/%{tabpagenr('$')}", | ||
| 855 | \ 'readonly': '%{&readonly ? "" : ""}', | ||
| 856 | \ 'register': '%{v:register}', | ||
| 857 | \ 'title': '%{getwinvar(0, "quickfix_title")}', | ||
| 858 | \ 'pwd': '%{fnamemodify(getcwd(), ":~")}', | ||
| 859 | \ 'relativepath': '%{fnamemodify(expand("%"), ":.")}' | ||
| 860 | \ }, | ||
| 861 | \ 'component_expand': { | ||
| 862 | \ 'buffercurrent': 'lightline#buffer#buffercurrent2', | ||
| 863 | \ 'syntastic': 'SyntasticStatuslineFlag', | ||
| 864 | \ }, | ||
| 865 | \ 'component_function': { | ||
| 866 | \ 'bufferinfo': 'lightline#buffer#bufferinfo', | ||
| 867 | \ 'warnings': 'youcompleteme#GetWarningCount', | ||
| 868 | \ 'errors': 'youcompleteme#GetErrorCount', | ||
| 869 | \ }, | ||
| 870 | \ } | ||
| 871 | |||
| 872 | |||
| 873 | " Autocompleter: ===================================== | ||
| 874 | if has("python") | ||
| 875 | |||
| 876 | " ULTISNIPS: code snippet ============================================================================================ | ||
| 877 | Plug 'honza/vim-snippets' " dependency of ultisnips (see below) | ||
| 878 | Plug 'SirVer/ultisnips' " replaces loremipsum (and many more) | ||
| 879 | " 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) | ||
| 880 | 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) | ||
| 881 | |||
| 882 | let g:UltiSnipsJumpForwardTrigger = '<Tab>'| | ||
| 883 | let g:UltiSnipsJumpBackwardTrigger = '<S-Tab>'| | ||
| 884 | "d let g:UltiSnipsJumpForwardTrigger = '<PageDown>' | ||
| 885 | " let g:UltiSnipsJumpBackwardTrigger = '<PageUp>' | ||
| 886 | "let g:UltiSnipsExpandTrigger = '<C-j>'| " Trigger configuration. Do not use <tab> if you use https://github.com/Valloric/YouCompleteMe. | ||
| 887 | "let g:UltiSnipsJumpForwardTrigger = '<C-j>'| " \ | ||
| 888 | "let g:UltiSnipsJumpBackwardTrigger = '<C-k>'| " \ | ||
| 889 | "let g:UltiSnipsListSnippets = '<C-`>'| " YouCompleteMe includes those, so this isn't necessary | ||
| 890 | "let g:UltiSnipsListSnippets = '<leader><leader>'| " YouCompleteMe includes those, so this isn't necessary | ||
| 891 | """ Ultisnips | ||
| 892 | " let g:UltiSnipsExpandTrigger="<c-tab>" | ||
| 893 | " let g:UltiSnipsListSnippets="<c-s-tab>" | ||
| 894 | |||
| 895 | if has('nvim') | ||
| 896 | Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' } | ||
| 897 | " Use deoplete. | ||
| 898 | let g:deoplete#enable_at_startup = 1 | ||
| 899 | inoremap <silent><expr> <C-Space> deoplete#mappings#manual_complete() | ||
| 900 | |||
| 901 | Plug 'Shougo/echodoc.vim' | ||
| 902 | let g:echodoc#enable_at_startup = 1 | ||
| 903 | |||
| 904 | " Plug 'Rip-Rip/clang_complete' | ||
| 905 | " Plug 'tweekmonster/deoplete-clang2' | ||
| 906 | " Plug 'zchee/deoplete-clang' | ||
| 907 | " let g:deoplete#sources#clang#libclang_path = "/usr/lib/libclang.so" | ||
| 908 | " let g:deoplete#sources#clang#clang_header = "/usr/lib/clang/6.0.0" | ||
| 909 | " let g:deoplete#sources#clang#std#cpp = 'c++1z' | ||
| 910 | " let g:deoplete#sources#clang#clang_complete_database = "/home/max/src" | ||
| 911 | " Plug 'Shougo/neoinclude.vim' " makes vim slow - unfortunatelly | ||
| 912 | |||
| 913 | Plug 'autozimu/LanguageClient-neovim', { | ||
| 914 | \ 'branch': 'next', | ||
| 915 | \ 'do': 'bash install.sh', | ||
| 916 | \ } | ||
| 917 | |||
| 918 | let g:LanguageClient_serverCommands = { | ||
| 919 | \ 'cpp': ['clangd'] | ||
| 920 | \ } | ||
| 921 | " Plug 'roxma/nvim-completion-manager' unmaintained python version | ||
| 922 | else | ||
| 923 | Plug 'idanarye/vim-vebugger' | ||
| 924 | |||
| 925 | " YouCompleteMe: ===================================================================================================== | ||
| 926 | " Plug 'Valloric/MatchTagAlways' " highlights the closing tag/brace/... | ||
| 927 | Plug 'Valloric/YouCompleteMe', { | ||
| 928 | \ 'do' : 'python install.py --clang-completer', | ||
| 929 | \ } | ||
| 930 | let g:ycm_error_symbol = '✖' " insert this as an error symbol in the gutter bar/sign column | ||
| 931 | let g:ycm_warning_symbol = '➔' " insert this as a warning symbol in the gutter bar/sign coloumn | ||
| 932 | |||
| 933 | let g:ycm_autoclose_preview_window_after_insertion = 0 | ||
| 934 | let g:ycm_auto_trigger = 1 | ||
| 935 | let g:ycm_collect_identifiers_from_tags_files = 1 " Let YCM read tags from Ctags file | ||
| 936 | let g:ycm_confirm_extra_conf = 0 " security is overrated ;) | ||
| 937 | |||
| 938 | let g:ycm_key_list_previous_completion = ['Up'] | ||
| 939 | let g:ycm_key_list_select_completion = ['Down'] | ||
| 940 | |||
| 941 | " Plug 'vim-scripts/dbext.vim' " dependency to allow db related completions | ||
| 942 | " let g:ycm_server_python_interpreter = 'python3' | ||
| 943 | " let g:ycm_python_binary_path = '/usr/bin/python3' " the python interpreter of choice (for code checking) | ||
| 944 | " let g:ycm_add_preview_to_completeopt = 1 " reuse existing preview window | ||
| 945 | " let g:ycm_seed_identifiers_with_syntax = 1 " Completion for programming language's keyword | ||
| 946 | " let g:ycm_complete_in_comments = 1 " Completion in comments | ||
| 947 | " let g:ycm_complete_in_strings = 1 " Completion in string | ||
| 948 | " 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!) | ||
| 949 | " let g:ycm_min_num_identifier_candidate_chars = 4 | ||
| 950 | " let g:ycm_max_num_identifier_candidates = 10 | ||
| 951 | " let g:ycm_max_num_candidates = 50 | ||
| 952 | " let g:ycm_use_ultisnips_completer = 1 " Default 1, just ensure | ||
| 953 | " let g:ycm_key_list_select_completion = ['<Down>'] | ||
| 954 | " let g:ycm_key_list_previous_completion = ['<Up>'] | ||
| 955 | " let g:ycm_global_ycm_extra_conf = '.ycm_extra_conf.py' | ||
| 956 | " let g:ycm_semantic_triggers = { 'c': [ 're!.' ] } | ||
| 957 | " " let g:ycm_disable_for_files_larger_than_kb = 16384 " we have faaast computers, don't we? | ||
| 958 | " let g:ycm_show_diagnostics_ui = 0 | ||
| 959 | " " disable <tab>-key for YCM so that it can be used with ultisnips | ||
| 960 | " let g:ycm_key_list_select_completion=[] | ||
| 961 | " let g:ycm_key_list_previous_completion=[] | ||
| 962 | endif | ||
| 963 | |||
| 964 | |||
| 965 | " SYNTASTIC: ========================================================================================================= | ||
| 966 | if has('nvim') | ||
| 967 | Plug 'w0rp/ale' | ||
| 968 | let g:ale_set_highlights = 0 | ||
| 969 | highlight! link ALEWarningSign FoldColumn | ||
| 970 | let g:ale_sign_error = '' | ||
| 971 | let g:ale_sign_style_error = '' | ||
| 972 | let g:ale_sign_info = '' | ||
| 973 | let g:ale_sign_warning = '' | ||
| 974 | else | ||
| 975 | Plug 'scrooloose/syntastic' | ||
| 976 | set statusline+=%#warningmsg# | ||
| 977 | set statusline+=%{SyntasticStatuslineFlag()} | ||
| 978 | let g:LatexBox_latexmk_preview_continuously = 1 | ||
| 979 | let g:LatexBox_viewer = "evince" | ||
| 980 | let g:syntastic_always_populate_loc_list = 1 | ||
| 981 | let g:syntastic_auto_loc_list = 0 | ||
| 982 | let g:syntastic_check_on_open = 1 | ||
| 983 | let g:syntastic_check_on_wq = 0 | ||
| 984 | " let g:syntastic_quiet_messages = {"type":"style"} | ||
| 985 | " | ||
| 986 | " E221: multiple spaces before Operator | ||
| 987 | let g:syntastic_python_flake8_args = '--max-complexity=10 --max-line-length=120 --exclude venv --doctests --exit-zero --ignore=E221' | ||
| 988 | " filter ( = do not display) style/formatting errors and warnings | ||
| 989 | let g:syntastic_error_symbol = '✖' | ||
| 990 | let g:syntastic_style_error_symbol = '✗' | ||
| 991 | let g:syntastic_warning_symbol = '➔' | ||
| 992 | let g:syntastic_style_warning_symbol = '≈' | ||
| 993 | endif | ||
| 994 | |||
| 995 | " JEDI: ============================================================================================================== | ||
| 996 | Plug 'davidhalter/jedi-vim' " jedi gets used to display python function signatures | ||
| 997 | let g:jedi#completions_enabled = 0 " we do not need completions, because we have YouCompleteMe | ||
| 998 | let g:jedi#show_call_signatures = 1 " which sadly does not support signatures like jedi | ||
| 999 | let g:jedi#show_call_signatures_delay = 0 | ||
| 1000 | let g:jedi#auto_vim_configure = 0 | ||
| 1001 | let g:pymode_rope = 0 " https://github.com/davidhalter/jedi-vim/issues/163 | ||
| 1002 | " autocmd FileType python jedi.preload_module('os', 'sys', 'math') | ||
| 1003 | " let g:pymode_options_max_line_length = 120 | ||
| 1004 | " let g:syntastic_python_flake8_args='--ignore=F821,E302,E501,E241,E301' | ||
| 1005 | |||
| 1006 | endif " has("python") | ||
| 1007 | |||
| 1008 | "======================================================================================================================= | ||
| 1009 | " TESTING: | " plugins which I am currently trying... | ||
| 1010 | "======================================================================================================================= | ||
| 1011 | " Plug 'rhysd/vim-clang-format' | unnecessary, because we can just :pyf /usr/share/clang/clang-format.py | ||
| 1012 | Plug 'kana/vim-operator-user' " dependency, which allows overriding the = operator for indentation | ||
| 1013 | |||
| 1014 | " TODO: check if this is unrequired, when set equalprog is set to that py file | ||
| 1015 | autocmd FileType c,cpp,objc map <buffer> = :pyf /usr/share/clang/clang-format.py<CR> | ||
| 1016 | |||
| 1017 | " let g:clang_format#detect_style_file = 1 | ||
| 1018 | " autocmd FileType c,cpp,objc map <buffer> = <Plug>(operator-clang-format) | ||
| 1019 | |||
| 1020 | " Plug 'tpope/vim-characterize' | " normal mode: make ga show character names of Unicode chars (ga shows hex and dec values) | ||
| 1021 | " Plug 'rkitover/vimpager' | ||
| 1022 | " found this command instead (use as PAGER): | ||
| 1023 | " man -P 'nvim -R -u NORC -c":%!col -b" -c":set buftype=nowrite filetype=man" -' ls | ||
| 1024 | |||
| 1025 | command BuffersToArg :exec ':args '.join(map(range(0, bufnr('$')), 'fnameescape(fnamemodify(bufname(v:val), ":."))')) | ||
| 1026 | command BufToArg :argadd %:. | ||
| 1027 | |||
| 1028 | "======================================================================================================================= | ||
| 1029 | call plug#end() | " all plugins are getting loaded on this line, don't remove! | ||
| 1030 | |||
| 1031 | " ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ | ||
| 1032 | " END: LOADING PLUGINS | ||
| 1033 | " ====================================================================================================================== | ||
| 1034 | |||
| 1035 | " Deprecated with this configuration, but still useful when deactivating some Plugins | ||
| 1036 | " NETRW: obsolete with NERDTree | ||
| 1037 | let g:netrw_alto = 0 | " open files on the right | ||
| 1038 | let g:netrw_altv = 1 | " open files on the right | ||
| 1039 | let g:netrw_banner = 0 | " display help messages? | ||
| 1040 | let g:netrw_browse_split = 4 | " 4=open in previous window | ||
| 1041 | let g:netrw_fastbrowse = 2 | " manually refresh direcory list (avoids display errors) | ||
| 1042 | let g:netrw_hide = 1 | " show not-hidden files only | ||
| 1043 | let g:netrw_keepdir = 0 | ||
| 1044 | let g:netrw_list_hide = '^\..*' | " Explore mode: hide files starting with dot | ||
| 1045 | let g:netrw_liststyle = 3 | " 3=tree | ||
| 1046 | let g:netrw_preview = 0 | " | ||
| 1047 | let g:netrw_winsize = 20 | " window size in percent | ||
| 1048 | |||
| 1049 | " ====================================================================================================================== | ||
| 1050 | " COLORSCHEME: | ||
| 1051 | " ====================================================================================================================== | ||
| 1052 | |||
| 1053 | function! ExtendColorTheme() | ||
| 1054 | filetype on | ||
| 1055 | filetype plugin on | ||
| 1056 | filetype indent on | ||
| 1057 | |||
| 1058 | syntax on | " enable syntax highlighting | ||
| 1059 | syntax sync minlines=60 | " how many preceding lines will be parsed? (has performance impact) | ||
| 1060 | |||
| 1061 | " use the default terminal background color as background (allows transparency) | ||
| 1062 | " highlight! Normal guibg=NONE ctermbg=NONE | ||
| 1063 | " highlight! NonText guibg=NONE guifg=black ctermbg=NONE ctermfg=black | ||
| 1064 | |||
| 1065 | " make the ~ (tilde) indicator invisible, which usually marks the EOF | ||
| 1066 | highlight! link EndOfBuffer Ignore | ||
| 1067 | |||
| 1068 | highlight! CursorLineNr cterm=inverse | " ctermbg=black ctermfg=NONE | ||
| 1069 | highlight! Pmenu ctermbg=LightYellow ctermfg=DarkGrey | ||
| 1070 | highlight! PmenuSel ctermbg=blue ctermfg=LightYellow cterm=bold | ||
| 1071 | |||
| 1072 | highlight! link PmenuSbar Pmenu | ||
| 1073 | highlight! PmenuThumb cterm=inverse | ||
| 1074 | highlight! MoreMsg cterm=inverse | ||
| 1075 | highlight! link Folded LineNr | ||
| 1076 | highlight! Cursor guibg=#729fcf ctermbg=yellow | ||
| 1077 | highlight! link VertSplit LineNr | ||
| 1078 | " highlight! SpellBad ctermbg=none | ||
| 1079 | highlight! SpecialKey ctermfg=19 | ||
| 1080 | highlight! WhiteSpace ctermfg=19 | ||
| 1081 | |||
| 1082 | highlight! link TabLine LineNr | ||
| 1083 | highlight! TabLineSel ctermbg=blue ctermfg=black | ||
| 1084 | highlight! link TabLineFill LineNr | ||
| 1085 | highlight! Search ctermbg=LightYellow ctermfg=black guibg=#fefd86 guifg=#222222 | ||
| 1086 | highlight! link WildMenu Search | ||
| 1087 | |||
| 1088 | " generic, which should exist but don't | ||
| 1089 | highlight! Bold cterm=bold gui=bold | ||
| 1090 | highlight! Italic cterm=italic gui=italic | ||
| 1091 | highlight! Underline cterm=underline gui=underline | ||
| 1092 | highlight! BoldUnderline cterm=bold,underline gui=bold,underline | ||
| 1093 | highlight! BoldItalic cterm=Bold,Italic gui=Bold,Italic | ||
| 1094 | |||
| 1095 | " make tab stop (see listchars) less disturbing... | ||
| 1096 | highlight! link SpecialKey NonText | ||
| 1097 | |||
| 1098 | " highlight! link LightlineMiddle_tabline ColorColumn | ||
| 1099 | " highlight! link LightlineLeft_tabline_1 ColorColumn | ||
| 1100 | " highlight! link LightlineLeft_tabline_0_1 ColorColumn | ||
| 1101 | |||
| 1102 | highlight! Todo guibg=#ffffaa guifg=#000000 gui=bold term=bold | ||
| 1103 | highlight! cStatement guifg=red gui=bold term=bold | ||
| 1104 | |||
| 1105 | highlight! link Convention Error | ||
| 1106 | |||
| 1107 | let g:status_fg=synIDattr(hlID('Cursor'), 'fg#') | ||
| 1108 | let g:status_bg=synIDattr(hlID('Cursor'), 'bg#') | ||
| 1109 | let g:status_sel=synIDattr(hlID('StatusLine'), 'fg#') | ||
| 1110 | |||
| 1111 | execute 'highlight! StatusLine' | ||
| 1112 | \ .' guibg='.g:status_sel | ||
| 1113 | \ .' guifg=NONE' | ||
| 1114 | |||
| 1115 | execute 'highlight! User1 guibg='.g:status_bg | ||
| 1116 | execute 'highlight! User1 guifg='.g:status_fg | ||
| 1117 | |||
| 1118 | execute 'highlight! User2 guibg='.g:status_sel | ||
| 1119 | execute 'highlight! User2 guifg='.g:status_bg | ||
| 1120 | |||
| 1121 | |||
| 1122 | |||
| 1123 | " autocmd InsertLeave * call matchadd('Conceal', ' \+$', -1, 101, { 'conceal': '⟶' }) | ||
| 1124 | autocmd InsertEnter * silent! call matchdelete(101) | ||
| 1125 | autocmd InsertLeave * call matchadd('Convention', ' \+$', -1, 101, { 'conceal': '⟶' }) | ||
| 1126 | |||
| 1127 | " Show trailing whitepace and spaces before a tab as part of the syntax highlighting | ||
| 1128 | " autocmd BufEnter,InsertLeave * syntax match Convention /\s\+$\| \+\ze\t/ containedin=ALL | ||
| 1129 | " autocmd Syntax * syntax match Convention /\s\+$\| \+\ze\t/ containedin=ALL | ||
| 1130 | " autocmd BufEnter,BufWritePost * syntax match Convention /\s\+$\| \+\ze\t/ containedin=ALL | ||
| 1131 | " autocmd InsertEnter * syntax clear Convention | ||
| 1132 | " autocmd BufEnter,InsertLeave * execute ':syntax match Convention /\%>'.&textwidth.'v./ containedin=ALL' | ||
| 1133 | |||
| 1134 | autocmd InsertEnter * set colorcolumn=80,120 | ||
| 1135 | autocmd InsertLeave * set colorcolumn& | ||
| 1136 | " set colorcolumn= | " not used, because we have a :match directive for textwidth | ||
| 1137 | " | ||
| 1138 | " if argc() == 0 | ||
| 1139 | " rv | ||
| 1140 | " autocmd VimEnter * split +bro\ ol | ||
| 1141 | " endif | ||
| 1142 | " | ||
| 1143 | |||
| 1144 | endfunction | ||
| 1145 | autocmd! ColorScheme * call ExtendColorTheme() | ||
| 1146 | |||
| 1147 | |||
| 1148 | set termguicolors | " When on, uses highlight-guifg and highlight-guibg attributes in the terminal (=24bit color) incompatible with nvim | ||
| 1149 | " set t_ut= | ||
| 1150 | |||
| 1151 | if filereadable(expand("~/.vimrc_background")) && filereadable(expand("~/.config/base16-shell/colortest")) | ||
| 1152 | let g:base16_shell_path="~/.config/base16-shell/scripts" | ||
| 1153 | let base16colorspace=256 | ||
| 1154 | let syntax_cmd="skip" " vim internal, use base16 and no default colors | ||
| 1155 | set background=dark | ||
| 1156 | source ~/.vimrc_background | ||
| 1157 | else | ||
| 1158 | let g:PaperColor_Theme_Options = { | ||
| 1159 | \ 'theme': { | ||
| 1160 | \ 'default': { | ||
| 1161 | \ 'transparent_background': 1 | ||
| 1162 | \ } | ||
| 1163 | \ } | ||
| 1164 | \ } | ||
| 1165 | set background=dark | ||
| 1166 | colorscheme PaperColor | ||
| 1167 | endif | ||
| 1168 | |||
| 1169 | " ====================================================================================================================== | ||
| 1170 | " CONVENIENCE: | ||
| 1171 | " ====================================================================================================================== | ||
| 1172 | if empty(argv()) | ||
| 1173 | |||
| 1174 | " autocmd VimEnter * call setloclist(0, filter(map(copy(v:oldfiles), {_, p->{'filename': expand(get(split(p, "'"), 0))}}), { val -> echo val})) | ||
| 1175 | |||
| 1176 | " from the list of recent files: make absolute paths, filter out files not | ||
| 1177 | " contained in cwd and finally filter out directories and non-files... | ||
| 1178 | autocmd StdinReadPre * let s:std_in=1 | ||
| 1179 | autocmd VimEnter * if !exists("s:std_in") | call setqflist(map(filter(filter( | ||
| 1180 | \ map(copy(v:oldfiles), {_, p->expand(p)}), 'v:val =~ "'.getcwd().'"'), | ||
| 1181 | \ 'filereadable(v:val)'), {_, p->{'filename': fnamemodify(p, ':.')}})) | copen | only | ||
| 1182 | endif | ||
| 1183 | |||
| 1184 | command Vimls | ||
| 1185 | \ call setloclist(0, map(getbufinfo({'buflisted':1}), | ||
| 1186 | \ "{'bufnr': v:val.bufnr, | ||
| 1187 | \ 'lnum': v:val.lnum, | ||
| 1188 | \ 'text': '='.printf('%*s, % 3d: %s [%s]', winwidth(0) / 2, '', v:val.bufnr, v:val.name, getbufvar(v:val.bufnr, '&buftype')), | ||
| 1189 | \ 'pattern': 'not loaded'} | ||
| 1190 | \ ")) | ||
| 1191 | |||
| 1192 | command Ctoggle | ||
| 1193 | \ if(get(getqflist({'winid':1}), 'winid') == win_getid())|cclose|else|botright copen|endif | ||
| 1194 | command Ltoggle | ||
| 1195 | \ if(get(getloclist(0, {'winid':1}), 'winid') == win_getid())|lclose|else|lopen|endif | ||
| 1196 | |||
| 1197 | |||
| 1198 | |||
| 1199 | " nnoremap <silent> <ESC> :lclose<CR> " brings vim into REPLACE mode (R) | ||
| 1200 | nnoremap <silent> <F7> :Ltoggle<CR> | ||
| 1201 | nnoremap <silent> <F8> :Ctoggle<CR> | ||
| 1202 | nnoremap <silent> <F12> :Vimls<CR>:Ltoggle<CR> | ||
| 1203 | |||
| 1204 | " exec current line as a command, insert output of command (from: https://youtu.be/MquaityA1SM?t=35m45s) | ||
| 1205 | nnoremap Q !!$SHELL<CR> | ||
| 1206 | |||
| 1207 | |||
| 1208 | " ====================================================================================================================== | ||
| 1209 | " TESTING: | ||
| 1210 | " ====================================================================================================================== | ||
| 1211 | " avoids openin an empty buffer when restoring bufferlist from viminfo... | ||
| 1212 | " if argc() == 0 | ||
| 1213 | " silent autocmd VimEnter * nested :silent bun | ||
| 1214 | " endif | ||
| 1215 | |||
| 1216 | autocmd VimEnter,WinEnter * exec ':set scrolljump='.winheight(0)/2 | ||
| 1217 | |||
| 1218 | " display highlight group under the cursor | ||
| 1219 | map <leader>h :echo map(synstack(line('.'), col('.')), 'synIDattr(v:val, "name")')<CR> | ||
| 1220 | |||
| 1221 | " call setqflist( map(systemlist("git show --name-only --pretty=''"), {_, p->{'filename': fnamemodify(p, ':.')}})) | ||
