diff options
| author | Max Christian Pohle | 2017-06-11 17:51:05 +0200 |
|---|---|---|
| committer | Max Christian Pohle | 2017-06-11 17:51:05 +0200 |
| commit | 2f3d9964d909fb367252a5db3f1f33dd2e9b6091 (patch) | |
| tree | 874376b5dfb084af435dcd4f24c1cf2bbafdcbc1 /vimrc-full | |
| parent | a8e6896e6ef75e9133aa897dc41704e4986e45f7 (diff) | |
| download | vim-karlmarks-2f3d9964d909fb367252a5db3f1f33dd2e9b6091.tar.bz2 vim-karlmarks-2f3d9964d909fb367252a5db3f1f33dd2e9b6091.zip | |
Improved performance
By using variables instead of recalculating the values shown in
lightline
Diffstat (limited to 'vimrc-full')
| -rw-r--r-- | vimrc-full | 36 |
1 files changed, 20 insertions, 16 deletions
| @@ -53,7 +53,7 @@ set nowrap | " but do not (by default) wrap long lines around | |||
| 53 | set number | " turn line numbers on/off (performance decreases when they are shown) | 53 | set number | " turn line numbers on/off (performance decreases when they are shown) |
| 54 | set pumheight=8 | " Determines the maximum number of items to show in the popup menu for | 54 | set pumheight=8 | " Determines the maximum number of items to show in the popup menu for |
| 55 | set path+=** | " allow recursive searches for files | 55 | set path+=** | " allow recursive searches for files |
| 56 | set redrawtime=400 | " The time in milliseconds for redrawing the display. | 56 | set redrawtime=100 | " The time in milliseconds for redrawing the display. |
| 57 | " set restorescreen | " restores the console after exiting vim | 57 | " set restorescreen | " restores the console after exiting vim |
| 58 | " set shada+=n~/.vim/shada | " shada file to use | 58 | " set shada+=n~/.vim/shada | " shada file to use |
| 59 | set scrolljump=5 | " how many lines get scrolled into view when cursor reaches the screens edge | 59 | set scrolljump=5 | " how many lines get scrolled into view when cursor reaches the screens edge |
| @@ -195,19 +195,25 @@ let g:lightline_buffer_minfextlen = 3 | |||
| 195 | let g:lightline_buffer_reservelen = 20 | 195 | let g:lightline_buffer_reservelen = 20 |
| 196 | 196 | ||
| 197 | function! MyFiletype() | 197 | function! MyFiletype() |
| 198 | return winwidth(0) > 70 ? (strlen(&filetype) ? &filetype . ' ' . WebDevIconsGetFileTypeSymbol() : 'no ft') : '' | 198 | if(exists('b:filetype')) |
| 199 | return b:filetype | ||
| 200 | else | ||
| 201 | return &filetype | ||
| 199 | endfunction | 202 | endfunction |
| 203 | autocmd BufEnter * let b:filetype = winwidth(0) > 70 ? (strlen(&filetype) ? &filetype . ' ' . WebDevIconsGetFileTypeSymbol() : 'no ft') : '' | ||
| 200 | 204 | ||
| 201 | function! MyFileformat() | 205 | function! MyFileformat() |
| 202 | return winwidth(0) > 70 ? (&fileformat . ' ' . WebDevIconsGetFileFormatSymbol()) : '' | 206 | return exists('b:fileformat') ? b:fileformat : &fileformat |
| 203 | endfunction | 207 | endfunction |
| 208 | autocmd BufEnter * let b:fileformat = winwidth(0) > 70 ? (&fileformat . ' ' . WebDevIconsGetFileFormatSymbol()) : '' | ||
| 204 | 209 | ||
| 205 | function! MyBranchname() | 210 | function! MyBranchname() |
| 206 | return winwidth(0) > 70 ? fugitive#statusline() : '' | 211 | return exists('b:branchname') ? b:branchname : '' |
| 207 | endfunction | 212 | endfunction |
| 213 | autocmd BufEnter * let b:branchname = winwidth(0) > 70 ? fugitive#statusline() : '' | ||
| 208 | 214 | ||
| 209 | let g:lightline = { | 215 | let g:lightline = { |
| 210 | \ 'colorscheme': 'base16', | 216 | \ 'colorscheme': 'Tomorrow', |
| 211 | \ 'separator': { 'left': "\ue0b0", 'right': "\ue0b2" }, | 217 | \ 'separator': { 'left': "\ue0b0", 'right': "\ue0b2" }, |
| 212 | \ 'subseparator': { 'left': "\ue0b1", 'right': "\ue0b3" }, | 218 | \ 'subseparator': { 'left': "\ue0b1", 'right': "\ue0b3" }, |
| 213 | \ 'active': { | 219 | \ 'active': { |
| @@ -219,7 +225,7 @@ let g:lightline = { | |||
| 219 | \ }, | 225 | \ }, |
| 220 | \ 'tabline': { | 226 | \ 'tabline': { |
| 221 | \ 'left': [ [ 'bufferinfo' ], [ 'bufferbefore', 'buffercurrent', 'bufferafter' ], ], | 227 | \ 'left': [ [ 'bufferinfo' ], [ 'bufferbefore', 'buffercurrent', 'bufferafter' ], ], |
| 222 | \ 'right': [ [ 'close' ], ], | 228 | \ 'right': [ [ 'getcwd', 'close' ] ], |
| 223 | \ }, | 229 | \ }, |
| 224 | \ 'component_expand': { | 230 | \ 'component_expand': { |
| 225 | \ 'buffercurrent': 'lightline#buffer#buffercurrent2', | 231 | \ 'buffercurrent': 'lightline#buffer#buffercurrent2', |
| @@ -234,15 +240,11 @@ let g:lightline = { | |||
| 234 | \ 'filetype': 'MyFiletype', | 240 | \ 'filetype': 'MyFiletype', |
| 235 | \ 'fileformat': 'MyFileformat', | 241 | \ 'fileformat': 'MyFileformat', |
| 236 | \ 'gitbranch': 'MyBranchname', | 242 | \ 'gitbranch': 'MyBranchname', |
| 243 | \ 'getcwd': 'getcwd', | ||
| 237 | \ }, | 244 | \ }, |
| 238 | \ } | 245 | \ } |
| 239 | 246 | ||
| 240 | 247 | " lightline#palette() | |
| 241 | |||
| 242 | |||
| 243 | |||
| 244 | |||
| 245 | |||
| 246 | 248 | ||
| 247 | " Plug 'vim-airline/vim-airline' | " beautification of the mode line | 249 | " Plug 'vim-airline/vim-airline' | " beautification of the mode line |
| 248 | " let g:airline_section_c = "%F" | " was: %F | 250 | " let g:airline_section_c = "%F" | " was: %F |
| @@ -390,7 +392,7 @@ function! ExtendColorTheme() | |||
| 390 | highlight! CursorLineNr cterm=inverse | " ctermbg=black ctermfg=NONE | 392 | highlight! CursorLineNr cterm=inverse | " ctermbg=black ctermfg=NONE |
| 391 | highlight! Pmenu ctermbg=LightYellow ctermfg=blue | 393 | highlight! Pmenu ctermbg=LightYellow ctermfg=blue |
| 392 | highlight! PmenuSel ctermbg=blue ctermfg=LightYellow cterm=bold | 394 | highlight! PmenuSel ctermbg=blue ctermfg=LightYellow cterm=bold |
| 393 | 395 | ||
| 394 | highlight! link PmenuSbar Pmenu | 396 | highlight! link PmenuSbar Pmenu |
| 395 | highlight! PmenuThumb cterm=inverse | 397 | highlight! PmenuThumb cterm=inverse |
| 396 | highlight! MoreMsg cterm=inverse | 398 | highlight! MoreMsg cterm=inverse |
| @@ -400,7 +402,7 @@ function! ExtendColorTheme() | |||
| 400 | highlight! SpellBad ctermbg=none | 402 | highlight! SpellBad ctermbg=none |
| 401 | highlight! SpecialKey ctermfg=19 | 403 | highlight! SpecialKey ctermfg=19 |
| 402 | highlight! WhiteSpace ctermfg=19 | 404 | highlight! WhiteSpace ctermfg=19 |
| 403 | 405 | ||
| 404 | highlight! link TabLine LineNr | 406 | highlight! link TabLine LineNr |
| 405 | highlight! TabLineSel ctermbg=blue ctermfg=black | 407 | highlight! TabLineSel ctermbg=blue ctermfg=black |
| 406 | highlight! link TabLineFill LineNr | 408 | highlight! link TabLineFill LineNr |
| @@ -534,7 +536,7 @@ if has("autocmd") | |||
| 534 | function OnConfigChange() | 536 | function OnConfigChange() |
| 535 | autocmd! |" Remove all vimrc autocommands | 537 | autocmd! |" Remove all vimrc autocommands |
| 536 | source $MYVIMRC | 538 | source $MYVIMRC |
| 537 | AirlineRefresh | 539 | " AirlineRefresh |
| 538 | endfunction | 540 | endfunction |
| 539 | autocmd BufWritePost $MYVIMRC call OnConfigChange() | 541 | autocmd BufWritePost $MYVIMRC call OnConfigChange() |
| 540 | endif | 542 | endif |
| @@ -746,9 +748,11 @@ function! HighlightWordUnderCursor() | |||
| 746 | endif | 748 | endif |
| 747 | let l:currentword = escape(expand('<cword>'), '.') | 749 | let l:currentword = escape(expand('<cword>'), '.') |
| 748 | if(strlen(l:currentword) > 0) | 750 | if(strlen(l:currentword) > 0) |
| 749 | let w:m1=matchadd('WordBold', l:currentword, -1, 100) | 751 | let w:m1=100 |
| 752 | silent! call matchadd('WordBold', l:currentword, -1, w:m1) | ||
| 750 | endif | 753 | endif |
| 751 | endfunction | 754 | endfunction |
| 755 | |||
| 752 | autocmd! CursorHold,CursorHoldI * call HighlightWordUnderCursor() | 756 | autocmd! CursorHold,CursorHoldI * call HighlightWordUnderCursor() |
| 753 | if version >= 702 " clean up (see: http://vim.wikia.com/wiki/VimTip396) | 757 | if version >= 702 " clean up (see: http://vim.wikia.com/wiki/VimTip396) |
| 754 | autocmd BufWinLeave * call clearmatches() | 758 | autocmd BufWinLeave * call clearmatches() |
