1
0
mirror of https://github.com/amix/vimrc synced 2025-06-29 11:04:59 +08:00

Updated vimrc

This commit is contained in:
amix
2015-07-13 11:22:46 +01:00
parent 9a2843c2a5
commit d7752b59ae
301 changed files with 4699 additions and 7969 deletions

View File

@ -7,7 +7,12 @@ Lean & mean status/tabline for vim that's light as air.
# Features
* Tiny core written with extensibility in mind ([open/closed principle][8]).
* Integrates with a variety of plugins, including: [vim-bufferline][6], [fugitive][4], [unite][9], [ctrlp][10], [minibufexpl][15], [gundo][16], [undotree][17], [nerdtree][18], [tagbar][19], [vim-gitgutter][29], [vim-signify][30], [syntastic][5], [eclim][34], [lawrencium][21], [virtualenv][31], [tmuxline][35], [taboo.vim][37], [ctrlspace][38] and more.
* Integrates with a variety of plugins, including: [vim-bufferline][6],
[fugitive][4], [unite][9], [ctrlp][10], [minibufexpl][15], [gundo][16],
[undotree][17], [nerdtree][18], [tagbar][19], [vim-gitgutter][29],
[vim-signify][30], [quickfixsigns][39], [syntastic][5], [eclim][34],
[lawrencium][21], [virtualenv][31], [tmuxline][35], [taboo.vim][37],
[ctrlspace][38] and more.
* Looks good with regular fonts and provides configuration points so you can use unicode or powerline symbols.
* Optimized for speed; it loads in under a millisecond.
* Extensive suite of themes for popular color schemes including [solarized][23] (dark and light), [tomorrow][24] (all variants), [base16][32] (all variants), [molokai][25], [jellybeans][26] and others; have a look at the [screenshots][14] in the wiki.
@ -223,3 +228,4 @@ MIT License. Copyright (c) 2013-2015 Bailey Ling.
[36]: https://github.com/edkolev/promptline.vim
[37]: https://github.com/gcmt/taboo.vim
[38]: https://github.com/szw/vim-ctrlspace
[39]: https://github.com/tomtom/quickfixsigns_vim

View File

@ -142,6 +142,8 @@ function! airline#check_mode(winnr)
let l:mode = ['replace']
elseif l:m =~# '\v(v|V||s|S|)'
let l:mode = ['visual']
elseif l:m ==# "t"
let l:mode = ['terminal']
else
let l:mode = ['normal']
endif
@ -159,6 +161,10 @@ function! airline#check_mode(winnr)
call add(l:mode, 'paste')
endif
if g:airline_detect_crypt && exists("+key") && !empty(&key)
call add(l:mode, 'crypt')
endif
if &readonly || ! &modifiable
call add(l:mode, 'readonly')
endif

View File

@ -159,7 +159,7 @@ function! airline#extensions#load()
endif
if (get(g:, 'airline#extensions#hunks#enabled', 1) && get(g:, 'airline_enable_hunks', 1))
\ && (exists('g:loaded_signify') || exists('g:loaded_gitgutter') || exists('g:loaded_changes'))
\ && (exists('g:loaded_signify') || exists('g:loaded_gitgutter') || exists('g:loaded_changes') || exists('g:loaded_quickfixsigns'))
call airline#extensions#hunks#init(s:ext)
endif

View File

@ -1,7 +1,7 @@
" MIT License. Copyright (c) 2013-2015 Bailey Ling.
" vim: et ts=2 sts=2 sw=2
if !get(g:, 'loaded_signify', 0) && !get(g:, 'loaded_gitgutter', 0) && !get(g:, 'loaded_changes', 0)
if !get(g:, 'loaded_signify', 0) && !get(g:, 'loaded_gitgutter', 0) && !get(g:, 'loaded_changes', 0) && !get(g:, 'loaded_quickfixsigns', 0)
finish
endif
@ -53,6 +53,8 @@ function! s:get_hunks()
let s:source_func = 's:get_hunks_gitgutter'
elseif exists('*changes#GetStats')
let s:source_func = 's:get_hunks_changes'
elseif exists('*quickfixsigns#vcsdiff#GetHunkSummary')
let s:source_func = 'quickfixsigns#vcsdiff#GetHunkSummary'
else
let s:source_func = 's:get_hunks_empty'
endif

