Bladeren bron

Fix repeats in colour scheme settings, reduce scroll off

High scroll off value was getting annoying using Goyo and
lower-resolution screens. Colour scheme settings now conditionally set
the airline theme variable or call the airline theme function based on
availablility, since the theme function is not available on vim startup.
Weiyi Lou 10 jaren geleden
bovenliggende
commit
39f0a490de
2 gewijzigde bestanden met toevoegingen van 17 en 15 verwijderingen
  1. 15 13
      vim/settings/colorscheme-statusline.vim
  2. 2 2
      vim/vimrc

+ 15 - 13
vim/settings/colorscheme-statusline.vim

@@ -10,31 +10,32 @@ set t_ut=
 
 " Status line defaults.
 let g:airline_powerline_fonts = 1
-let g:airline_theme = 'powerlineish'
 set laststatus=2 " always show the status line.
 set noshowmode   " hide modes e.g. --INSERT-- with themed status lines.
 
-" Colour scheme defaults.
-set background=dark
-colorscheme flattened_dark
-" fix sign column colour in flattened_dark (for vim-signature, syntastic).
-highlight SignColumn ctermbg=235
-
 function! NormalPower()
   set background=dark
   colorscheme flattened_dark
-  AirlineTheme powerlineish
-  highlight SignColumn ctermbg=235
+  call SetTheme('powerlineish')
   call MuteSpellCheckHighlights()
-  echo "System at normal power..."
+  " fix sign column colour in flattened_dark (for vim-signature, syntastic).
+  highlight SignColumn ctermbg=235
 endfunction
 
 function! UltraPower()
   set background=dark
   colorscheme neonwave
-  AirlineTheme surarken
+  call SetTheme('surarken')
   call MuteSpellCheckHighlights()
-  echo "Ultra Power Level Activated!"
+endfunction
+
+function! SetTheme(name)
+  " Airline functions are not available at vim start.
+  if exists(':AirlineTheme')
+    exec 'AirlineTheme' a:name
+  else
+    let g:airline_theme = a:name
+  endif
 endfunction
 
 function! MuteSpellCheckHighlights()
@@ -48,4 +49,5 @@ function! MuteSpellCheckHighlights()
   hi clear SpellRare
   hi link SpellRare SpellBad
 endfunction
-call MuteSpellCheckHighlights()
+
+call NormalPower()

+ 2 - 2
vim/vimrc

@@ -42,9 +42,9 @@ set wildmenu                   " Show list instead of just completing
 set modeline                   " Support vim modelines at the top of files
 set whichwrap=b,s,h,l,<,>,[,]  " Backspace and cursor keys wrap too
 set shortmess+=filmnrxoOtT     " Abbrev. of messages (avoids 'hit enter')
-set scrolloff=10               " Minimum lines to keep above and below cursor
+set scrolloff=5                " Minimum lines to keep above and below cursor
 set sidescroll=1
-set sidescrolloff=15
+set sidescrolloff=10
 set linebreak                  " Break on words when wrapping.
 
 set list