Просмотр исходного кода

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 лет назад
Родитель
Сommit
39f0a490de
2 измененных файлов с 17 добавлено и 15 удалено
  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.
 " Status line defaults.
 let g:airline_powerline_fonts = 1
 let g:airline_powerline_fonts = 1
-let g:airline_theme = 'powerlineish'
 set laststatus=2 " always show the status line.
 set laststatus=2 " always show the status line.
 set noshowmode   " hide modes e.g. --INSERT-- with themed status lines.
 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()
 function! NormalPower()
   set background=dark
   set background=dark
   colorscheme flattened_dark
   colorscheme flattened_dark
-  AirlineTheme powerlineish
-  highlight SignColumn ctermbg=235
+  call SetTheme('powerlineish')
   call MuteSpellCheckHighlights()
   call MuteSpellCheckHighlights()
-  echo "System at normal power..."
+  " fix sign column colour in flattened_dark (for vim-signature, syntastic).
+  highlight SignColumn ctermbg=235
 endfunction
 endfunction
 
 
 function! UltraPower()
 function! UltraPower()
   set background=dark
   set background=dark
   colorscheme neonwave
   colorscheme neonwave
-  AirlineTheme surarken
+  call SetTheme('surarken')
   call MuteSpellCheckHighlights()
   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
 endfunction
 
 
 function! MuteSpellCheckHighlights()
 function! MuteSpellCheckHighlights()
@@ -48,4 +49,5 @@ function! MuteSpellCheckHighlights()
   hi clear SpellRare
   hi clear SpellRare
   hi link SpellRare SpellBad
   hi link SpellRare SpellBad
 endfunction
 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 modeline                   " Support vim modelines at the top of files
 set whichwrap=b,s,h,l,<,>,[,]  " Backspace and cursor keys wrap too
 set whichwrap=b,s,h,l,<,>,[,]  " Backspace and cursor keys wrap too
 set shortmess+=filmnrxoOtT     " Abbrev. of messages (avoids 'hit enter')
 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 sidescroll=1
-set sidescrolloff=15
+set sidescrolloff=10
 set linebreak                  " Break on words when wrapping.
 set linebreak                  " Break on words when wrapping.
 
 
 set list
 set list