View File

@ -2,6 +2,7 @@
" vim: et ts=2 sts=2 sw=2
let s:excludes = get(g:, 'airline#extensions#tabline#excludes', [])
let s:exclude_preview = get(g:, 'airline#extensions#tabline#exclude_preview', 1)
function! airline#extensions#tabline#buflist#invalidate()
unlet! s:current_buffer_list
@ -26,6 +27,9 @@ function! airline#extensions#tabline#buflist#list()
if getbufvar(nr, 'current_syntax') == 'qf'
let toadd = 0
endif
if s:exclude_preview && getbufvar(nr, '&bufhidden') == 'wipe' && getbufvar(nr, '&buftype') == 'nofile'
let toadd = 0
endif
if toadd
call add(buffers, nr)
endif

View File

@ -3,6 +3,7 @@
let s:fmod = get(g:, 'airline#extensions#tabline#fnamemod', ':~:.')
let s:fnamecollapse = get(g:, 'airline#extensions#tabline#fnamecollapse', 1)
let s:fnametruncate = get(g:, 'airline#extensions#tabline#fnametruncate', 0)
let s:buf_nr_format = get(g:, 'airline#extensions#tabline#buffer_nr_format', '%s: ')
let s:buf_nr_show = get(g:, 'airline#extensions#tabline#buffer_nr_show', 0)
let s:buf_modified_symbol = g:airline_symbols.modified
@ -19,6 +20,9 @@ function! airline#extensions#tabline#formatters#default#format(bufnr, buffers)
else
let _ .= fnamemodify(name, s:fmod)
endif
if a:bufnr != bufnr('%') && s:fnametruncate && strlen(_) > s:fnametruncate
let _ = strpart(_, 0, s:fnametruncate)
endif
endif
return airline#extensions#tabline#formatters#default#wrap_name(a:bufnr, _)

View File

@ -10,7 +10,7 @@ function! airline#extensions#tabline#formatters#unique_tail#format(bufnr, buffer
if empty(name)
let map[nr] = '[No Name]'
else
let tail = fnamemodify(name, ':t')
let tail = fnamemodify(name, ':s?/\+$??:t')
if has_key(tails, tail)
let duplicates[nr] = nr
endif

View File

@ -27,9 +27,11 @@ function! s:check_mixed_indent()
" spaces before or between tabs are not allowed
let t_s_t = '(^\t* +\t\s*\S)'
" <tab>(<space> x count)
" count of spaces at the end of tabs should be less then tabstop value
" count of spaces at the end of tabs should be less than tabstop value
let t_l_s = '(^\t+ {' . &ts . ',}' . '\S)'
return search('\v' . t_s_t . '|' . t_l_s, 'nw')
elseif s:indent_algo == 2
return search('\v(^\t* +\t\s*\S)', 'nw')
else
return search('\v(^\t+ +)|(^ +\t+)', 'nw')
endif

View File

