aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Christian Pohle2017-06-11 17:51:05 +0200
committerMax Christian Pohle2017-06-11 17:51:05 +0200
commit2f3d9964d909fb367252a5db3f1f33dd2e9b6091 (patch)
tree874376b5dfb084af435dcd4f24c1cf2bbafdcbc1
parenta8e6896e6ef75e9133aa897dc41704e4986e45f7 (diff)
downloadvim-2f3d9964d909fb367252a5db3f1f33dd2e9b6091.tar.bz2
vim-2f3d9964d909fb367252a5db3f1f33dd2e9b6091.zip
Improved performance
By using variables instead of recalculating the values shown in lightline
-rw-r--r--compton.conf2
-rw-r--r--vimrc-full36
2 files changed, 21 insertions, 17 deletions
diff --git a/compton.conf b/compton.conf
index f83ce40..1d3025d 100644
--- a/compton.conf
+++ b/compton.conf
@@ -61,4 +61,4 @@ wintypes:
61#opacity-rule = ["90:class_g = 'URxvt'", "90:class_g = ''" ]; 61#opacity-rule = ["90:class_g = 'URxvt'", "90:class_g = ''" ];
62 62
63 63
64opacity-rule = ["90:class_g = 'xfce4-terminal'", "90: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'" ]; 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/vimrc-full b/vimrc-full
index a4b0c21..1a6284f 100644
--- a/vimrc-full
+++ b/vimrc-full
@@ -53,7 +53,7 @@ set nowrap | " but do not (by default) wrap long lines around
53set number | " turn line numbers on/off (performance decreases when they are shown) 53set number | " turn line numbers on/off (performance decreases when they are shown)
54set pumheight=8 | " Determines the maximum number of items to show in the popup menu for 54set pumheight=8 | " Determines the maximum number of items to show in the popup menu for
55set path+=** | " allow recursive searches for files 55set path+=** | " allow recursive searches for files
56set redrawtime=400 | " The time in milliseconds for redrawing the display. 56set 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
59set scrolljump=5 | " how many lines get scrolled into view when cursor reaches the screens edge 59set 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
195let g:lightline_buffer_reservelen = 20 195let g:lightline_buffer_reservelen = 20
196 196
197function! MyFiletype() 197function! 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
199endfunction 202endfunction
203autocmd BufEnter * let b:filetype = winwidth(0) > 70 ? (strlen(&filetype) ? &filetype . ' ' . WebDevIconsGetFileTypeSymbol() : 'no ft') : ''
200 204
201function! MyFileformat() 205function! MyFileformat()
202 return winwidth(0) > 70 ? (&fileformat . ' ' . WebDevIconsGetFileFormatSymbol()) : '' 206 return exists('b:fileformat') ? b:fileformat : &fileformat
203endfunction 207endfunction
208autocmd BufEnter * let b:fileformat = winwidth(0) > 70 ? (&fileformat . ' ' . WebDevIconsGetFileFormatSymbol()) : ''
204 209
205function! MyBranchname() 210function! MyBranchname()
206 return winwidth(0) > 70 ? fugitive#statusline() : '' 211 return exists('b:branchname') ? b:branchname : ''
207endfunction 212endfunction
213autocmd BufEnter * let b:branchname = winwidth(0) > 70 ? fugitive#statusline() : ''
208 214
209let g:lightline = { 215let 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
751endfunction 754endfunction
755
752autocmd! CursorHold,CursorHoldI * call HighlightWordUnderCursor() 756autocmd! CursorHold,CursorHoldI * call HighlightWordUnderCursor()
753if version >= 702 " clean up (see: http://vim.wikia.com/wiki/VimTip396) 757if version >= 702 " clean up (see: http://vim.wikia.com/wiki/VimTip396)
754 autocmd BufWinLeave * call clearmatches() 758 autocmd BufWinLeave * call clearmatches()
..