From 2f3d9964d909fb367252a5db3f1f33dd2e9b6091 Mon Sep 17 00:00:00 2001 From: Max Christian Pohle Date: Sun, 11 Jun 2017 17:51:05 +0200 Subject: Improved performance By using variables instead of recalculating the values shown in lightline --- compton.conf | 2 +- vimrc-full | 36 ++++++++++++++++++++---------------- 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: #opacity-rule = ["90:class_g = 'URxvt'", "90:class_g = ''" ]; -opacity-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'" ]; +opacity-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 set number | " turn line numbers on/off (performance decreases when they are shown) set pumheight=8 | " Determines the maximum number of items to show in the popup menu for set path+=** | " allow recursive searches for files -set redrawtime=400 | " The time in milliseconds for redrawing the display. +set redrawtime=100 | " The time in milliseconds for redrawing the display. " set restorescreen | " restores the console after exiting vim " set shada+=n~/.vim/shada | " shada file to use 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 let g:lightline_buffer_reservelen = 20 function! MyFiletype() - return winwidth(0) > 70 ? (strlen(&filetype) ? &filetype . ' ' . WebDevIconsGetFileTypeSymbol() : 'no ft') : '' + if(exists('b:filetype')) + return b:filetype + else + return &filetype endfunction +autocmd BufEnter * let b:filetype = winwidth(0) > 70 ? (strlen(&filetype) ? &filetype . ' ' . WebDevIconsGetFileTypeSymbol() : 'no ft') : '' function! MyFileformat() - return winwidth(0) > 70 ? (&fileformat . ' ' . WebDevIconsGetFileFormatSymbol()) : '' + return exists('b:fileformat') ? b:fileformat : &fileformat endfunction +autocmd BufEnter * let b:fileformat = winwidth(0) > 70 ? (&fileformat . ' ' . WebDevIconsGetFileFormatSymbol()) : '' function! MyBranchname() - return winwidth(0) > 70 ? fugitive#statusline() : '' + return exists('b:branchname') ? b:branchname : '' endfunction +autocmd BufEnter * let b:branchname = winwidth(0) > 70 ? fugitive#statusline() : '' let g:lightline = { - \ 'colorscheme': 'base16', + \ 'colorscheme': 'Tomorrow', \ 'separator': { 'left': "\ue0b0", 'right': "\ue0b2" }, \ 'subseparator': { 'left': "\ue0b1", 'right': "\ue0b3" }, \ 'active': { @@ -219,7 +225,7 @@ let g:lightline = { \ }, \ 'tabline': { \ 'left': [ [ 'bufferinfo' ], [ 'bufferbefore', 'buffercurrent', 'bufferafter' ], ], - \ 'right': [ [ 'close' ], ], + \ 'right': [ [ 'getcwd', 'close' ] ], \ }, \ 'component_expand': { \ 'buffercurrent': 'lightline#buffer#buffercurrent2', @@ -234,15 +240,11 @@ let g:lightline = { \ 'filetype': 'MyFiletype', \ 'fileformat': 'MyFileformat', \ 'gitbranch': 'MyBranchname', + \ 'getcwd': 'getcwd', \ }, \ } - - - - - - +" lightline#palette() " Plug 'vim-airline/vim-airline' | " beautification of the mode line " let g:airline_section_c = "%F" | " was: %F @@ -390,7 +392,7 @@ function! ExtendColorTheme() highlight! CursorLineNr cterm=inverse | " ctermbg=black ctermfg=NONE highlight! Pmenu ctermbg=LightYellow ctermfg=blue highlight! PmenuSel ctermbg=blue ctermfg=LightYellow cterm=bold - + highlight! link PmenuSbar Pmenu highlight! PmenuThumb cterm=inverse highlight! MoreMsg cterm=inverse @@ -400,7 +402,7 @@ function! ExtendColorTheme() highlight! SpellBad ctermbg=none highlight! SpecialKey ctermfg=19 highlight! WhiteSpace ctermfg=19 - + highlight! link TabLine LineNr highlight! TabLineSel ctermbg=blue ctermfg=black highlight! link TabLineFill LineNr @@ -534,7 +536,7 @@ if has("autocmd") function OnConfigChange() autocmd! |" Remove all vimrc autocommands source $MYVIMRC - AirlineRefresh + " AirlineRefresh endfunction autocmd BufWritePost $MYVIMRC call OnConfigChange() endif @@ -746,9 +748,11 @@ function! HighlightWordUnderCursor() endif let l:currentword = escape(expand(''), '.') if(strlen(l:currentword) > 0) - let w:m1=matchadd('WordBold', l:currentword, -1, 100) + let w:m1=100 + silent! call matchadd('WordBold', l:currentword, -1, w:m1) endif endfunction + autocmd! CursorHold,CursorHoldI * call HighlightWordUnderCursor() if version >= 702 " clean up (see: http://vim.wikia.com/wiki/VimTip396) autocmd BufWinLeave * call clearmatches() -- cgit v1.2.3