@ -15,13 +15,13 @@ function! airline#init#bootstrap()
let s:loaded = 1
let g:airline#init#bootstrapping = 1
call s:check_defined('g:airline_left_sep', get(g:, 'airline_powerline_fonts', 0)?"\ue0b0":">")
call s:check_defined('g:airline_left_alt_sep', get(g:, 'airline_powerline_fonts', 0)?"\ue0b1":">")
call s:check_defined('g:airline_right_sep', get(g:, 'airline_powerline_fonts', 0)?"\ue0b2":"<")
call s:check_defined('g:airline_right_alt_sep', get(g:, 'airline_powerline_fonts', 0)?"\ue0b3":"<")
call s:check_defined('g:airline_detect_modified', 1)
call s:check_defined('g:airline_detect_paste', 1)
call s:check_defined('g:airline_detect_crypt', 1)
call s:check_defined('g:airline_detect_iminsert', 0)
call s:check_defined('g:airline_inactive_collapse', 1)
call s:check_defined('g:airline_exclude_filenames', ['DebuggerWatch','DebuggerStack','DebuggerStatus'])
@ -41,6 +41,7 @@ function! airline#init#bootstrap()
\ 's' : 'SELECT',
\ 'S' : 'S-LINE',
\ '' : 'S-BLOCK',
\ 't' : 'TERMINAL',
\ }, 'keep')
call s:check_defined('g:airline_theme_map', {})
@ -62,6 +63,7 @@ function! airline#init#bootstrap()
\ 'branch': get(g:, 'airline_branch_prefix', get(g:, 'airline_powerline_fonts', 0) ? "\ue0a0" : ''),
\ 'modified': '+',
\ 'space': ' ',
\ 'crypt': get(g:, 'airline_crypt_symbol', nr2char(0x1F512)),
\ }, 'keep')
call airline#parts#define('mode', {
@ -70,6 +72,7 @@ function! airline#init#bootstrap()
\ })
call airline#parts#define_function('iminsert', 'airline#parts#iminsert')
call airline#parts#define_function('paste', 'airline#parts#paste')
call airline#parts#define_function('crypt', 'airline#parts#crypt')
call airline#parts#define_function('filetype', 'airline#parts#filetype')
call airline#parts#define('readonly', {
\ 'function': 'airline#parts#readonly',
@ -87,7 +90,7 @@ endfunction
function! airline#init#sections()
let spc = g:airline_symbols.space
if !exists('g:airline_section_a')
let g:airline_section_a = airline#section#create_left(['mode', 'paste', 'capslock', 'iminsert'])
let g:airline_section_a = airline#section#create_left(['mode', 'crypt', 'paste', 'capslock', 'iminsert'])
endif
if !exists('g:airline_section_b')
let g:airline_section_b = airline#section#create(['hunks', 'branch'])

View File

@ -54,6 +54,10 @@ function! airline#parts#mode()
return get(w:, 'airline_current_mode', '')
endfunction
function! airline#parts#crypt()
return g:airline_detect_crypt && exists("+key") && !empty(&key) ? g:airline_symbols.crypt : ''
endfunction
function! airline#parts#paste()
return g:airline_detect_paste && &paste ? g:airline_symbols.paste : ''
endfunction

View File

@ -101,6 +101,35 @@ else
let g:airline#themes#base16#palette.inactive_modified = {
\ 'airline_c': [ group[0], '', group[2], '', '' ]
\ }
" Warnings
let s:WI = airline#themes#get_highlight2(['WarningMsg', 'bg'], ['WarningMsg', 'fg'], 'bold')
let g:airline#themes#base16#palette.normal.airline_warning = [
\ s:WI[0], s:WI[1], s:WI[2], s:WI[3]
\ ]
let g:airline#themes#base16#palette.normal_modified.airline_warning =
\ g:airline#themes#base16#palette.normal.airline_warning
let g:airline#themes#base16#palette.insert.airline_warning =
\ g:airline#themes#base16#palette.normal.airline_warning
let g:airline#themes#base16#palette.insert_modified.airline_warning =
\ g:airline#themes#base16#palette.normal.airline_warning
let g:airline#themes#base16#palette.visual.airline_warning =
\ g:airline#themes#base16#palette.normal.airline_warning
let g:airline#themes#base16#palette.visual_modified.airline_warning =
\ g:airline#themes#base16#palette.normal.airline_warning
let g:airline#themes#base16#palette.replace.airline_warning =
\ g:airline#themes#base16#palette.normal.airline_warning
let g:airline#themes#base16#palette.replace_modified.airline_warning =
\ g:airline#themes#base16#palette.normal.airline_warning
endfunction
call airline#themes#base16#refresh()
endif

View File

@ -0,0 +1,57 @@
let g:airline#themes#behelit#palette = {}
" Normal mode
let s:N1 = [ '#121212', '#5f87ff', 233, 69 ]
let s:N2 = [ '#5f87ff', '#262626', 69 , 235 ]
let s:N3 = [ '#5f87ff', '#1c1c1c', 69 , 234, 'bold' ]
let g:airline#themes#behelit#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3)
let g:airline#themes#behelit#palette.normal_modified = {
\ 'airline_c': [ '#d7005f', '#1c1c1c', 161, 234, 'bold' ],
\ }
" Insert mode
let s:I1 = [ '#121212', '#00ff87', 233, 48 ]
let s:I2 = s:N2
let s:I3 = s:N3
let g:airline#themes#behelit#palette.insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3)
let g:airline#themes#behelit#palette.insert_modified = g:airline#themes#behelit#palette.normal_modified
let g:airline#themes#behelit#palette.insert_paste = {
\ 'airline_a': [ "#121212", "#5f5faf", 233, 61, '' ],
\ }
" Replace mode
let g:airline#themes#behelit#palette.replace = copy(g:airline#themes#behelit#palette.insert)
let g:airline#themes#behelit#palette.replace.airline_a = [ s:I1[0], '#d70057', s:I1[2], 161, '' ]
let g:airline#themes#behelit#palette.replace_modified = g:airline#themes#behelit#palette.insert_modified
" Visual mode
let s:V1 = [ '#121212', '#5fff5f', 233, 83 ]
let s:V2 = s:N2
let s:V3 = s:N3
let g:airline#themes#behelit#palette.visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3)
let g:airline#themes#behelit#palette.visual_modified = g:airline#themes#behelit#palette.normal_modified
" Inactive window
let s:IA1 = [ '#4e4e4e', '#1c1c1c', 239, 234, '' ]
let s:IA2 = [ '#4e4e4e', '#262626', 239, 235, '' ]
let s:IA3 = [ '#4e4e4e', '#1c1c1c', 239, 234, 'bold' ]
let g:airline#themes#behelit#palette.inactive = airline#themes#generate_color_map(s:IA1, s:IA2, s:IA3)
let g:airline#themes#behelit#palette.inactive_modified = {
\ 'airline_c': [ '#5f5f87', '#1c1c1c', 60, 234, 'bold' ],
\ }
" Accents
let g:airline#themes#behelit#palette.accents = {
\ 'red': [ '#d7005f', '', 161, '' ]
\ }
" Warnings
let s:WI = [ '#121212', '#d7005f', 233, 161 ]
let g:airline#themes#behelit#palette.normal.airline_warning = s:WI
let g:airline#themes#behelit#palette.normal_modified.airline_warning = s:WI
let g:airline#themes#behelit#palette.insert.airline_warning = s:WI
let g:airline#themes#behelit#palette.insert_modified.airline_warning = s:WI
let g:airline#themes#behelit#palette.visual.airline_warning = s:WI
let g:airline#themes#behelit#palette.visual_modified.airline_warning = s:WI
let g:airline#themes#behelit#palette.replace.airline_warning = s:WI
let g:airline#themes#behelit#palette.replace_modified.airline_warning = s:WI

View File

@ -0,0 +1,65 @@
let g:airline#themes#papercolor#palette = {}
let g:airline#themes#papercolor#palette.accents = {
\ 'red': [ '#66d9ef' , '' , 81 , '' , '' ],
\ }
" Normal Mode:
let s:N1 = [ '#585858' , '#e4e4e4' , 240 , 254 ] " Mode
let s:N2 = [ '#e4e4e4' , '#0087af' , 254 , 31 ] " Info
let s:N3 = [ '#eeeeee' , '#005f87' , 255 , 24 ] " StatusLine
let g:airline#themes#papercolor#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3)
let g:airline#themes#papercolor#palette.normal_modified = {
\ 'airline_c': [ '#eeeeee' , '#005f87' , 255 , 24 , '' ] ,
\ }
" Insert Mode:
let s:I1 = [ '#585858' , '#e4e4e4' , 240 , 254 ] " Mode
let s:I2 = [ '#e4e4e4' , '#0087af' , 254 , 31 ] " Info
let s:I3 = [ '#eeeeee' , '#005f87' , 255 , 24 ] " StatusLine
let g:airline#themes#papercolor#palette.insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3)
let g:airline#themes#papercolor#palette.insert_modified = {
\ 'airline_c': [ '#eeeeee' , '#005f87' , 255 , 24 , '' ] ,
\ }
" Replace Mode:
let g:airline#themes#papercolor#palette.replace = copy(g:airline#themes#papercolor#palette.insert)
let g:airline#themes#papercolor#palette.replace.airline_a = [ '#d7005f' , '#e4e4e4' , 161 , 254, '' ]
let g:airline#themes#papercolor#palette.replace_modified = {
\ 'airline_c': [ '#eeeeee' , '#005f87' , 255 , 24 , '' ] ,
\ }
" Visual Mode:
let s:V1 = [ '#005f87', '#e4e4e4', 24, 254 ]
let s:V2 = [ '', '#0087af', '', 31 ]
let s:V3 = [ '#e4e4e4', '#005f87', 254, 24 ]
let g:airline#themes#papercolor#palette.visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3)
let g:airline#themes#papercolor#palette.visual_modified = {
\ 'airline_c': [ '#e4e4e4', '#005f87', 254, 24 ] ,
\ }
" Inactive:
let s:IA = [ '#585858' , '#e4e4e4' , 240 , 254 , '' ]
let g:airline#themes#papercolor#palette.inactive = airline#themes#generate_color_map(s:IA, s:IA, s:IA)
let g:airline#themes#papercolor#palette.inactive_modified = {
\ 'airline_c': [ '#585858' , '#e4e4e4' , 240 , 254 , '' ] ,
\ }
" CtrlP:
if !get(g:, 'loaded_ctrlp', 0)
finish
endif
let g:airline#themes#papercolor#palette.ctrlp = airline#extensions#ctrlp#generate_color_map(
\ [ '#e4e4e4' , '#005f87' , 254 , 24 , '' ] ,
\ [ '#e4e4e4' , '#0087af' , 254 , 31 , '' ] ,
\ [ '#585858' , '#e4e4e4' , 240 , 254 , 'bold' ] )

View File

@ -70,6 +70,9 @@ values):
* enable paste detection >
let g:airline_detect_paste=1
<
* enable crypt detection >
let g:airline_detect_crypt=1
<
* enable iminsert detection >
let g:airline_detect_iminsert=0
<
@ -162,10 +165,10 @@ Airline comes with some user-defined autocommands.
CUSTOMIZATION *airline-customization*
The following are some unicode symbols for customizing the left/right
separators, as well as the powerline font glyths.
separators, as well as the powerline font glyphs.
Note: You must define the dictionary first before setting values. Also, it's a
good idea to check whether if it exists as to avoid accidentally overwritting
good idea to check whether it exists as to avoid accidentally overwriting
its contents. >
if !exists('g:airline_symbols')
let g:airline_symbols = {}
@ -176,6 +179,7 @@ its contents. >
let g:airline_left_sep = '▶'
let g:airline_right_sep = '«'
let g:airline_right_sep = '◀'
let g:airline_symbols.crypt = '🔒'
let g:airline_symbols.linenr = '␊'
let g:airline_symbols.linenr = '␤'
let g:airline_symbols.linenr = '¶'
@ -214,7 +218,7 @@ section.
>
variable names default contents
----------------------------------------------------------------------------
let g:airline_section_a (mode, paste, iminsert)
let g:airline_section_a (mode, crypt, paste, iminsert)
let g:airline_section_b (hunks, branch)
let g:airline_section_c (bufferline or filename)
let g:airline_section_gutter (readonly, csv)
@ -235,7 +239,7 @@ Most extensions are enabled by default and lazily loaded when the
corresponding plugin (if any) is detected.
By default, airline will attempt to load any extension it can find in the
'runtimepath'. On some systems this can result in an undersirable startup
'runtimepath'. On some systems this can result in an undesirable startup
cost. You can disable the check with the following flag. >
let g:airline#extensions#disable_rtp_load = 1
<
@ -267,7 +271,7 @@ configuration values that you can use.
" Note: set to an empty dictionary to disable truncation.
let g:airline#extensions#default#section_truncate_width = {}
<
* configure the layout of the sections by specificing an array of two arrays
* configure the layout of the sections by specifying an array of two arrays
(first array is the left side, second array is the right side). >
let g:airline#extensions#default#layout = [
\ [ 'a', 'b', 'c' ],
@ -358,6 +362,7 @@ csv.vim <https://github.com/chrisbra/csv.vim>
vim-gitgutter <https://github.com/airblade/vim-gitgutter>
vim-signify <https://github.com/mhinz/vim-signify>
changesPlugin <https://github.com/chrisbra/changesPlugin>
quickfixsigns <https://github.com/tomtom/quickfixsigns_vim>
* enable/disable showing a summary of changed hunks under source control. >
let g:airline#extensions#hunks#enabled = 1
@ -407,6 +412,11 @@ eclim <https://eclim.org>
" certain number of spaces are allowed after tabs, but not in between
" this algorithm works well for /** */ style comments in a tab-indented file
let g:airline#extensions#whitespace#mixed_indent_algo = 1
" spaces are allowed after tabs, but not in between
" this algorithm works well with programming styles that use tabs for
" indentation and spaces for alignment
let g:airline#extensions#whitespace#mixed_indent_algo = 2
<
* customize the whitespace symbol. >
let g:airline#extensions#whitespace#symbol = '!'
@ -436,7 +446,10 @@ eclim <https://eclim.org>
<
* configure filename match rules to exclude from the tabline. >
let g:airline#extensions#tabline#excludes = []
<
* enable/disable display preview window buffer in the tabline.
let g:airline#extensions#tabline#exclude_preview = 1
* configure how numbers are displayed in tab mode. >
let g:airline#extensions#tabline#tab_nr_type = 0 " # of splits (default)
let g:airline#extensions#tabline#tab_nr_type = 1 " tab number
@ -489,6 +502,9 @@ exposed.
<
* configure collapsing parent directories in buffer name. >
let g:airline#extensions#tabline#fnamecollapse = 1
<
* configure truncating non-active buffer names to specified length. >
let g:airline#extensions#tabline#fnametruncate = 0
" The `unique_tail` algorithm will display the tail of the filename, unless
" there is another file of the same name, in which it will display it along
@ -598,7 +614,7 @@ vim-ctrlspace <https://github.com/szw/vim-ctrlspace>
==============================================================================
ADVANCED CUSTOMIZATION *airline-advanced-customization*
The defaults will accomodate the mass majority of users with minimal
The defaults will accommodate the mass majority of users with minimal
configuration. However, if you want to reposition sections or contents you can
do so with built-in helper functions, which makes it possible to create
sections in a more declarative style.
@ -630,6 +646,7 @@ Before is a list of parts that are predefined by vim-airline.
* `mode` displays the current mode
* `iminsert` displays the current insert method
* `paste` displays the paste indicator
* crypt displays the crypted indicator
* `filetype` displays the file type
* `readonly` displays the read only indicator
* `file` displays the filename and modified indicator
@ -692,7 +709,7 @@ the most powerful way to customize the statusline, and sometimes it may be
easier to go this route than the above methods.
Every section can have two values. The default value is the global `g:`
variable which is used in the absense of a `w:` value. This makes it very easy
variable which is used in the absence of a `w:` value. This makes it very easy
to override only certain parts of the statusline by only defining window-local
variables for a subset of all sections.

View File

@ -102,10 +102,10 @@ function! s:airline_theme(...)
endif
endfunction
command! -nargs=? -complete=customlist,<sid>get_airline_themes AirlineTheme call <sid>airline_theme(<f-args>)
command! AirlineToggleWhitespace call airline#extensions#whitespace#toggle()
command! AirlineToggle call s:airline_toggle()
command! AirlineRefresh call airline#load_theme() | call airline#update_statusline()
command! -bar -nargs=? -complete=customlist,<sid>get_airline_themes AirlineTheme call <sid>airline_theme(<f-args>)
command! -bar AirlineToggleWhitespace call airline#extensions#whitespace#toggle()
command! -bar AirlineToggle call s:airline_toggle()
command! -bar AirlineRefresh call airline#load_theme() | call airline#update_statusline()
call airline#init#bootstrap()
call s:airline_toggle()