Initial commit (again)
This commit is contained in:
7
.inputrc
Normal file
7
.inputrc
Normal file
@ -0,0 +1,7 @@
|
||||
set editing-mode vi
|
||||
set keymap vi-insert
|
||||
"\e[A":history-search-backward
|
||||
"\e[B":history-search-forward
|
||||
|
||||
set show-all-if-ambiguous on
|
||||
set completion-ignore-case on
|
||||
45
.tcshrc
Normal file
45
.tcshrc
Normal file
@ -0,0 +1,45 @@
|
||||
#
|
||||
# .cshrc - csh resource script, read at beginning of execution by each shell
|
||||
#
|
||||
# see also csh(1), environ(7).
|
||||
#
|
||||
|
||||
alias h history 25
|
||||
alias j jobs -l
|
||||
alias la ls -a
|
||||
alias lf ls -FA
|
||||
alias ll ls -lA
|
||||
# A righteous umask
|
||||
umask 22
|
||||
|
||||
set path = ( /sbin /bin /usr/sbin /usr/bin /usr/games /usr/local/sbin /usr/local/bin $HOME/bin)
|
||||
|
||||
setenv EDITOR vim
|
||||
setenv TERM xterm-256color
|
||||
setenv PAGER less
|
||||
setenv BLOCKSIZE K
|
||||
setenv LANG en_US.UTF-8
|
||||
|
||||
if ($?prompt) then
|
||||
# An interactive shell -- set some stuff up
|
||||
set filec
|
||||
set history = 100
|
||||
set savehist = 100
|
||||
set mail = (/var/mail/$USER)
|
||||
if ( $?tcsh ) then
|
||||
bindkey "^W" backward-delete-word
|
||||
bindkey -k up history-search-backward
|
||||
bindkey -k down history-search-forward
|
||||
set autolist
|
||||
set correct=cmd
|
||||
# set watch = (0 any any)
|
||||
set autologout=0
|
||||
set filec
|
||||
if ($uid) then
|
||||
set prompt = "%{\033[34m%}%B<%n@%{\033[31m%}%m%{\033[34m%}>%b%{\033[0m%} %~ > "
|
||||
else
|
||||
set prompt = "%{\033[31m%}%B<root@%{\033[31m%}%m%{\033[31m%}>%b%{\033[0m%} %~ # "
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
1115
.tmux.conf
Normal file
1115
.tmux.conf
Normal file
File diff suppressed because it is too large
Load Diff
297
.tmux.conf.local
Normal file
297
.tmux.conf.local
Normal file
@ -0,0 +1,297 @@
|
||||
# https://github.com/gpakosz/.tmux
|
||||
# (‑●‑●)> dual licensed under the WTFPL v2 license and the MIT license,
|
||||
# without any warranty.
|
||||
# Copyright 2012— Gregory Pakosz (@gpakosz).
|
||||
|
||||
|
||||
# -- navigation ----------------------------------------------------------------
|
||||
|
||||
# if you're running tmux within iTerm2
|
||||
# - and tmux is 1.9 or 1.9a
|
||||
# - and iTerm2 is configured to let option key act as +Esc
|
||||
# - and iTerm2 is configured to send [1;9A -> [1;9D for option + arrow keys
|
||||
# then uncomment the following line to make Meta + arrow keys mapping work
|
||||
#set -ga terminal-overrides "*:kUP3=\e[1;9A,*:kDN3=\e[1;9B,*:kRIT3=\e[1;9C,*:kLFT3=\e[1;9D"
|
||||
|
||||
# Shift arrow to switch windows
|
||||
bind -n S-Left previous-window
|
||||
bind -n S-Right next-window
|
||||
|
||||
# Use Alt-vim keys without prefix key to switch panes
|
||||
bind -n M-h select-pane -L
|
||||
bind -n M-j select-pane -D
|
||||
bind -n M-k select-pane -U
|
||||
bind -n M-l select-pane -R
|
||||
|
||||
# Use Alt-arrow keys without prefix key to switch panes
|
||||
bind -n M-Left select-pane -L
|
||||
bind -n M-Right select-pane -R
|
||||
bind -n M-Up select-pane -U
|
||||
bind -n M-Down select-pane -D
|
||||
|
||||
# Syncronize panes toggle
|
||||
bind e set-window-option synchronize-pane \; display 'Pane sync toggled'
|
||||
|
||||
#switch windows alt+number, unless we are running irssi
|
||||
bind -n M-1 if 'test `tmux list-panes -F "#W"` != "irssi"' 'select-window -t 1' 'send M-1'
|
||||
bind -n M-2 if 'test `tmux list-panes -F "#W"` != "irssi"' 'select-window -t 2' 'send M-2'
|
||||
bind -n M-3 if 'test `tmux list-panes -F "#W"` != "irssi"' 'select-window -t 3' 'send M-3'
|
||||
bind -n M-4 if 'test `tmux list-panes -F "#W"` != "irssi"' 'select-window -t 4' 'send M-4'
|
||||
bind -n M-5 if 'test `tmux list-panes -F "#W"` != "irssi"' 'select-window -t 5' 'send M-5'
|
||||
bind -n M-6 if 'test `tmux list-panes -F "#W"` != "irssi"' 'select-window -t 6' 'send M-6'
|
||||
bind -n M-7 if 'test `tmux list-panes -F "#W"` != "irssi"' 'select-window -t 7' 'send M-7'
|
||||
bind -n M-8 if 'test `tmux list-panes -F "#W"` != "irssi"' 'select-window -t 8' 'send M-8'
|
||||
bind -n M-9 if 'test `tmux list-panes -F "#W"` != "irssi"' 'select-window -t 9' 'send M-9'
|
||||
bind -n M-0 if 'test `tmux list-panes -F "#W"` != "irssi"' 'select-window -t 0' 'send M-0'
|
||||
|
||||
# -- windows & pane creation ---------------------------------------------------
|
||||
|
||||
# new window retains current path, possible values are:
|
||||
# - true
|
||||
# - false (default)
|
||||
tmux_conf_new_window_retain_current_path=false
|
||||
|
||||
# new pane retains current path, possible values are:
|
||||
# - true (default)
|
||||
# - false
|
||||
tmux_conf_new_pane_retain_current_path=true
|
||||
|
||||
# new pane tries to reconnect ssh sessions (experimental), possible values are:
|
||||
# - true
|
||||
# - false (default)
|
||||
tmux_conf_new_pane_reconnect_ssh=false
|
||||
|
||||
# prompt for session name when creating a new session, possible values are:
|
||||
# - true
|
||||
# - false (default)
|
||||
tmux_conf_new_session_prompt=false
|
||||
|
||||
|
||||
# -- display -------------------------------------------------------------------
|
||||
|
||||
# RGB 24-bit colour support (tmux >= 2.2), possible values are:
|
||||
# - true
|
||||
# - false (default)
|
||||
tmux_conf_theme_24b_colour=false
|
||||
|
||||
# window style
|
||||
tmux_conf_theme_window_fg='default'
|
||||
tmux_conf_theme_window_bg='default'
|
||||
|
||||
# highlight focused pane (tmux >= 2.1), possible values are:
|
||||
# - true
|
||||
# - false (default)
|
||||
tmux_conf_theme_highlight_focused_pane=false
|
||||
|
||||
# focused pane colours:
|
||||
tmux_conf_theme_focused_pane_fg='default'
|
||||
tmux_conf_theme_focused_pane_bg='#0087d7' # light blue
|
||||
|
||||
# pane border style, possible values are:
|
||||
# - thin (default)
|
||||
# - fat
|
||||
tmux_conf_theme_pane_border_style=thin
|
||||
|
||||
# pane borders colours:
|
||||
tmux_conf_theme_pane_border='#444444' # gray
|
||||
tmux_conf_theme_pane_active_border='#00afff' # light blue
|
||||
|
||||
# pane indicator colours
|
||||
tmux_conf_theme_pane_indicator='#00afff' # light blue
|
||||
tmux_conf_theme_pane_active_indicator='#00afff' # light blue
|
||||
|
||||
# status line style
|
||||
tmux_conf_theme_message_fg='#000000' # black
|
||||
tmux_conf_theme_message_bg='#ffff00' # yellow
|
||||
tmux_conf_theme_message_attr='bold'
|
||||
|
||||
# status line command style (<prefix> : Escape)
|
||||
tmux_conf_theme_message_command_fg='#ffff00' # yellow
|
||||
tmux_conf_theme_message_command_bg='#000000' # black
|
||||
tmux_conf_theme_message_command_attr='bold'
|
||||
|
||||
# window modes style
|
||||
tmux_conf_theme_mode_fg='#000000' # black
|
||||
tmux_conf_theme_mode_bg='#ffff00' # yellow
|
||||
tmux_conf_theme_mode_attr='bold'
|
||||
|
||||
# status line style
|
||||
tmux_conf_theme_status_fg='#8a8a8a' # light gray
|
||||
tmux_conf_theme_status_bg='#080808' # dark gray
|
||||
tmux_conf_theme_status_attr='none'
|
||||
|
||||
# window status style
|
||||
# - built-in variables are:
|
||||
# - #{circled_window_index}
|
||||
tmux_conf_theme_window_status_fg='#8a8a8a' # light gray
|
||||
tmux_conf_theme_window_status_bg='#080808' # dark gray
|
||||
tmux_conf_theme_window_status_attr='none'
|
||||
tmux_conf_theme_window_status_format='#I #W'
|
||||
#tmux_conf_theme_window_status_format='#{circled_window_index} #W'
|
||||
#tmux_conf_theme_window_status_format='#I #W#{?window_bell_flag,🔔,}#{?window_zoomed_flag,🔍,}'
|
||||
|
||||
# window current status style
|
||||
# - built-in variables are:
|
||||
# - #{circled_window_index}
|
||||
tmux_conf_theme_window_status_current_fg='#000000' # black
|
||||
tmux_conf_theme_window_status_current_bg='#00afff' # light blue
|
||||
tmux_conf_theme_window_status_current_attr='bold'
|
||||
tmux_conf_theme_window_status_current_format='#I #W'
|
||||
#tmux_conf_theme_window_status_current_format='#{circled_window_index} #W'
|
||||
#tmux_conf_theme_window_status_current_format='#I #W#{?window_zoomed_flag,🔍,}'
|
||||
|
||||
# window activity status style
|
||||
tmux_conf_theme_window_status_activity_fg='default'
|
||||
tmux_conf_theme_window_status_activity_bg='default'
|
||||
tmux_conf_theme_window_status_activity_attr='underscore'
|
||||
|
||||
# window bell status style
|
||||
tmux_conf_theme_window_status_bell_fg='#ffff00' # yellow
|
||||
tmux_conf_theme_window_status_bell_bg='default'
|
||||
tmux_conf_theme_window_status_bell_attr='blink,bold'
|
||||
|
||||
# window last status style
|
||||
tmux_conf_theme_window_status_last_fg='#00afff' # light blue
|
||||
tmux_conf_theme_window_status_last_bg='default'
|
||||
tmux_conf_theme_window_status_last_attr='none'
|
||||
|
||||
# status left/right sections separators
|
||||
tmux_conf_theme_left_separator_main=''
|
||||
tmux_conf_theme_left_separator_sub='|'
|
||||
tmux_conf_theme_right_separator_main=''
|
||||
tmux_conf_theme_right_separator_sub='|'
|
||||
#tmux_conf_theme_left_separator_main='' # /!\ you don't need to install Powerline
|
||||
#tmux_conf_theme_left_separator_sub='' # you only need fonts patched with
|
||||
#tmux_conf_theme_right_separator_main='' # Powerline symbols or the standalone
|
||||
#tmux_conf_theme_right_separator_sub='' # PowerlineSymbols.otf font
|
||||
|
||||
# status left/right content:
|
||||
# - separate main sections with '|'
|
||||
# - separate subsections with ','
|
||||
# - built-in variables are:
|
||||
# - #{battery_bar}
|
||||
# - #{battery_hbar}
|
||||
# - #{battery_percentage}
|
||||
# - #{battery_status}
|
||||
# - #{battery_vbar}
|
||||
# - #{circled_session_name}
|
||||
# - #{hostname_ssh}
|
||||
# - #{hostname}
|
||||
# - #{loadavg}
|
||||
# - #{pairing}
|
||||
# - #{prefix}
|
||||
# - #{root}
|
||||
# - #{uptime_d}
|
||||
# - #{uptime_h}
|
||||
# - #{uptime_m}
|
||||
# - #{uptime_s}
|
||||
# - #{username}
|
||||
# - #{username_ssh}
|
||||
tmux_conf_theme_status_left=' ❐ #S | ↑#{?uptime_d, #{uptime_d}d,}#{?uptime_h, #{uptime_h}h,}#{?uptime_m, #{uptime_m}m,} '
|
||||
tmux_conf_theme_status_right='#{prefix}#{pairing} #{?battery_status, #{battery_status},}#{?battery_bar, #{battery_bar},}#{?battery_percentage, #{battery_percentage},} , %R , %d %b | #{username}#{root} | #{hostname} '
|
||||
|
||||
# status left style
|
||||
tmux_conf_theme_status_left_fg='#000000,#e4e4e4,#e4e4e4' # black, white , white
|
||||
tmux_conf_theme_status_left_bg='#ffff00,#ff00af,#00afff' # yellow, pink, white blue
|
||||
tmux_conf_theme_status_left_attr='bold,none,none'
|
||||
|
||||
# status right style
|
||||
tmux_conf_theme_status_right_fg='#8a8a8a,#e4e4e4,#000000' # light gray, white, black
|
||||
tmux_conf_theme_status_right_bg='#080808,#d70000,#e4e4e4' # dark gray, red, white
|
||||
tmux_conf_theme_status_right_attr='none,none,bold'
|
||||
|
||||
# pairing indicator
|
||||
tmux_conf_theme_pairing='👓 ' # U+1F453
|
||||
tmux_conf_theme_pairing_fg='none'
|
||||
tmux_conf_theme_pairing_bg='none'
|
||||
tmux_conf_theme_pairing_attr='none'
|
||||
|
||||
# prefix indicator
|
||||
tmux_conf_theme_prefix='⌨ ' # U+2328
|
||||
tmux_conf_theme_prefix_fg='none'
|
||||
tmux_conf_theme_prefix_bg='none'
|
||||
tmux_conf_theme_prefix_attr='none'
|
||||
|
||||
# root indicator
|
||||
tmux_conf_theme_root='!'
|
||||
tmux_conf_theme_root_fg='none'
|
||||
tmux_conf_theme_root_bg='none'
|
||||
tmux_conf_theme_root_attr='bold,blink'
|
||||
|
||||
# battery bar symbols
|
||||
tmux_conf_battery_bar_symbol_full='◼'
|
||||
tmux_conf_battery_bar_symbol_empty='◻'
|
||||
#tmux_conf_battery_bar_symbol_full='♥'
|
||||
#tmux_conf_battery_bar_symbol_empty='·'
|
||||
|
||||
# battery bar length (in number of symbols), possible values are:
|
||||
# - auto
|
||||
# - a number, e.g. 5
|
||||
tmux_conf_battery_bar_length='auto'
|
||||
|
||||
# battery bar palette, possible values are:
|
||||
# - gradient (default)
|
||||
# - heat
|
||||
# - 'colour_full_fg,colour_empty_fg,colour_bg'
|
||||
tmux_conf_battery_bar_palette='gradient'
|
||||
#tmux_conf_battery_bar_palette='#d70000,#e4e4e4,#000000' # red, white, black
|
||||
|
||||
# battery hbar palette, possible values are:
|
||||
# - gradient (default)
|
||||
# - heat
|
||||
# - 'colour_low,colour_half,colour_full'
|
||||
tmux_conf_battery_hbar_palette='gradient'
|
||||
#tmux_conf_battery_hbar_palette='#d70000,#ff5f00,#5fff00' # red, orange, green
|
||||
|
||||
# battery vbar palette, possible values are:
|
||||
# - gradient (default)
|
||||
# - heat
|
||||
# - 'colour_low,colour_half,colour_full'
|
||||
tmux_conf_battery_vbar_palette='gradient'
|
||||
#tmux_conf_battery_vbar_palette='#d70000,#ff5f00,#5fff00' # red, orange, green
|
||||
|
||||
# symbols used to indicate whether battery is charging or discharging
|
||||
tmux_conf_battery_status_charging='↑' # U+2191
|
||||
tmux_conf_battery_status_discharging='↓' # U+2193
|
||||
#tmux_conf_battery_status_charging='⚡ ' # U+26A1
|
||||
#tmux_conf_battery_status_charging='🔌 ' # U+1F50C
|
||||
#tmux_conf_battery_status_discharging='🔋 ' # U+1F50B
|
||||
|
||||
# clock style
|
||||
tmux_conf_theme_clock_colour='#00afff' # light blue
|
||||
tmux_conf_theme_clock_style='24'
|
||||
|
||||
|
||||
# -- clipboard -----------------------------------------------------------------
|
||||
|
||||
# in copy mode, copying selection also copies to the OS clipboard
|
||||
# - true
|
||||
# - false (default)
|
||||
# on macOS, this requires installing reattach-to-user-namespace, see README.md
|
||||
# on Linux, this requires xsel or xclip
|
||||
tmux_conf_copy_to_os_clipboard=false
|
||||
|
||||
|
||||
# -- user customizations -------------------------------------------------------
|
||||
# this is the place to override or undo settings
|
||||
|
||||
# increase history size
|
||||
#set -g history-limit 10000
|
||||
|
||||
# start with mouse mode enabled
|
||||
set -g mouse off
|
||||
|
||||
# force Vi mode
|
||||
# really you should export VISUAL or EDITOR environment variable, see manual
|
||||
#set -g status-keys vi
|
||||
#set -g mode-keys vi
|
||||
|
||||
# replace C-b by C-a instead of using both prefixes
|
||||
# set -gu prefix2
|
||||
# unbind C-a
|
||||
# unbind C-b
|
||||
# set -g prefix C-a
|
||||
# bind C-a send-prefix
|
||||
|
||||
# move status line to top
|
||||
#set -g status-position top
|
||||
195
.vim/autoload/airline.vim
Normal file
195
.vim/autoload/airline.vim
Normal file
@ -0,0 +1,195 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
let g:airline_statusline_funcrefs = get(g:, 'airline_statusline_funcrefs', [])
|
||||
|
||||
let s:sections = ['a','b','c','gutter','x','y','z', 'error', 'warning']
|
||||
let s:inactive_funcrefs = []
|
||||
|
||||
function! airline#add_statusline_func(name)
|
||||
call airline#add_statusline_funcref(function(a:name))
|
||||
endfunction
|
||||
|
||||
function! airline#add_statusline_funcref(function)
|
||||
if index(g:airline_statusline_funcrefs, a:function) >= 0
|
||||
echohl WarningMsg
|
||||
echo 'The airline statusline funcref '.string(a:function).' has already been added.'
|
||||
echohl NONE
|
||||
return
|
||||
endif
|
||||
call add(g:airline_statusline_funcrefs, a:function)
|
||||
endfunction
|
||||
|
||||
function! airline#remove_statusline_func(name)
|
||||
let i = index(g:airline_statusline_funcrefs, function(a:name))
|
||||
if i > -1
|
||||
call remove(g:airline_statusline_funcrefs, i)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! airline#add_inactive_statusline_func(name)
|
||||
call add(s:inactive_funcrefs, function(a:name))
|
||||
endfunction
|
||||
|
||||
function! airline#load_theme()
|
||||
if exists('*airline#themes#{g:airline_theme}#refresh')
|
||||
call airline#themes#{g:airline_theme}#refresh()
|
||||
endif
|
||||
|
||||
let palette = g:airline#themes#{g:airline_theme}#palette
|
||||
call airline#themes#patch(palette)
|
||||
|
||||
if exists('g:airline_theme_patch_func')
|
||||
let Fn = function(g:airline_theme_patch_func)
|
||||
call Fn(palette)
|
||||
endif
|
||||
|
||||
call airline#highlighter#load_theme()
|
||||
call airline#extensions#load_theme()
|
||||
call airline#update_statusline()
|
||||
endfunction
|
||||
|
||||
function! airline#switch_theme(name)
|
||||
try
|
||||
let palette = g:airline#themes#{a:name}#palette "also lazy loads the theme
|
||||
let g:airline_theme = a:name
|
||||
catch
|
||||
echohl WarningMsg | echo 'The specified theme cannot be found.' | echohl NONE
|
||||
if exists('g:airline_theme')
|
||||
return
|
||||
else
|
||||
let g:airline_theme = 'dark'
|
||||
endif
|
||||
endtry
|
||||
|
||||
let w:airline_lastmode = ''
|
||||
call airline#load_theme()
|
||||
|
||||
silent doautocmd User AirlineAfterTheme
|
||||
|
||||
" this is required to prevent clobbering the startup info message, i don't know why...
|
||||
call airline#check_mode(winnr())
|
||||
endfunction
|
||||
|
||||
function! airline#switch_matching_theme()
|
||||
if exists('g:colors_name')
|
||||
let existing = g:airline_theme
|
||||
let theme = substitute(tolower(g:colors_name), '-', '_', 'g')
|
||||
try
|
||||
let palette = g:airline#themes#{theme}#palette
|
||||
call airline#switch_theme(theme)
|
||||
return 1
|
||||
catch
|
||||
for map in items(g:airline_theme_map)
|
||||
if match(g:colors_name, map[0]) > -1
|
||||
try
|
||||
let palette = g:airline#themes#{map[1]}#palette
|
||||
call airline#switch_theme(map[1])
|
||||
catch
|
||||
call airline#switch_theme(existing)
|
||||
endtry
|
||||
return 1
|
||||
endif
|
||||
endfor
|
||||
endtry
|
||||
endif
|
||||
return 0
|
||||
endfunction
|
||||
|
||||
function! airline#update_statusline()
|
||||
if airline#util#getwinvar(winnr(), 'airline_disabled', 0)
|
||||
return
|
||||
endif
|
||||
for nr in filter(range(1, winnr('$')), 'v:val != winnr()')
|
||||
if airline#util#getwinvar(nr, 'airline_disabled', 0)
|
||||
continue
|
||||
endif
|
||||
call setwinvar(nr, 'airline_active', 0)
|
||||
let context = { 'winnr': nr, 'active': 0, 'bufnr': winbufnr(nr) }
|
||||
call s:invoke_funcrefs(context, s:inactive_funcrefs)
|
||||
endfor
|
||||
|
||||
unlet! w:airline_render_left w:airline_render_right
|
||||
exe 'unlet! ' 'w:airline_section_'. join(s:sections, ' w:airline_section_')
|
||||
|
||||
let w:airline_active = 1
|
||||
let context = { 'winnr': winnr(), 'active': 1, 'bufnr': winbufnr(winnr()) }
|
||||
call s:invoke_funcrefs(context, g:airline_statusline_funcrefs)
|
||||
endfunction
|
||||
|
||||
let s:contexts = {}
|
||||
let s:core_funcrefs = [
|
||||
\ function('airline#extensions#apply'),
|
||||
\ function('airline#extensions#default#apply') ]
|
||||
function! s:invoke_funcrefs(context, funcrefs)
|
||||
let builder = airline#builder#new(a:context)
|
||||
let err = airline#util#exec_funcrefs(a:funcrefs + s:core_funcrefs, builder, a:context)
|
||||
if err == 1
|
||||
let a:context.line = builder.build()
|
||||
let s:contexts[a:context.winnr] = a:context
|
||||
call setwinvar(a:context.winnr, '&statusline', '%!airline#statusline('.a:context.winnr.')')
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! airline#statusline(winnr)
|
||||
if has_key(s:contexts, a:winnr)
|
||||
return '%{airline#check_mode('.a:winnr.')}'.s:contexts[a:winnr].line
|
||||
endif
|
||||
|
||||
" in rare circumstances this happens...see #276
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
function! airline#check_mode(winnr)
|
||||
let context = s:contexts[a:winnr]
|
||||
|
||||
if get(w:, 'airline_active', 1)
|
||||
let l:m = mode()
|
||||
if l:m ==# "i"
|
||||
let l:mode = ['insert']
|
||||
elseif l:m ==# "R"
|
||||
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
|
||||
let w:airline_current_mode = get(g:airline_mode_map, l:m, l:m)
|
||||
else
|
||||
let l:mode = ['inactive']
|
||||
let w:airline_current_mode = get(g:airline_mode_map, '__')
|
||||
endif
|
||||
|
||||
if g:airline_detect_modified && &modified
|
||||
call add(l:mode, 'modified')
|
||||
endif
|
||||
|
||||
if g:airline_detect_paste && &paste
|
||||
call add(l:mode, 'paste')
|
||||
endif
|
||||
|
||||
if g:airline_detect_crypt && exists("+key") && !empty(&key)
|
||||
call add(l:mode, 'crypt')
|
||||
endif
|
||||
|
||||
if g:airline_detect_spell && &spell
|
||||
call add(l:mode, 'spell')
|
||||
endif
|
||||
|
||||
if &readonly || ! &modifiable
|
||||
call add(l:mode, 'readonly')
|
||||
endif
|
||||
|
||||
let mode_string = join(l:mode)
|
||||
if get(w:, 'airline_lastmode', '') != mode_string
|
||||
call airline#highlighter#highlight_modified_inactive(context.bufnr)
|
||||
call airline#highlighter#highlight(l:mode, context.bufnr)
|
||||
let w:airline_lastmode = mode_string
|
||||
endif
|
||||
|
||||
return ''
|
||||
endfunction
|
||||
250
.vim/autoload/airline/async.vim
Normal file
250
.vim/autoload/airline/async.vim
Normal file
@ -0,0 +1,250 @@
|
||||
" MIT License. Copyright (c) 2013-2017 C.Brabandt
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
let s:untracked_jobs = {}
|
||||
let s:mq_jobs = {}
|
||||
let s:po_jobs = {}
|
||||
|
||||
" Generic functions handling on exit event of the various async functions
|
||||
function! s:untracked_output(dict, buf)
|
||||
if a:buf =~? ('^'. a:dict.cfg['untracked_mark'])
|
||||
let a:dict.cfg.untracked[a:dict.file] = get(g:, 'airline#extensions#branch#notexists', g:airline_symbols.notexists)
|
||||
else
|
||||
let a:dict.cfg.untracked[a:dict.file] = ''
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" also called from branch extension (for non-async vims)
|
||||
function! airline#async#mq_output(buf, file)
|
||||
let buf=a:buf
|
||||
if !empty(a:buf)
|
||||
if a:buf =~# 'no patches applied' ||
|
||||
\ a:buf =~# "unknown command 'qtop'" ||
|
||||
\ a:buf =~# "abort"
|
||||
let buf = ''
|
||||
elseif exists("b:mq") && b:mq isnot# buf
|
||||
" make sure, statusline is updated
|
||||
unlet! b:airline_head
|
||||
endif
|
||||
let b:mq = buf
|
||||
endif
|
||||
if has_key(s:mq_jobs, a:file)
|
||||
call remove(s:mq_jobs, a:file)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:po_output(buf, file)
|
||||
if !empty(a:buf)
|
||||
let b:airline_po_stats = printf("[%s]", a:buf)
|
||||
else
|
||||
let b:airline_po_stats = ''
|
||||
endif
|
||||
if has_key(s:po_jobs, a:file)
|
||||
call remove(s:po_jobs, a:file)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:valid_dir(dir)
|
||||
if empty(a:dir) || !isdirectory(a:dir)
|
||||
return getcwd()
|
||||
endif
|
||||
return a:dir
|
||||
endfunction
|
||||
|
||||
if v:version >= 800 && has("job")
|
||||
" Vim 8.0 with Job feature
|
||||
|
||||
function! s:on_stdout(channel, msg) dict abort
|
||||
let self.buf .= a:msg
|
||||
endfunction
|
||||
|
||||
function! s:on_exit_mq(channel) dict abort
|
||||
call airline#async#mq_output(self.buf, self.file)
|
||||
endfunction
|
||||
|
||||
function! s:on_exit_untracked(channel) dict abort
|
||||
call s:untracked_output(self, self.buf)
|
||||
if has_key(s:untracked_jobs, self.file)
|
||||
call remove(s:untracked_jobs, self.file)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:on_exit_po(channel) dict abort
|
||||
call s:po_output(self.buf, self.file)
|
||||
call airline#extensions#po#shorten()
|
||||
endfunction
|
||||
|
||||
function! airline#async#get_mq_async(cmd, file)
|
||||
if g:airline#init#is_windows && &shell =~ 'cmd'
|
||||
let cmd = a:cmd
|
||||
else
|
||||
let cmd = ['sh', '-c', a:cmd]
|
||||
endif
|
||||
|
||||
let options = {'cmd': a:cmd, 'buf': '', 'file': a:file}
|
||||
if has_key(s:mq_jobs, a:file)
|
||||
if job_status(get(s:mq_jobs, a:file)) == 'run'
|
||||
return
|
||||
elseif has_key(s:mq_jobs, a:file)
|
||||
call remove(s:mq_jobs, a:file)
|
||||
endif
|
||||
endif
|
||||
let id = job_start(cmd, {
|
||||
\ 'err_io': 'out',
|
||||
\ 'out_cb': function('s:on_stdout', options),
|
||||
\ 'close_cb': function('s:on_exit_mq', options)})
|
||||
let s:mq_jobs[a:file] = id
|
||||
endfunction
|
||||
|
||||
function! airline#async#get_msgfmt_stat(cmd, file)
|
||||
if g:airline#init#is_windows || !executable('msgfmt')
|
||||
" no msgfmt on windows?
|
||||
return
|
||||
else
|
||||
let cmd = ['sh', '-c', a:cmd. shellescape(a:file)]
|
||||
endif
|
||||
|
||||
let options = {'buf': '', 'file': a:file}
|
||||
if has_key(s:po_jobs, a:file)
|
||||
if job_status(get(s:po_jobs, a:file)) == 'run'
|
||||
return
|
||||
elseif has_key(s:po_jobs, a:file)
|
||||
call remove(s:po_jobs, a:file)
|
||||
endif
|
||||
endif
|
||||
let id = job_start(cmd, {
|
||||
\ 'err_io': 'out',
|
||||
\ 'out_cb': function('s:on_stdout', options),
|
||||
\ 'close_cb': function('s:on_exit_po', options)})
|
||||
let s:po_jobs[a:file] = id
|
||||
endfunction
|
||||
|
||||
function airline#async#vim_vcs_untracked(config, file)
|
||||
if g:airline#init#is_windows && &shell =~ 'cmd'
|
||||
let cmd = a:config['cmd'] . shellescape(a:file)
|
||||
else
|
||||
let cmd = ['sh', '-c', a:config['cmd'] . shellescape(a:file)]
|
||||
endif
|
||||
|
||||
let options = {'cfg': a:config, 'buf': '', 'file': a:file}
|
||||
if has_key(s:untracked_jobs, a:file)
|
||||
if job_status(get(s:untracked_jobs, a:file)) == 'run'
|
||||
return
|
||||
elseif has_key(s:untracked_jobs, a:file)
|
||||
call remove(s:untracked_jobs, a:file)
|
||||
endif
|
||||
endif
|
||||
let id = job_start(cmd, {
|
||||
\ 'err_io': 'out',
|
||||
\ 'out_cb': function('s:on_stdout', options),
|
||||
\ 'close_cb': function('s:on_exit_untracked', options)})
|
||||
let s:untracked_jobs[a:file] = id
|
||||
endfunction
|
||||
|
||||
elseif has("nvim")
|
||||
" NVim specific functions
|
||||
|
||||
function! s:nvim_output_handler(job_id, data, event) dict
|
||||
if a:event == 'stdout' || a:event == 'stderr'
|
||||
let self.buf .= join(a:data)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:nvim_untracked_job_handler(job_id, data, event) dict
|
||||
if a:event == 'exit'
|
||||
call s:untracked_output(self, self.buf)
|
||||
if has_key(s:untracked_jobs, self.file)
|
||||
call remove(s:untracked_jobs, self.file)
|
||||
endif
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:nvim_mq_job_handler(job_id, data, event) dict
|
||||
if a:event == 'exit'
|
||||
call airline#async#mq_output(self.buf, self.file)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:nvim_po_job_handler(job_id, data, event) dict
|
||||
if a:event == 'exit'
|
||||
call s:po_output(self.buf, self.file)
|
||||
call airline#extensions#po#shorten()
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! airline#async#nvim_get_mq_async(cmd, file)
|
||||
let config = {
|
||||
\ 'buf': '',
|
||||
\ 'file': a:file,
|
||||
\ 'cwd': s:valid_dir(fnamemodify(a:file, ':p:h')),
|
||||
\ 'on_stdout': function('s:nvim_output_handler'),
|
||||
\ 'on_stderr': function('s:nvim_output_handler'),
|
||||
\ 'on_exit': function('s:nvim_mq_job_handler')
|
||||
\ }
|
||||
if g:airline#init#is_windows && &shell =~ 'cmd'
|
||||
let cmd = a:cmd
|
||||
else
|
||||
let cmd = ['sh', '-c', a:cmd]
|
||||
endif
|
||||
|
||||
if has_key(s:mq_jobs, a:file)
|
||||
call remove(s:mq_jobs, a:file)
|
||||
endif
|
||||
let id = jobstart(cmd, config)
|
||||
let s:mq_jobs[a:file] = id
|
||||
endfunction
|
||||
|
||||
function! airline#async#nvim_get_msgfmt_stat(cmd, file)
|
||||
let config = {
|
||||
\ 'buf': '',
|
||||
\ 'file': a:file,
|
||||
\ 'cwd': s:valid_dir(fnamemodify(a:file, ':p:h')),
|
||||
\ 'on_stdout': function('s:nvim_output_handler'),
|
||||
\ 'on_stderr': function('s:nvim_output_handler'),
|
||||
\ 'on_exit': function('s:nvim_po_job_handler')
|
||||
\ }
|
||||
if g:airline#init#is_windows && &shell =~ 'cmd'
|
||||
" no msgfmt on windows?
|
||||
return
|
||||
else
|
||||
let cmd = ['sh', '-c', a:cmd. shellescape(a:file)]
|
||||
endif
|
||||
|
||||
if has_key(s:po_jobs, a:file)
|
||||
call remove(s:po_jobs, a:file)
|
||||
endif
|
||||
let id = jobstart(cmd, config)
|
||||
let s:po_jobs[a:file] = id
|
||||
endfunction
|
||||
|
||||
endif
|
||||
|
||||
" Should work in either Vim pre 8 or Nvim
|
||||
function! airline#async#nvim_vcs_untracked(cfg, file, vcs)
|
||||
let cmd = a:cfg.cmd . shellescape(a:file)
|
||||
let id = -1
|
||||
let config = {
|
||||
\ 'buf': '',
|
||||
\ 'vcs': a:vcs,
|
||||
\ 'cfg': a:cfg,
|
||||
\ 'file': a:file,
|
||||
\ 'cwd': s:valid_dir(fnamemodify(a:file, ':p:h'))
|
||||
\ }
|
||||
if has("nvim")
|
||||
call extend(config, {
|
||||
\ 'on_stdout': function('s:nvim_output_handler'),
|
||||
\ 'on_exit': function('s:nvim_untracked_job_handler')})
|
||||
if has_key(s:untracked_jobs, config.file)
|
||||
" still running
|
||||
return
|
||||
endif
|
||||
let id = jobstart(cmd, config)
|
||||
let s:untracked_jobs[a:file] = id
|
||||
endif
|
||||
" vim without job feature or nvim jobstart failed
|
||||
if id < 1
|
||||
let output=system(cmd)
|
||||
call s:untracked_output(config, output)
|
||||
call airline#extensions#branch#update_untracked_config(a:file, a:vcs)
|
||||
endif
|
||||
endfunction
|
||||
212
.vim/autoload/airline/builder.vim
Normal file
212
.vim/autoload/airline/builder.vim
Normal file
@ -0,0 +1,212 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
let s:prototype = {}
|
||||
|
||||
function! s:prototype.split(...) dict
|
||||
call add(self._sections, ['|', a:0 ? a:1 : '%='])
|
||||
endfunction
|
||||
|
||||
function! s:prototype.add_section_spaced(group, contents) dict
|
||||
let spc = empty(a:contents) ? '' : g:airline_symbols.space
|
||||
call self.add_section(a:group, spc.a:contents.spc)
|
||||
endfunction
|
||||
|
||||
function! s:prototype.add_section(group, contents) dict
|
||||
call add(self._sections, [a:group, a:contents])
|
||||
endfunction
|
||||
|
||||
function! s:prototype.add_raw(text) dict
|
||||
call add(self._sections, ['', a:text])
|
||||
endfunction
|
||||
|
||||
function! s:get_prev_group(sections, i)
|
||||
let x = a:i - 1
|
||||
while x >= 0
|
||||
let group = a:sections[x][0]
|
||||
if group != '' && group != '|'
|
||||
return group
|
||||
endif
|
||||
let x = x - 1
|
||||
endwhile
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
function! s:prototype.build() dict
|
||||
let side = 1
|
||||
let line = ''
|
||||
let i = 0
|
||||
let length = len(self._sections)
|
||||
let split = 0
|
||||
let is_empty = 0
|
||||
let prev_group = ''
|
||||
|
||||
while i < length
|
||||
let section = self._sections[i]
|
||||
let group = section[0]
|
||||
let contents = section[1]
|
||||
let pgroup = prev_group
|
||||
let prev_group = s:get_prev_group(self._sections, i)
|
||||
if group ==# 'airline_c' && &buftype ==# 'terminal' && self._context.active
|
||||
let group = 'airline_term'
|
||||
elseif group ==# 'airline_c' && !self._context.active && has_key(self._context, 'bufnr')
|
||||
let group = 'airline_c'. self._context.bufnr
|
||||
elseif prev_group ==# 'airline_c' && !self._context.active && has_key(self._context, 'bufnr')
|
||||
let prev_group = 'airline_c'. self._context.bufnr
|
||||
endif
|
||||
if is_empty
|
||||
let prev_group = pgroup
|
||||
endif
|
||||
let is_empty = s:section_is_empty(self, contents)
|
||||
|
||||
if is_empty
|
||||
" need to fix highlighting groups, since we
|
||||
" have skipped a section, we actually need
|
||||
" the previous previous group and so the
|
||||
" seperator goes from the previous previous group
|
||||
" to the current group
|
||||
let pgroup = group
|
||||
endif
|
||||
|
||||
if group == ''
|
||||
let line .= contents
|
||||
elseif group == '|'
|
||||
let side = 0
|
||||
let line .= contents
|
||||
let split = 1
|
||||
else
|
||||
if prev_group == ''
|
||||
let line .= '%#'.group.'#'
|
||||
elseif split
|
||||
if !is_empty
|
||||
let line .= s:get_transitioned_seperator(self, prev_group, group, side)
|
||||
endif
|
||||
let split = 0
|
||||
else
|
||||
if !is_empty
|
||||
let line .= s:get_seperator(self, prev_group, group, side)
|
||||
endif
|
||||
endif
|
||||
let line .= is_empty ? '' : s:get_accented_line(self, group, contents)
|
||||
endif
|
||||
|
||||
let i = i + 1
|
||||
endwhile
|
||||
|
||||
if !self._context.active
|
||||
"let line = substitute(line, '%#airline_c#', '%#airline_c'.self._context.bufnr.'#', '')
|
||||
let line = substitute(line, '%#.\{-}\ze#', '\0_inactive', 'g')
|
||||
endif
|
||||
return line
|
||||
endfunction
|
||||
|
||||
function! s:should_change_group(group1, group2)
|
||||
if a:group1 == a:group2
|
||||
return 0
|
||||
endif
|
||||
let color1 = airline#highlighter#get_highlight(a:group1)
|
||||
let color2 = airline#highlighter#get_highlight(a:group2)
|
||||
if g:airline_gui_mode ==# 'gui'
|
||||
return color1[1] != color2[1] || color1[0] != color2[0]
|
||||
else
|
||||
return color1[3] != color2[3] || color1[2] != color2[2]
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:get_transitioned_seperator(self, prev_group, group, side)
|
||||
let line = ''
|
||||
call airline#highlighter#add_separator(a:prev_group, a:group, a:side)
|
||||
let line .= '%#'.a:prev_group.'_to_'.a:group.'#'
|
||||
let line .= a:side ? a:self._context.left_sep : a:self._context.right_sep
|
||||
let line .= '%#'.a:group.'#'
|
||||
return line
|
||||
endfunction
|
||||
|
||||
function! s:get_seperator(self, prev_group, group, side)
|
||||
if s:should_change_group(a:prev_group, a:group)
|
||||
return s:get_transitioned_seperator(a:self, a:prev_group, a:group, a:side)
|
||||
else
|
||||
return a:side ? a:self._context.left_alt_sep : a:self._context.right_alt_sep
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:get_accented_line(self, group, contents)
|
||||
if a:self._context.active
|
||||
let contents = []
|
||||
let content_parts = split(a:contents, '__accent')
|
||||
for cpart in content_parts
|
||||
let accent = matchstr(cpart, '_\zs[^#]*\ze')
|
||||
call add(contents, cpart)
|
||||
endfor
|
||||
let line = join(contents, a:group)
|
||||
let line = substitute(line, '__restore__', a:group, 'g')
|
||||
else
|
||||
let line = substitute(a:contents, '%#__accent[^#]*#', '', 'g')
|
||||
let line = substitute(line, '%#__restore__#', '', 'g')
|
||||
endif
|
||||
return line
|
||||
endfunction
|
||||
|
||||
function! s:section_is_empty(self, content)
|
||||
let start=1
|
||||
|
||||
" do not check for inactive windows or the tabline
|
||||
if a:self._context.active == 0
|
||||
return 0
|
||||
elseif get(a:self._context, 'tabline', 0)
|
||||
return 0
|
||||
endif
|
||||
|
||||
" only check, if airline#skip_empty_sections == 1
|
||||
if get(g:, 'airline_skip_empty_sections', 0) == 0
|
||||
return 0
|
||||
endif
|
||||
|
||||
" only check, if airline#skip_empty_sections == 1
|
||||
if get(w:, 'airline_skip_empty_sections', -1) == 0
|
||||
return 0
|
||||
endif
|
||||
" assume accents sections to be never empty
|
||||
" (avoides, that on startup the mode message becomes empty)
|
||||
if match(a:content, '%#__accent_[^#]*#.*__restore__#') > -1
|
||||
return 0
|
||||
endif
|
||||
if empty(a:content)
|
||||
return 1
|
||||
endif
|
||||
let list=matchlist(a:content, '%{\zs.\{-}\ze}', 1, start)
|
||||
if empty(list)
|
||||
return 0 " no function in statusline text
|
||||
endif
|
||||
while len(list) > 0
|
||||
let expr = list[0]
|
||||
try
|
||||
" catch all exceptions, just in case
|
||||
if !empty(eval(expr))
|
||||
return 0
|
||||
endif
|
||||
catch
|
||||
return 0
|
||||
endtry
|
||||
let start += 1
|
||||
let list=matchlist(a:content, '%{\zs.\{-}\ze}', 1, start)
|
||||
endw
|
||||
return 1
|
||||
endfunction
|
||||
|
||||
function! airline#builder#new(context)
|
||||
let builder = copy(s:prototype)
|
||||
let builder._context = a:context
|
||||
let builder._sections = []
|
||||
|
||||
call extend(builder._context, {
|
||||
\ 'left_sep': g:airline_left_sep,
|
||||
\ 'left_alt_sep': g:airline_left_alt_sep,
|
||||
\ 'right_sep': g:airline_right_sep,
|
||||
\ 'right_alt_sep': g:airline_right_alt_sep,
|
||||
\ }, 'keep')
|
||||
return builder
|
||||
endfunction
|
||||
|
||||
52
.vim/autoload/airline/debug.vim
Normal file
52
.vim/autoload/airline/debug.vim
Normal file
@ -0,0 +1,52 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
function! airline#debug#profile1()
|
||||
profile start airline-profile-switch.log
|
||||
profile func *
|
||||
profile file *
|
||||
split
|
||||
for i in range(1, 1000)
|
||||
wincmd w
|
||||
redrawstatus
|
||||
endfor
|
||||
profile pause
|
||||
noautocmd qall!
|
||||
endfunction
|
||||
|
||||
function! airline#debug#profile2()
|
||||
profile start airline-profile-cursor.log
|
||||
profile func *
|
||||
profile file *
|
||||
edit blank
|
||||
call setline(1, 'all your base are belong to us')
|
||||
call setline(2, 'all your base are belong to us')
|
||||
let positions = [[1,2], [2,2], [1,2], [1,1]]
|
||||
for i in range(1, 1000)
|
||||
for pos in positions
|
||||
call cursor(pos[0], pos[1])
|
||||
redrawstatus
|
||||
endfor
|
||||
endfor
|
||||
profile pause
|
||||
noautocmd qall!
|
||||
endfunction
|
||||
|
||||
function! airline#debug#profile3()
|
||||
profile start airline-profile-mode.log
|
||||
profile func *
|
||||
profile file *
|
||||
|
||||
for i in range(1000)
|
||||
startinsert
|
||||
redrawstatus
|
||||
stopinsert
|
||||
redrawstatus
|
||||
endfor
|
||||
|
||||
profile pause
|
||||
noautocmd qall!
|
||||
endfunction
|
||||
|
||||
350
.vim/autoload/airline/extensions.vim
Normal file
350
.vim/autoload/airline/extensions.vim
Normal file
@ -0,0 +1,350 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
let s:ext = {}
|
||||
let s:ext._theme_funcrefs = []
|
||||
|
||||
function! s:ext.add_statusline_func(name) dict
|
||||
call airline#add_statusline_func(a:name)
|
||||
endfunction
|
||||
function! s:ext.add_statusline_funcref(function) dict
|
||||
call airline#add_statusline_funcref(a:function)
|
||||
endfunction
|
||||
function! s:ext.add_inactive_statusline_func(name) dict
|
||||
call airline#add_inactive_statusline_func(a:name)
|
||||
endfunction
|
||||
function! s:ext.add_theme_func(name) dict
|
||||
call add(self._theme_funcrefs, function(a:name))
|
||||
endfunction
|
||||
|
||||
let s:script_path = tolower(resolve(expand('<sfile>:p:h')))
|
||||
|
||||
let s:filetype_overrides = {
|
||||
\ 'nerdtree': [ 'NERD', '' ],
|
||||
\ 'gundo': [ 'Gundo', '' ],
|
||||
\ 'vimfiler': [ 'vimfiler', '%{vimfiler#get_status_string()}' ],
|
||||
\ 'minibufexpl': [ 'MiniBufExplorer', '' ],
|
||||
\ 'startify': [ 'startify', '' ],
|
||||
\ 'vim-plug': [ 'Plugins', '' ],
|
||||
\ }
|
||||
|
||||
let s:filetype_regex_overrides = {}
|
||||
|
||||
function! s:check_defined_section(name)
|
||||
if !exists('w:airline_section_{a:name}')
|
||||
let w:airline_section_{a:name} = g:airline_section_{a:name}
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#append_to_section(name, value)
|
||||
call <sid>check_defined_section(a:name)
|
||||
let w:airline_section_{a:name} .= a:value
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#prepend_to_section(name, value)
|
||||
call <sid>check_defined_section(a:name)
|
||||
let w:airline_section_{a:name} = a:value . w:airline_section_{a:name}
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#apply_left_override(section1, section2)
|
||||
let w:airline_section_a = a:section1
|
||||
let w:airline_section_b = a:section2
|
||||
let w:airline_section_c = airline#section#create(['readonly'])
|
||||
let w:airline_render_left = 1
|
||||
let w:airline_render_right = 0
|
||||
endfunction
|
||||
|
||||
let s:active_winnr = -1
|
||||
function! airline#extensions#apply(...)
|
||||
let s:active_winnr = winnr()
|
||||
|
||||
if s:is_excluded_window()
|
||||
return -1
|
||||
endif
|
||||
|
||||
if &buftype == 'help'
|
||||
call airline#extensions#apply_left_override('Help', '%f')
|
||||
let w:airline_section_x = ''
|
||||
let w:airline_section_y = ''
|
||||
let w:airline_render_right = 1
|
||||
endif
|
||||
|
||||
if &previewwindow
|
||||
let w:airline_section_a = 'Preview'
|
||||
let w:airline_section_b = ''
|
||||
let w:airline_section_c = bufname(winbufnr(winnr()))
|
||||
endif
|
||||
|
||||
if has_key(s:filetype_overrides, &ft)
|
||||
let args = s:filetype_overrides[&ft]
|
||||
call airline#extensions#apply_left_override(args[0], args[1])
|
||||
endif
|
||||
|
||||
for item in items(s:filetype_regex_overrides)
|
||||
if match(&ft, item[0]) >= 0
|
||||
call airline#extensions#apply_left_override(item[1][0], item[1][1])
|
||||
endif
|
||||
endfor
|
||||
endfunction
|
||||
|
||||
function! s:is_excluded_window()
|
||||
for matchft in g:airline_exclude_filetypes
|
||||
if matchft ==# &ft
|
||||
return 1
|
||||
endif
|
||||
endfor
|
||||
|
||||
for matchw in g:airline_exclude_filenames
|
||||
if matchstr(expand('%'), matchw) ==# matchw
|
||||
return 1
|
||||
endif
|
||||
endfor
|
||||
|
||||
if g:airline_exclude_preview && &previewwindow
|
||||
return 1
|
||||
endif
|
||||
|
||||
return 0
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#load_theme()
|
||||
call airline#util#exec_funcrefs(s:ext._theme_funcrefs, g:airline#themes#{g:airline_theme}#palette)
|
||||
endfunction
|
||||
|
||||
function! s:sync_active_winnr()
|
||||
if exists('#airline') && winnr() != s:active_winnr
|
||||
call airline#update_statusline()
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#load()
|
||||
let loaded_ext = []
|
||||
" non-trivial number of external plugins use eventignore=all, so we need to account for that
|
||||
autocmd CursorMoved * call <sid>sync_active_winnr()
|
||||
|
||||
if exists('g:airline_extensions')
|
||||
for ext in g:airline_extensions
|
||||
try
|
||||
call airline#extensions#{ext}#init(s:ext)
|
||||
catch /^Vim\%((\a\+)\)\=:E117/ " E117, function does not exist
|
||||
call airline#util#warning("Extension '".ext."' not installed, ignoring!")
|
||||
endtry
|
||||
endfor
|
||||
return
|
||||
endif
|
||||
|
||||
call airline#extensions#quickfix#init(s:ext)
|
||||
call add(loaded_ext, 'quickfix')
|
||||
|
||||
if get(g:, 'loaded_unite', 0)
|
||||
call airline#extensions#unite#init(s:ext)
|
||||
call add(loaded_ext, 'unite')
|
||||
endif
|
||||
|
||||
if get(g:, 'loaded_denite', 0)
|
||||
call airline#extensions#denite#init(s:ext)
|
||||
call add(loaded_ext, 'denite')
|
||||
endif
|
||||
|
||||
if exists(':NetrwSettings')
|
||||
call airline#extensions#netrw#init(s:ext)
|
||||
call add(loaded_ext, 'netrw')
|
||||
endif
|
||||
|
||||
if has("terminal")
|
||||
call airline#extensions#term#init(s:ext)
|
||||
call add(loaded_ext, 'term')
|
||||
endif
|
||||
|
||||
if get(g:, 'airline#extensions#ycm#enabled', 0)
|
||||
call airline#extensions#ycm#init(s:ext)
|
||||
call add(loaded_ext, 'ycm')
|
||||
endif
|
||||
|
||||
if get(g:, 'loaded_vimfiler', 0)
|
||||
let g:vimfiler_force_overwrite_statusline = 0
|
||||
endif
|
||||
|
||||
if get(g:, 'loaded_ctrlp', 0)
|
||||
call airline#extensions#ctrlp#init(s:ext)
|
||||
call add(loaded_ext, 'ctrlp')
|
||||
endif
|
||||
|
||||
if get(g:, 'CtrlSpaceLoaded', 0)
|
||||
call airline#extensions#ctrlspace#init(s:ext)
|
||||
call add(loaded_ext, 'ctrlspace')
|
||||
endif
|
||||
|
||||
if get(g:, 'command_t_loaded', 0)
|
||||
call airline#extensions#commandt#init(s:ext)
|
||||
call add(loaded_ext, 'commandt')
|
||||
endif
|
||||
|
||||
if exists(':UndotreeToggle')
|
||||
call airline#extensions#undotree#init(s:ext)
|
||||
call add(loaded_ext, 'undotree')
|
||||
endif
|
||||
|
||||
if get(g:, 'airline#extensions#hunks#enabled', 1)
|
||||
\ && (exists('g:loaded_signify') || exists('g:loaded_gitgutter') || exists('g:loaded_changes') || exists('g:loaded_quickfixsigns'))
|
||||
call airline#extensions#hunks#init(s:ext)
|
||||
call add(loaded_ext, 'hunks')
|
||||
endif
|
||||
|
||||
if get(g:, 'airline#extensions#vimagit#enabled', 1)
|
||||
\ && (exists('g:loaded_magit'))
|
||||
call airline#extensions#vimagit#init(s:ext)
|
||||
call add(loaded_ext, 'vimagit')
|
||||
endif
|
||||
|
||||
if get(g:, 'airline#extensions#tagbar#enabled', 1)
|
||||
\ && exists(':TagbarToggle')
|
||||
call airline#extensions#tagbar#init(s:ext)
|
||||
call add(loaded_ext, 'tagbar')
|
||||
endif
|
||||
|
||||
if get(g:, 'airline#extensions#csv#enabled', 1)
|
||||
\ && (get(g:, 'loaded_csv', 0) || exists(':Table'))
|
||||
call airline#extensions#csv#init(s:ext)
|
||||
call add(loaded_ext, 'csv')
|
||||
endif
|
||||
|
||||
if exists(':VimShell')
|
||||
let s:filetype_overrides['vimshell'] = ['vimshell','%{vimshell#get_status_string()}']
|
||||
let s:filetype_regex_overrides['^int-'] = ['vimshell','%{substitute(&ft, "int-", "", "")}']
|
||||
endif
|
||||
|
||||
if get(g:, 'airline#extensions#branch#enabled', 1)
|
||||
\ && (exists('*fugitive#head') || exists('*lawrencium#statusline') ||
|
||||
\ (get(g:, 'airline#extensions#branch#use_vcscommand', 0) && exists('*VCSCommandGetStatusLine')))
|
||||
call airline#extensions#branch#init(s:ext)
|
||||
call add(loaded_ext, 'branch')
|
||||
endif
|
||||
|
||||
if get(g:, 'airline#extensions#bufferline#enabled', 1)
|
||||
\ && exists('*bufferline#get_status_string')
|
||||
call airline#extensions#bufferline#init(s:ext)
|
||||
call add(loaded_ext, 'bufferline')
|
||||
endif
|
||||
|
||||
if (get(g:, 'airline#extensions#virtualenv#enabled', 1) && (exists(':VirtualEnvList') || isdirectory($VIRTUAL_ENV)))
|
||||
call airline#extensions#virtualenv#init(s:ext)
|
||||
call add(loaded_ext, 'virtualenv')
|
||||
endif
|
||||
|
||||
if (get(g:, 'airline#extensions#eclim#enabled', 1) && exists(':ProjectCreate'))
|
||||
call airline#extensions#eclim#init(s:ext)
|
||||
call add(loaded_ext, 'eclim')
|
||||
endif
|
||||
|
||||
if get(g:, 'airline#extensions#syntastic#enabled', 1)
|
||||
\ && exists(':SyntasticCheck')
|
||||
call airline#extensions#syntastic#init(s:ext)
|
||||
call add(loaded_ext, 'syntastic')
|
||||
endif
|
||||
|
||||
if (get(g:, 'airline#extensions#ale#enabled', 1) && exists(':ALELint'))
|
||||
call airline#extensions#ale#init(s:ext)
|
||||
call add(loaded_ext, 'ale')
|
||||
endif
|
||||
|
||||
if get(g:, 'airline#extensions#whitespace#enabled', 1)
|
||||
call airline#extensions#whitespace#init(s:ext)
|
||||
call add(loaded_ext, 'whitespace')
|
||||
endif
|
||||
|
||||
if (get(g:, 'airline#extensions#neomake#enabled', 1) && exists(':Neomake'))
|
||||
call airline#extensions#neomake#init(s:ext)
|
||||
call add(loaded_ext, 'neomake')
|
||||
endif
|
||||
|
||||
if get(g:, 'airline#extensions#po#enabled', 1) && executable('msgfmt')
|
||||
call airline#extensions#po#init(s:ext)
|
||||
call add(loaded_ext, 'po')
|
||||
endif
|
||||
|
||||
if get(g:, 'airline#extensions#wordcount#enabled', 1)
|
||||
call airline#extensions#wordcount#init(s:ext)
|
||||
call add(loaded_ext, 'wordcount')
|
||||
endif
|
||||
|
||||
if get(g:, 'airline#extensions#tabline#enabled', 0)
|
||||
call airline#extensions#tabline#init(s:ext)
|
||||
call add(loaded_ext, 'tabline')
|
||||
endif
|
||||
|
||||
if get(g:, 'airline#extensions#tmuxline#enabled', 1) && exists(':Tmuxline')
|
||||
call airline#extensions#tmuxline#init(s:ext)
|
||||
call add(loaded_ext, 'tmuxline')
|
||||
endif
|
||||
|
||||
if get(g:, 'airline#extensions#promptline#enabled', 1) && exists(':PromptlineSnapshot') && len(get(g:, 'airline#extensions#promptline#snapshot_file', ''))
|
||||
call airline#extensions#promptline#init(s:ext)
|
||||
call add(loaded_ext, 'promptline')
|
||||
endif
|
||||
|
||||
if get(g:, 'airline#extensions#nrrwrgn#enabled', 1) && exists(':NR') == 2
|
||||
call airline#extensions#nrrwrgn#init(s:ext)
|
||||
call add(loaded_ext, 'nrrwrgn')
|
||||
endif
|
||||
|
||||
if get(g:, 'airline#extensions#unicode#enabled', 1) && exists(':UnicodeTable') == 2
|
||||
call airline#extensions#unicode#init(s:ext)
|
||||
call add(loaded_ext, 'nrrwrgn')
|
||||
endif
|
||||
|
||||
if (get(g:, 'airline#extensions#capslock#enabled', 1) && exists('*CapsLockStatusline'))
|
||||
call airline#extensions#capslock#init(s:ext)
|
||||
call add(loaded_ext, 'capslock')
|
||||
endif
|
||||
|
||||
if (get(g:, 'airline#extensions#xkblayout#enabled', 1) && exists('g:XkbSwitchLib'))
|
||||
call airline#extensions#xkblayout#init(s:ext)
|
||||
call add(loaded_ext, 'xkblayout')
|
||||
endif
|
||||
|
||||
if (get(g:, 'airline#extensions#keymap#enabled', 1) && has('keymap'))
|
||||
call airline#extensions#keymap#init(s:ext)
|
||||
call add(loaded_ext, 'keymap')
|
||||
endif
|
||||
|
||||
if (get(g:, 'airline#extensions#windowswap#enabled', 1) && get(g:, 'loaded_windowswap', 0))
|
||||
call airline#extensions#windowswap#init(s:ext)
|
||||
call add(loaded_ext, 'windowswap')
|
||||
endif
|
||||
|
||||
if (get(g:, 'airline#extensions#obsession#enabled', 1) && exists('*ObsessionStatus'))
|
||||
call airline#extensions#obsession#init(s:ext)
|
||||
call add(loaded_ext, 'obsession')
|
||||
endif
|
||||
|
||||
runtime autoload/vimtex.vim
|
||||
if (get(g:, 'airline#extensions#vimtex#enabled', 1)) && exists('*vimtex#init')
|
||||
call airline#extensions#vimtex#init(s:ext)
|
||||
call add(loaded_ext, 'vimtex')
|
||||
endif
|
||||
|
||||
if !get(g:, 'airline#extensions#disable_rtp_load', 0)
|
||||
" load all other extensions, which are not part of the default distribution.
|
||||
" (autoload/airline/extensions/*.vim outside of our s:script_path).
|
||||
for file in split(globpath(&rtp, "autoload/airline/extensions/*.vim"), "\n")
|
||||
" we have to check both resolved and unresolved paths, since it's possible
|
||||
" that they might not get resolved properly (see #187)
|
||||
if stridx(tolower(resolve(fnamemodify(file, ':p'))), s:script_path) < 0
|
||||
\ && stridx(tolower(fnamemodify(file, ':p')), s:script_path) < 0
|
||||
let name = fnamemodify(file, ':t:r')
|
||||
if !get(g:, 'airline#extensions#'.name.'#enabled', 1) ||
|
||||
\ index(loaded_ext, name) > -1
|
||||
continue
|
||||
endif
|
||||
try
|
||||
call airline#extensions#{name}#init(s:ext)
|
||||
catch
|
||||
endtry
|
||||
endif
|
||||
endfor
|
||||
endif
|
||||
endfunction
|
||||
|
||||
56
.vim/autoload/airline/extensions/ale.vim
Normal file
56
.vim/autoload/airline/extensions/ale.vim
Normal file
@ -0,0 +1,56 @@
|
||||
" MIT License. Copyright (c) 2013-2017 Bjorn Neergaard, w0rp
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
let s:error_symbol = get(g:, 'airline#extensions#ale#error_symbol', 'E:')
|
||||
let s:warning_symbol = get(g:, 'airline#extensions#ale#warning_symbol', 'W:')
|
||||
|
||||
function! s:airline_ale_count(cnt, symbol)
|
||||
return a:cnt ? a:symbol. a:cnt : ''
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#ale#get(type)
|
||||
if !exists(':ALELint')
|
||||
return ''
|
||||
endif
|
||||
|
||||
let is_err = a:type ==# 'error'
|
||||
let symbol = is_err ? s:error_symbol : s:warning_symbol
|
||||
|
||||
let is_err = a:type ==# 'error'
|
||||
let counts = ale#statusline#Count(bufnr(''))
|
||||
let symbol = is_err ? s:error_symbol : s:warning_symbol
|
||||
|
||||
if type(counts) == type({}) && has_key(counts, 'error')
|
||||
" Use the current Dictionary format.
|
||||
let errors = counts.error + counts.style_error
|
||||
let num = is_err ? errors : counts.total - errors
|
||||
else
|
||||
" Use the old List format.
|
||||
let num = is_err ? counts[0] : counts[1]
|
||||
endif
|
||||
|
||||
return s:airline_ale_count(num, symbol)
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#ale#get_warning()
|
||||
return airline#extensions#ale#get('warning')
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#ale#get_error()
|
||||
return airline#extensions#ale#get('error')
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#ale#init(ext)
|
||||
call airline#parts#define_function('ale_error_count', 'airline#extensions#ale#get_error')
|
||||
call airline#parts#define_function('ale_warning_count', 'airline#extensions#ale#get_warning')
|
||||
augroup airline_ale
|
||||
autocmd!
|
||||
autocmd CursorHold,BufWritePost * call <sid>ale_refresh()
|
||||
augroup END
|
||||
endfunction
|
||||
|
||||
function! s:ale_refresh()
|
||||
if get(g:, 'airline_skip_empty_sections', 0)
|
||||
exe ':AirlineRefresh'
|
||||
endif
|
||||
endfunction
|
||||
336
.vim/autoload/airline/extensions/branch.vim
Normal file
336
.vim/autoload/airline/extensions/branch.vim
Normal file
@ -0,0 +1,336 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling et al.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
let s:has_fugitive = exists('*fugitive#head')
|
||||
let s:has_lawrencium = exists('*lawrencium#statusline')
|
||||
let s:has_vcscommand = get(g:, 'airline#extensions#branch#use_vcscommand', 0) && exists('*VCSCommandGetStatusLine')
|
||||
|
||||
if !s:has_fugitive && !s:has_lawrencium && !s:has_vcscommand
|
||||
finish
|
||||
endif
|
||||
|
||||
" s:vcs_config contains static configuration of VCSes and their status relative
|
||||
" to the active file.
|
||||
" 'branch' - The name of currently active branch. This field is empty iff it
|
||||
" has not been initialized yet or the current file is not in
|
||||
" an active branch.
|
||||
" 'untracked' - Cache of untracked files represented as a dictionary with files
|
||||
" as keys. A file has a not exists symbol set as its value if it
|
||||
" is untracked. A file is present in this dictionary iff its
|
||||
" status is considered up to date.
|
||||
" 'untracked_mark' - used as regexp to test against the output of 'cmd'
|
||||
let s:vcs_config = {
|
||||
\ 'git': {
|
||||
\ 'exe': 'git',
|
||||
\ 'cmd': 'git status --porcelain -- ',
|
||||
\ 'untracked_mark': '??',
|
||||
\ 'update_branch': 's:update_git_branch',
|
||||
\ 'exclude': '\.git',
|
||||
\ 'branch': '',
|
||||
\ 'untracked': {},
|
||||
\ },
|
||||
\ 'mercurial': {
|
||||
\ 'exe': 'hg',
|
||||
\ 'cmd': 'hg status -u -- ',
|
||||
\ 'untracked_mark': '?',
|
||||
\ 'exclude': '\.hg',
|
||||
\ 'update_branch': 's:update_hg_branch',
|
||||
\ 'branch': '',
|
||||
\ 'untracked': {},
|
||||
\ },
|
||||
\}
|
||||
|
||||
" Initializes b:buffer_vcs_config. b:buffer_vcs_config caches the branch and
|
||||
" untracked status of the file in the buffer. Caching those fields is necessary,
|
||||
" because s:vcs_config may be updated asynchronously and s:vcs_config fields may
|
||||
" be invalid during those updates. b:buffer_vcs_config fields are updated
|
||||
" whenever corresponding fields in s:vcs_config are updated or an inconsistency
|
||||
" is detected during update_* operation.
|
||||
"
|
||||
" b:airline_head caches the head string it is empty iff it needs to be
|
||||
" recalculated. b:airline_head is recalculated based on b:buffer_vcs_config.
|
||||
function! s:init_buffer()
|
||||
let b:buffer_vcs_config = {}
|
||||
for vcs in keys(s:vcs_config)
|
||||
let b:buffer_vcs_config[vcs] = {
|
||||
\ 'branch': '',
|
||||
\ 'untracked': '',
|
||||
\ }
|
||||
endfor
|
||||
unlet! b:airline_head
|
||||
endfunction
|
||||
|
||||
let s:head_format = get(g:, 'airline#extensions#branch#format', 0)
|
||||
if s:head_format == 1
|
||||
function! s:format_name(name)
|
||||
return fnamemodify(a:name, ':t')
|
||||
endfunction
|
||||
elseif s:head_format == 2
|
||||
function! s:format_name(name)
|
||||
return pathshorten(a:name)
|
||||
endfunction
|
||||
elseif type(s:head_format) == type('')
|
||||
function! s:format_name(name)
|
||||
return call(s:head_format, [a:name])
|
||||
endfunction
|
||||
else
|
||||
function! s:format_name(name)
|
||||
return a:name
|
||||
endfunction
|
||||
endif
|
||||
|
||||
let s:git_dirs = {}
|
||||
|
||||
function! s:update_git_branch(path)
|
||||
if !s:has_fugitive
|
||||
let s:vcs_config['git'].branch = ''
|
||||
return
|
||||
endif
|
||||
|
||||
let name = fugitive#head(7)
|
||||
if empty(name)
|
||||
if has_key(s:git_dirs, a:path)
|
||||
let s:vcs_config['git'].branch = s:git_dirs[a:path]
|
||||
return
|
||||
endif
|
||||
|
||||
let dir = fugitive#extract_git_dir(a:path)
|
||||
if empty(dir)
|
||||
let name = ''
|
||||
else
|
||||
try
|
||||
let line = join(readfile(dir . '/HEAD'))
|
||||
if strpart(line, 0, 16) == 'ref: refs/heads/'
|
||||
let name = strpart(line, 16)
|
||||
else
|
||||
" raw commit hash
|
||||
let name = strpart(line, 0, 7)
|
||||
endif
|
||||
catch
|
||||
let name = ''
|
||||
endtry
|
||||
endif
|
||||
endif
|
||||
|
||||
let s:git_dirs[a:path] = name
|
||||
let s:vcs_config['git'].branch = name
|
||||
endfunction
|
||||
|
||||
function! s:update_hg_branch(...)
|
||||
" path argument is not actually used, so we don't actually care about a:1
|
||||
" it is just needed, because update_git_branch needs it.
|
||||
if s:has_lawrencium
|
||||
let cmd='LC_ALL=C hg qtop'
|
||||
let stl=lawrencium#statusline()
|
||||
let file=expand('%:p')
|
||||
if !empty(stl) && get(b:, 'airline_do_mq_check', 1)
|
||||
if g:airline#init#vim_async
|
||||
call airline#async#get_mq_async(cmd, file)
|
||||
elseif has("nvim")
|
||||
call airline#async#nvim_get_mq_async(cmd, file)
|
||||
else
|
||||
" remove \n at the end of the command
|
||||
let output=system(cmd)[0:-2]
|
||||
call airline#async#mq_output(output, file)
|
||||
endif
|
||||
endif
|
||||
" do not do mq check anymore
|
||||
let b:airline_do_mq_check = 0
|
||||
if exists("b:mq") && !empty(b:mq)
|
||||
if stl is# 'default'
|
||||
" Shorten default a bit
|
||||
let stl='def'
|
||||
endif
|
||||
let stl.=' ['.b:mq.']'
|
||||
endif
|
||||
let s:vcs_config['mercurial'].branch = stl
|
||||
else
|
||||
let s:vcs_config['mercurial'].branch = ''
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:update_branch()
|
||||
let b:airline_fname_path = get(b:, 'airline_fname_path',
|
||||
\ exists("*fnamemodify") ? fnamemodify(resolve(@%), ":p:h") : expand("%:p:h"))
|
||||
for vcs in keys(s:vcs_config)
|
||||
call {s:vcs_config[vcs].update_branch}(b:airline_fname_path)
|
||||
if b:buffer_vcs_config[vcs].branch != s:vcs_config[vcs].branch
|
||||
let b:buffer_vcs_config[vcs].branch = s:vcs_config[vcs].branch
|
||||
unlet! b:airline_head
|
||||
endif
|
||||
endfor
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#branch#update_untracked_config(file, vcs)
|
||||
if !has_key(s:vcs_config[a:vcs].untracked, a:file)
|
||||
return
|
||||
elseif s:vcs_config[a:vcs].untracked[a:file] != b:buffer_vcs_config[a:vcs].untracked
|
||||
let b:buffer_vcs_config[a:vcs].untracked = s:vcs_config[a:vcs].untracked[a:file]
|
||||
unlet! b:airline_head
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:update_untracked()
|
||||
let file = expand("%:p")
|
||||
if empty(file) || isdirectory(file)
|
||||
return
|
||||
endif
|
||||
|
||||
let needs_update = 1
|
||||
for vcs in keys(s:vcs_config)
|
||||
if file =~ s:vcs_config[vcs].exclude
|
||||
" Skip check for files that live in the exclude directory
|
||||
let needs_update = 0
|
||||
endif
|
||||
if has_key(s:vcs_config[vcs].untracked, file)
|
||||
let needs_update = 0
|
||||
call airline#extensions#branch#update_untracked_config(file, vcs)
|
||||
endif
|
||||
endfor
|
||||
|
||||
if !needs_update
|
||||
return
|
||||
endif
|
||||
|
||||
for vcs in keys(s:vcs_config)
|
||||
let config = s:vcs_config[vcs]
|
||||
if g:airline#init#vim_async
|
||||
" Note that asynchronous update updates s:vcs_config only, and only
|
||||
" s:update_untracked updates b:buffer_vcs_config. If s:vcs_config is
|
||||
" invalidated again before s:update_untracked is called, then we lose the
|
||||
" result of the previous call, i.e. the head string is not updated. It
|
||||
" doesn't happen often in practice, so we let it be.
|
||||
call airline#async#vim_vcs_untracked(config, file)
|
||||
else
|
||||
" nvim async or vim without job-feature
|
||||
call airline#async#nvim_vcs_untracked(config, file, vcs)
|
||||
endif
|
||||
endfor
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#branch#head()
|
||||
if !exists('b:buffer_vcs_config')
|
||||
call s:init_buffer()
|
||||
endif
|
||||
|
||||
call s:update_branch()
|
||||
call s:update_untracked()
|
||||
|
||||
if exists('b:airline_head') && !empty(b:airline_head)
|
||||
return b:airline_head
|
||||
endif
|
||||
|
||||
let b:airline_head = ''
|
||||
let vcs_priority = get(g:, "airline#extensions#branch#vcs_priority", ["git", "mercurial"])
|
||||
|
||||
let heads = {}
|
||||
for vcs in vcs_priority
|
||||
if !empty(b:buffer_vcs_config[vcs].branch)
|
||||
let heads[vcs] = b:buffer_vcs_config[vcs].branch
|
||||
endif
|
||||
endfor
|
||||
|
||||
for vcs in keys(heads)
|
||||
if !empty(b:airline_head)
|
||||
let b:airline_head .= ' | '
|
||||
endif
|
||||
let b:airline_head .= (len(heads) > 1 ? s:vcs_config[vcs].exe .':' : '') . s:format_name(heads[vcs])
|
||||
let b:airline_head .= b:buffer_vcs_config[vcs].untracked
|
||||
endfor
|
||||
|
||||
if empty(heads)
|
||||
if s:has_vcscommand
|
||||
call VCSCommandEnableBufferSetup()
|
||||
if exists('b:VCSCommandBufferInfo')
|
||||
let b:airline_head = s:format_name(get(b:VCSCommandBufferInfo, 0, ''))
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
if exists("g:airline#extensions#branch#displayed_head_limit")
|
||||
let w:displayed_head_limit = g:airline#extensions#branch#displayed_head_limit
|
||||
if len(b:airline_head) > w:displayed_head_limit - 1
|
||||
let b:airline_head = b:airline_head[0:(w:displayed_head_limit - 1)].(&encoding ==? 'utf-8' ? '…' : '.')
|
||||
endif
|
||||
endif
|
||||
|
||||
if has_key(heads, 'git') && !s:check_in_path()
|
||||
let b:airline_head = ''
|
||||
endif
|
||||
let minwidth = empty(get(b:, 'airline_hunks', '')) ? 14 : 7
|
||||
let b:airline_head = airline#util#shorten(b:airline_head, 120, minwidth)
|
||||
return b:airline_head
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#branch#get_head()
|
||||
let head = airline#extensions#branch#head()
|
||||
let empty_message = get(g:, 'airline#extensions#branch#empty_message', '')
|
||||
let symbol = get(g:, 'airline#extensions#branch#symbol', g:airline_symbols.branch)
|
||||
return empty(head)
|
||||
\ ? empty_message
|
||||
\ : printf('%s%s', empty(symbol) ? '' : symbol.(g:airline_symbols.space), head)
|
||||
endfunction
|
||||
|
||||
function! s:check_in_path()
|
||||
if !exists('b:airline_file_in_root')
|
||||
let root = get(b:, 'git_dir', get(b:, 'mercurial_dir', ''))
|
||||
let bufferpath = resolve(fnamemodify(expand('%'), ':p'))
|
||||
|
||||
if !filereadable(root) "not a file
|
||||
" if .git is a directory, it's the old submodule format
|
||||
if match(root, '\.git$') >= 0
|
||||
let root = expand(fnamemodify(root, ':h'))
|
||||
else
|
||||
" else it's the newer format, and we need to guesstimate
|
||||
" 1) check for worktrees
|
||||
if match(root, 'worktrees') > -1
|
||||
" worktree can be anywhere, so simply assume true here
|
||||
return 1
|
||||
endif
|
||||
" 2) check for submodules
|
||||
let pattern = '\.git[\\/]\(modules\)[\\/]'
|
||||
if match(root, pattern) >= 0
|
||||
let root = substitute(root, pattern, '', '')
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
let b:airline_file_in_root = stridx(bufferpath, root) > -1
|
||||
endif
|
||||
return b:airline_file_in_root
|
||||
endfunction
|
||||
|
||||
function! s:reset_untracked_cache(shellcmdpost)
|
||||
" shellcmdpost - whether function was called as a result of ShellCmdPost hook
|
||||
if !g:airline#init#vim_async && !has('nvim')
|
||||
if a:shellcmdpost
|
||||
" Clear cache only if there was no error or the script uses an
|
||||
" asynchronous interface. Otherwise, cache clearing would overwrite
|
||||
" v:shell_error with a system() call inside get_*_untracked.
|
||||
if v:shell_error
|
||||
return
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
let file = expand("%:p")
|
||||
for vcs in keys(s:vcs_config)
|
||||
" Dump the value of the cache for the current file. Partially mitigates the
|
||||
" issue of cache invalidation happening before a call to
|
||||
" s:update_untracked()
|
||||
call airline#extensions#branch#update_untracked_config(file, vcs)
|
||||
let s:vcs_config[vcs].untracked = {}
|
||||
endfor
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#branch#init(ext)
|
||||
call airline#parts#define_function('branch', 'airline#extensions#branch#get_head')
|
||||
|
||||
autocmd BufReadPost * unlet! b:airline_file_in_root
|
||||
autocmd ShellCmdPost,CmdwinLeave * unlet! b:airline_head b:airline_do_mq_check b:airline_fname_path
|
||||
autocmd User AirlineBeforeRefresh unlet! b:airline_head b:airline_do_mq_check b:airline_fname_path
|
||||
autocmd BufWritePost * call s:reset_untracked_cache(0)
|
||||
autocmd ShellCmdPost * call s:reset_untracked_cache(1)
|
||||
endfunction
|
||||
29
.vim/autoload/airline/extensions/bufferline.vim
Normal file
29
.vim/autoload/airline/extensions/bufferline.vim
Normal file
@ -0,0 +1,29 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
if !exists('*bufferline#get_status_string')
|
||||
finish
|
||||
endif
|
||||
|
||||
let s:overwrite = get(g:, 'airline#extensions#bufferline#overwrite_variables', 1)
|
||||
|
||||
function! airline#extensions#bufferline#init(ext)
|
||||
if s:overwrite
|
||||
highlight bufferline_selected gui=bold cterm=bold term=bold
|
||||
highlight link bufferline_selected_inactive airline_c_inactive
|
||||
let g:bufferline_inactive_highlight = 'airline_c'
|
||||
let g:bufferline_active_highlight = 'bufferline_selected'
|
||||
let g:bufferline_active_buffer_left = ''
|
||||
let g:bufferline_active_buffer_right = ''
|
||||
let g:bufferline_separator = g:airline_symbols.space
|
||||
endif
|
||||
|
||||
if exists("+autochdir") && &autochdir == 1
|
||||
" if 'acd' is set, vim-airline uses the path section, so we need ot redefine this here as well
|
||||
call airline#parts#define_raw('path', '%{bufferline#refresh_status()}'.bufferline#get_status_string())
|
||||
else
|
||||
call airline#parts#define_raw('file', '%{bufferline#refresh_status()}'.bufferline#get_status_string())
|
||||
endif
|
||||
endfunction
|
||||
17
.vim/autoload/airline/extensions/capslock.vim
Normal file
17
.vim/autoload/airline/extensions/capslock.vim
Normal file
@ -0,0 +1,17 @@
|
||||
" MIT License. Copyright (c) 2014 Mathias Andersson.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
if !exists('*CapsLockStatusline')
|
||||
finish
|
||||
endif
|
||||
|
||||
function! airline#extensions#capslock#status()
|
||||
return tolower(CapsLockStatusline()) == '[caps]' ? 'CAPS' : ''
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#capslock#init(ext)
|
||||
call airline#parts#define_function('capslock', 'airline#extensions#capslock#status')
|
||||
endfunction
|
||||
|
||||
18
.vim/autoload/airline/extensions/commandt.vim
Normal file
18
.vim/autoload/airline/extensions/commandt.vim
Normal file
@ -0,0 +1,18 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
if !get(g:, 'command_t_loaded', 0)
|
||||
finish
|
||||
endif
|
||||
|
||||
function! airline#extensions#commandt#apply(...)
|
||||
if bufname('%') ==# 'GoToFile'
|
||||
call airline#extensions#apply_left_override('CommandT', '')
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#commandt#init(ext)
|
||||
call a:ext.add_statusline_func('airline#extensions#commandt#apply')
|
||||
endfunction
|
||||
33
.vim/autoload/airline/extensions/csv.vim
Normal file
33
.vim/autoload/airline/extensions/csv.vim
Normal file
@ -0,0 +1,33 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
if !get(g:, 'loaded_csv', 0) && !exists(':Table')
|
||||
finish
|
||||
endif
|
||||
|
||||
let s:column_display = get(g:, 'airline#extensions#csv#column_display', 'Number')
|
||||
|
||||
function! airline#extensions#csv#get_column()
|
||||
if exists('*CSV_WCol')
|
||||
if s:column_display ==# 'Name'
|
||||
return '['.CSV_WCol('Name').CSV_WCol().']'
|
||||
else
|
||||
return '['.CSV_WCol().']'
|
||||
endif
|
||||
endif
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#csv#apply(...)
|
||||
if &ft ==# "csv"
|
||||
call airline#extensions#prepend_to_section('gutter',
|
||||
\ g:airline_left_alt_sep.' %{airline#extensions#csv#get_column()}')
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#csv#init(ext)
|
||||
call a:ext.add_statusline_func('airline#extensions#csv#apply')
|
||||
endfunction
|
||||
|
||||
82
.vim/autoload/airline/extensions/ctrlp.vim
Normal file
82
.vim/autoload/airline/extensions/ctrlp.vim
Normal file
@ -0,0 +1,82 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
if !get(g:, 'loaded_ctrlp', 0)
|
||||
finish
|
||||
endif
|
||||
|
||||
let s:color_template = get(g:, 'airline#extensions#ctrlp#color_template', 'insert')
|
||||
|
||||
function! airline#extensions#ctrlp#generate_color_map(dark, light, white)
|
||||
return {
|
||||
\ 'CtrlPdark' : a:dark,
|
||||
\ 'CtrlPlight' : a:light,
|
||||
\ 'CtrlPwhite' : a:white,
|
||||
\ 'CtrlParrow1' : [ a:light[1] , a:white[1] , a:light[3] , a:white[3] , '' ] ,
|
||||
\ 'CtrlParrow2' : [ a:white[1] , a:light[1] , a:white[3] , a:light[3] , '' ] ,
|
||||
\ 'CtrlParrow3' : [ a:light[1] , a:dark[1] , a:light[3] , a:dark[3] , '' ] ,
|
||||
\ }
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#ctrlp#load_theme(palette)
|
||||
if exists('a:palette.ctrlp')
|
||||
let theme = a:palette.ctrlp
|
||||
else
|
||||
let s:color_template = has_key(a:palette, s:color_template) ? s:color_template : 'insert'
|
||||
let theme = airline#extensions#ctrlp#generate_color_map(
|
||||
\ a:palette[s:color_template]['airline_c'],
|
||||
\ a:palette[s:color_template]['airline_b'],
|
||||
\ a:palette[s:color_template]['airline_a'])
|
||||
endif
|
||||
for key in keys(theme)
|
||||
call airline#highlighter#exec(key, theme[key])
|
||||
endfor
|
||||
endfunction
|
||||
|
||||
" Arguments: focus, byfname, regexp, prv, item, nxt, marked
|
||||
function! airline#extensions#ctrlp#ctrlp_airline(...)
|
||||
let b = airline#builder#new({'active': 1})
|
||||
if a:2 == 'file'
|
||||
call b.add_section_spaced('CtrlPlight', 'by fname')
|
||||
endif
|
||||
if a:3
|
||||
call b.add_section_spaced('CtrlPlight', 'regex')
|
||||
endif
|
||||
if get(g:, 'airline#extensions#ctrlp#show_adjacent_modes', 1)
|
||||
call b.add_section_spaced('CtrlPlight', a:4)
|
||||
call b.add_section_spaced('CtrlPwhite', a:5)
|
||||
call b.add_section_spaced('CtrlPlight', a:6)
|
||||
else
|
||||
call b.add_section_spaced('CtrlPwhite', a:5)
|
||||
endif
|
||||
call b.add_section_spaced('CtrlPdark', a:7)
|
||||
call b.split()
|
||||
call b.add_section_spaced('CtrlPdark', a:1)
|
||||
call b.add_section_spaced('CtrlPdark', a:2)
|
||||
call b.add_section_spaced('CtrlPlight', '%{getcwd()}')
|
||||
return b.build()
|
||||
endfunction
|
||||
|
||||
" Argument: len
|
||||
function! airline#extensions#ctrlp#ctrlp_airline_status(...)
|
||||
let len = '%#CtrlPdark# '.a:1
|
||||
let dir = '%=%<%#CtrlParrow3#'.g:airline_right_sep.'%#CtrlPlight# '.getcwd().' %*'
|
||||
return len.dir
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#ctrlp#apply(...)
|
||||
" disable statusline overwrite if ctrlp already did it
|
||||
return match(&statusline, 'CtrlPwhite') >= 0 ? -1 : 0
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#ctrlp#init(ext)
|
||||
let g:ctrlp_status_func = {
|
||||
\ 'main': 'airline#extensions#ctrlp#ctrlp_airline',
|
||||
\ 'prog': 'airline#extensions#ctrlp#ctrlp_airline_status',
|
||||
\ }
|
||||
call a:ext.add_statusline_func('airline#extensions#ctrlp#apply')
|
||||
call a:ext.add_theme_func('airline#extensions#ctrlp#load_theme')
|
||||
endfunction
|
||||
|
||||
20
.vim/autoload/airline/extensions/ctrlspace.vim
Normal file
20
.vim/autoload/airline/extensions/ctrlspace.vim
Normal file
@ -0,0 +1,20 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
let s:spc = g:airline_symbols.space
|
||||
let s:padding = s:spc . s:spc . s:spc
|
||||
let s:cs = ctrlspace#context#Configuration().Symbols.CS
|
||||
|
||||
function! airline#extensions#ctrlspace#statusline(...)
|
||||
let b = airline#builder#new({ 'active': 1 })
|
||||
call b.add_section('airline_b', s:cs . s:padding . ctrlspace#api#StatuslineModeSegment(s:padding))
|
||||
call b.split()
|
||||
call b.add_section('airline_x', s:spc . ctrlspace#api#StatuslineTabSegment() . s:spc)
|
||||
return b.build()
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#ctrlspace#init(ext)
|
||||
let g:CtrlSpaceStatuslineFunction = "airline#extensions#ctrlspace#statusline()"
|
||||
endfunction
|
||||
101
.vim/autoload/airline/extensions/default.vim
Normal file
101
.vim/autoload/airline/extensions/default.vim
Normal file
@ -0,0 +1,101 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
let s:section_use_groups = get(g:, 'airline#extensions#default#section_use_groupitems', 1)
|
||||
let s:section_truncate_width = get(g:, 'airline#extensions#default#section_truncate_width', {
|
||||
\ 'b': 79,
|
||||
\ 'x': 60,
|
||||
\ 'y': 88,
|
||||
\ 'z': 45,
|
||||
\ 'warning': 80,
|
||||
\ 'error': 80,
|
||||
\ })
|
||||
let s:layout = get(g:, 'airline#extensions#default#layout', [
|
||||
\ [ 'a', 'b', 'c' ],
|
||||
\ [ 'x', 'y', 'z', 'warning', 'error' ]
|
||||
\ ])
|
||||
|
||||
function! s:get_section(winnr, key, ...)
|
||||
if has_key(s:section_truncate_width, a:key)
|
||||
if winwidth(a:winnr) < s:section_truncate_width[a:key]
|
||||
return ''
|
||||
endif
|
||||
endif
|
||||
let spc = g:airline_symbols.space
|
||||
if !exists('g:airline_section_{a:key}')
|
||||
return ''
|
||||
endif
|
||||
let text = airline#util#getwinvar(a:winnr, 'airline_section_'.a:key, g:airline_section_{a:key})
|
||||
let [prefix, suffix] = [get(a:000, 0, '%('.spc), get(a:000, 1, spc.'%)')]
|
||||
return empty(text) ? '' : prefix.text.suffix
|
||||
endfunction
|
||||
|
||||
function! s:build_sections(builder, context, keys)
|
||||
for key in a:keys
|
||||
if (key == 'warning' || key == 'error') && !a:context.active
|
||||
continue
|
||||
endif
|
||||
call s:add_section(a:builder, a:context, key)
|
||||
endfor
|
||||
endfunction
|
||||
|
||||
" There still is a highlighting bug when using groups %(%) in the statusline,
|
||||
" deactivate it, unless it is fixed (7.4.1511)
|
||||
if s:section_use_groups && (v:version >= 704 || (v:version >= 703 && has('patch81')))
|
||||
function! s:add_section(builder, context, key)
|
||||
let condition = (a:key is# "warning" || a:key is# "error") &&
|
||||
\ (v:version == 704 && !has("patch1511"))
|
||||
" i have no idea why the warning section needs special treatment, but it's
|
||||
" needed to prevent separators from showing up
|
||||
if ((a:key == 'error' || a:key == 'warning') && empty(s:get_section(a:context.winnr, a:key)))
|
||||
return
|
||||
endif
|
||||
if condition
|
||||
call a:builder.add_raw('%(')
|
||||
endif
|
||||
call a:builder.add_section('airline_'.a:key, s:get_section(a:context.winnr, a:key))
|
||||
if condition
|
||||
call a:builder.add_raw('%)')
|
||||
endif
|
||||
endfunction
|
||||
else
|
||||
" older version don't like the use of %(%)
|
||||
function! s:add_section(builder, context, key)
|
||||
if ((a:key == 'error' || a:key == 'warning') && empty(s:get_section(a:context.winnr, a:key)))
|
||||
return
|
||||
endif
|
||||
if a:key == 'warning'
|
||||
call a:builder.add_raw('%#airline_warning#'.s:get_section(a:context.winnr, a:key))
|
||||
elseif a:key == 'error'
|
||||
call a:builder.add_raw('%#airline_error#'.s:get_section(a:context.winnr, a:key))
|
||||
else
|
||||
call a:builder.add_section('airline_'.a:key, s:get_section(a:context.winnr, a:key))
|
||||
endif
|
||||
endfunction
|
||||
endif
|
||||
|
||||
function! airline#extensions#default#apply(builder, context)
|
||||
let winnr = a:context.winnr
|
||||
let active = a:context.active
|
||||
|
||||
if airline#util#getwinvar(winnr, 'airline_render_left', active || (!active && !g:airline_inactive_collapse))
|
||||
call s:build_sections(a:builder, a:context, s:layout[0])
|
||||
else
|
||||
let text = s:get_section(winnr, 'c')
|
||||
if empty(text)
|
||||
let text = ' %f%m '
|
||||
endif
|
||||
call a:builder.add_section('airline_c'.(a:context.bufnr), text)
|
||||
endif
|
||||
|
||||
call a:builder.split(s:get_section(winnr, 'gutter', '', ''))
|
||||
|
||||
if airline#util#getwinvar(winnr, 'airline_render_right', 1)
|
||||
call s:build_sections(a:builder, a:context, s:layout[1])
|
||||
endif
|
||||
|
||||
return 1
|
||||
endfunction
|
||||
|
||||
42
.vim/autoload/airline/extensions/denite.vim
Normal file
42
.vim/autoload/airline/extensions/denite.vim
Normal file
@ -0,0 +1,42 @@
|
||||
" MIT License. Copyright (c) 2017 Thomas Dy
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
if !get(g:, 'loaded_denite', 0)
|
||||
finish
|
||||
endif
|
||||
|
||||
" Denite does not use vim's built-in modal editing but has a custom prompt
|
||||
" that implements its own insert/normal mode so we have to handle changing the
|
||||
" highlight
|
||||
function! airline#extensions#denite#check_denite_mode(bufnr)
|
||||
if &filetype != 'denite'
|
||||
return ''
|
||||
endif
|
||||
let mode = split(denite#get_status_mode(), ' ')
|
||||
let mode = tolower(mode[1])
|
||||
if !exists('b:denite_mode_cache') || mode != b:denite_mode_cache
|
||||
call airline#highlighter#highlight([mode], a:bufnr)
|
||||
let b:denite_mode_cache = mode
|
||||
endif
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#denite#apply(...)
|
||||
if &ft == 'denite'
|
||||
let w:airline_skip_empty_sections = 0
|
||||
call a:1.add_section('airline_a', ' Denite %{airline#extensions#denite#check_denite_mode('.a:2['bufnr'].')}')
|
||||
call a:1.add_section('airline_c', ' %{denite#get_status_sources()}')
|
||||
call a:1.split()
|
||||
call a:1.add_section('airline_y', ' %{denite#get_status_path()} ')
|
||||
call a:1.add_section('airline_z', ' %{denite#get_status_linenr()} ')
|
||||
return 1
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#denite#init(ext)
|
||||
call denite#custom#option('_', 'statusline', 0)
|
||||
call a:ext.add_statusline_func('airline#extensions#denite#apply')
|
||||
endfunction
|
||||
|
||||
62
.vim/autoload/airline/extensions/eclim.vim
Normal file
62
.vim/autoload/airline/extensions/eclim.vim
Normal file
@ -0,0 +1,62 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
if !exists(':ProjectCreate')
|
||||
finish
|
||||
endif
|
||||
|
||||
function! airline#extensions#eclim#creat_line(...)
|
||||
if &filetype == "tree"
|
||||
let builder = a:1
|
||||
call builder.add_section('airline_a', ' Project ')
|
||||
call builder.add_section('airline_b', ' %f ')
|
||||
call builder.add_section('airline_c', '')
|
||||
return 1
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#eclim#get_warnings()
|
||||
" Cache vavlues, so that it isn't called too often
|
||||
if exists("s:eclim_errors") &&
|
||||
\ get(b:, 'airline_changenr', 0) == changenr()
|
||||
return s:eclim_errors
|
||||
endif
|
||||
let eclimList = eclim#display#signs#GetExisting()
|
||||
let s:eclim_errors = ''
|
||||
|
||||
if !empty(eclimList)
|
||||
" Remove any non-eclim signs (see eclim#display#signs#Update)
|
||||
" First check for just errors since they are more important.
|
||||
" If there are no errors, then check for warnings.
|
||||
let errorList = filter(copy(eclimList), 'v:val.name =~ "^\\(qf_\\)\\?\\(error\\)$"')
|
||||
|
||||
if (empty(errorList))
|
||||
" use the warnings
|
||||
call filter(eclimList, 'v:val.name =~ "^\\(qf_\\)\\?\\(warning\\)$"')
|
||||
let type = 'W'
|
||||
else
|
||||
" Use the errors
|
||||
let eclimList = errorList
|
||||
let type = 'E'
|
||||
endif
|
||||
|
||||
if !empty(eclimList)
|
||||
let errorsLine = eclimList[0]['line']
|
||||
let errorsNumber = len(eclimList)
|
||||
let errors = "[Eclim:" . type . " line:".string(errorsLine)." (".string(errorsNumber).")]"
|
||||
if !exists(':SyntasticCheck') || SyntasticStatuslineFlag() == ''
|
||||
let s:eclim_errors = errors.(g:airline_symbols.space)
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
let b:airline_changenr = changenr()
|
||||
return s:eclim_errors
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#eclim#init(ext)
|
||||
call airline#parts#define_function('eclim', 'airline#extensions#eclim#get_warnings')
|
||||
call a:ext.add_statusline_func('airline#extensions#eclim#creat_line')
|
||||
endfunction
|
||||
|
||||
56
.vim/autoload/airline/extensions/example.vim
Normal file
56
.vim/autoload/airline/extensions/example.vim
Normal file
@ -0,0 +1,56 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
" we don't actually want this loaded :P
|
||||
finish
|
||||
|
||||
" Due to some potential rendering issues, the use of the `space` variable is
|
||||
" recommended.
|
||||
let s:spc = g:airline_symbols.space
|
||||
|
||||
" Extension specific variables can be defined the usual fashion.
|
||||
if !exists('g:airline#extensions#example#number_of_cats')
|
||||
let g:airline#extensions#example#number_of_cats = 42
|
||||
endif
|
||||
|
||||
" First we define an init function that will be invoked from extensions.vim
|
||||
function! airline#extensions#example#init(ext)
|
||||
|
||||
" Here we define a new part for the plugin. This allows users to place this
|
||||
" extension in arbitrary locations.
|
||||
call airline#parts#define_raw('cats', '%{airline#extensions#example#get_cats()}')
|
||||
|
||||
" Next up we add a funcref so that we can run some code prior to the
|
||||
" statusline getting modifed.
|
||||
call a:ext.add_statusline_func('airline#extensions#example#apply')
|
||||
|
||||
" You can also add a funcref for inactive statuslines.
|
||||
" call a:ext.add_inactive_statusline_func('airline#extensions#example#unapply')
|
||||
endfunction
|
||||
|
||||
" This function will be invoked just prior to the statusline getting modified.
|
||||
function! airline#extensions#example#apply(...)
|
||||
" First we check for the filetype.
|
||||
if &filetype == "nyancat"
|
||||
|
||||
" Let's say we want to append to section_c, first we check if there's
|
||||
" already a window-local override, and if not, create it off of the global
|
||||
" section_c.
|
||||
let w:airline_section_c = get(w:, 'airline_section_c', g:airline_section_c)
|
||||
|
||||
" Then we just append this extenion to it, optionally using separators.
|
||||
let w:airline_section_c .= s:spc.g:airline_left_alt_sep.s:spc.'%{airline#extensions#example#get_cats()}'
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" Finally, this function will be invoked from the statusline.
|
||||
function! airline#extensions#example#get_cats()
|
||||
let cats = ''
|
||||
for i in range(1, g:airline#extensions#example#number_of_cats)
|
||||
let cats .= ' (,,,)=(^.^)=(,,,) '
|
||||
endfor
|
||||
return cats
|
||||
endfunction
|
||||
|
||||
93
.vim/autoload/airline/extensions/hunks.vim
Normal file
93
.vim/autoload/airline/extensions/hunks.vim
Normal file
@ -0,0 +1,93 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
if !get(g:, 'loaded_signify', 0) && !get(g:, 'loaded_gitgutter', 0) && !get(g:, 'loaded_changes', 0) && !get(g:, 'loaded_quickfixsigns', 0)
|
||||
finish
|
||||
endif
|
||||
|
||||
let s:non_zero_only = get(g:, 'airline#extensions#hunks#non_zero_only', 0)
|
||||
let s:hunk_symbols = get(g:, 'airline#extensions#hunks#hunk_symbols', ['+', '~', '-'])
|
||||
|
||||
function! s:get_hunks_signify()
|
||||
let hunks = sy#repo#get_stats()
|
||||
if hunks[0] >= 0
|
||||
return hunks
|
||||
endif
|
||||
return []
|
||||
endfunction
|
||||
|
||||
function! s:is_branch_empty()
|
||||
return exists('*airline#extensions#branch#head') &&
|
||||
\ empty(get(b:, 'airline_head', ''))
|
||||
endfunction
|
||||
|
||||
function! s:get_hunks_gitgutter()
|
||||
if !get(g:, 'gitgutter_enabled', 0) || s:is_branch_empty()
|
||||
return ''
|
||||
endif
|
||||
return GitGutterGetHunkSummary()
|
||||
endfunction
|
||||
|
||||
function! s:get_hunks_changes()
|
||||
if !get(b:, 'changes_view_enabled', 0) || s:is_branch_empty()
|
||||
return []
|
||||
endif
|
||||
let hunks = changes#GetStats()
|
||||
return hunks == [0, 0, 0] ? [] : hunks
|
||||
endfunction
|
||||
|
||||
function! s:get_hunks_empty()
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
function! s:get_hunks()
|
||||
if !exists('b:source_func') || get(b:, 'source_func', '') is# 's:get_hunks_empty'
|
||||
if get(g:, 'loaded_signify') && sy#buffer_is_active()
|
||||
let b:source_func = 's:get_hunks_signify'
|
||||
elseif exists('*GitGutterGetHunkSummary')
|
||||
let b:source_func = 's:get_hunks_gitgutter'
|
||||
elseif exists('*changes#GetStats')
|
||||
let b:source_func = 's:get_hunks_changes'
|
||||
elseif exists('*quickfixsigns#vcsdiff#GetHunkSummary')
|
||||
let b:source_func = 'quickfixsigns#vcsdiff#GetHunkSummary'
|
||||
else
|
||||
let b:source_func = 's:get_hunks_empty'
|
||||
endif
|
||||
endif
|
||||
return {b:source_func}()
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#hunks#get_hunks()
|
||||
if !get(w:, 'airline_active', 0)
|
||||
return ''
|
||||
endif
|
||||
" Cache values, so that it isn't called too often
|
||||
if exists("b:airline_hunks") &&
|
||||
\ get(b:, 'airline_changenr', 0) == b:changedtick &&
|
||||
\ winwidth(0) == get(s:, 'airline_winwidth', 0) &&
|
||||
\ get(b:, 'source_func', '') isnot# 's:get_hunks_signify' &&
|
||||
\ get(b:, 'source_func', '') isnot# 's:get_hunks_gitgutter' &&
|
||||
\ get(b:, 'source_func', '') isnot# 's:get_hunks_empty' &&
|
||||
\ get(b:, 'source_func', '') isnot# 's:get_hunks_changes'
|
||||
return b:airline_hunks
|
||||
endif
|
||||
let hunks = s:get_hunks()
|
||||
let string = ''
|
||||
if !empty(hunks)
|
||||
for i in [0, 1, 2]
|
||||
if (s:non_zero_only == 0 && winwidth(0) > 100) || hunks[i] > 0
|
||||
let string .= printf('%s%s ', s:hunk_symbols[i], hunks[i])
|
||||
endif
|
||||
endfor
|
||||
endif
|
||||
let b:airline_hunks = string
|
||||
let b:airline_changenr = b:changedtick
|
||||
let s:airline_winwidth = winwidth(0)
|
||||
return string
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#hunks#init(ext)
|
||||
call airline#parts#define_function('hunks', 'airline#extensions#hunks#get_hunks')
|
||||
endfunction
|
||||
20
.vim/autoload/airline/extensions/keymap.vim
Normal file
20
.vim/autoload/airline/extensions/keymap.vim
Normal file
@ -0,0 +1,20 @@
|
||||
" MIT License. Copyright (c) 2013-2017 Doron Behar, C.Brabandt
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
if !has('keymap')
|
||||
finish
|
||||
endif
|
||||
|
||||
function! airline#extensions#keymap#status()
|
||||
if (get(g:, 'airline#extensions#keymap#enabled', 1) && has('keymap'))
|
||||
return printf('%s', (!empty(&keymap) ? (g:airline_symbols.keymap . ' '. &keymap) : ''))
|
||||
else
|
||||
return ''
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#keymap#init(ext)
|
||||
call airline#parts#define_function('keymap', 'airline#extensions#keymap#status')
|
||||
endfunction
|
||||
35
.vim/autoload/airline/extensions/neomake.vim
Normal file
35
.vim/autoload/airline/extensions/neomake.vim
Normal file
@ -0,0 +1,35 @@
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
if !exists(':Neomake')
|
||||
finish
|
||||
endif
|
||||
|
||||
let s:error_symbol = get(g:, 'airline#extensions#neomake#error_symbol', 'E:')
|
||||
let s:warning_symbol = get(g:, 'airline#extensions#neomake#warning_symbol', 'W:')
|
||||
|
||||
function! s:get_counts()
|
||||
let l:counts = neomake#statusline#LoclistCounts()
|
||||
|
||||
if empty(l:counts)
|
||||
return neomake#statusline#QflistCounts()
|
||||
else
|
||||
return l:counts
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#neomake#get_warnings()
|
||||
let counts = s:get_counts()
|
||||
let warnings = get(counts, 'W', 0)
|
||||
return warnings ? s:warning_symbol.warnings : ''
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#neomake#get_errors()
|
||||
let counts = s:get_counts()
|
||||
let errors = get(counts, 'E', 0)
|
||||
return errors ? s:error_symbol.errors : ''
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#neomake#init(ext)
|
||||
call airline#parts#define_function('neomake_warning_count', 'airline#extensions#neomake#get_warnings')
|
||||
call airline#parts#define_function('neomake_error_count', 'airline#extensions#neomake#get_errors')
|
||||
endfunction
|
||||
34
.vim/autoload/airline/extensions/netrw.vim
Normal file
34
.vim/autoload/airline/extensions/netrw.vim
Normal file
@ -0,0 +1,34 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
if !exists(':NetrwSettings')
|
||||
finish
|
||||
endif
|
||||
|
||||
function! airline#extensions#netrw#apply(...)
|
||||
if &ft == 'netrw'
|
||||
let spc = g:airline_symbols.space
|
||||
|
||||
call a:1.add_section('airline_a', spc.'netrw'.spc)
|
||||
if exists('*airline#extensions#branch#get_head')
|
||||
call a:1.add_section('airline_b', spc.'%{airline#extensions#branch#get_head()}'.spc)
|
||||
endif
|
||||
call a:1.add_section('airline_c', spc.'%f'.spc)
|
||||
call a:1.split()
|
||||
call a:1.add_section('airline_y', spc.'%{airline#extensions#netrw#sortstring()}'.spc)
|
||||
return 1
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#netrw#init(ext)
|
||||
let g:netrw_force_overwrite_statusline = 0
|
||||
call a:ext.add_statusline_func('airline#extensions#netrw#apply')
|
||||
endfunction
|
||||
|
||||
|
||||
function! airline#extensions#netrw#sortstring()
|
||||
let order = (get(g:, 'netrw_sort_direction', 'n') =~ 'n') ? '+' : '-'
|
||||
return g:netrw_sort_by . (g:airline_symbols.space) . '[' . order . ']'
|
||||
endfunction
|
||||
57
.vim/autoload/airline/extensions/nrrwrgn.vim
Normal file
57
.vim/autoload/airline/extensions/nrrwrgn.vim
Normal file
@ -0,0 +1,57 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
if !get(g:, 'loaded_nrrw_rgn', 0)
|
||||
finish
|
||||
endif
|
||||
|
||||
function! airline#extensions#nrrwrgn#apply(...)
|
||||
if exists(":WidenRegion") == 2
|
||||
let spc = g:airline_symbols.space
|
||||
if !exists("*nrrwrgn#NrrwRgnStatus()") || empty(nrrwrgn#NrrwRgnStatus())
|
||||
call a:1.add_section('airline_a', printf('%s[Narrowed%s#%d]', spc, spc, b:nrrw_instn))
|
||||
let bufname=(get(b:, 'orig_buf', 0) ? bufname(b:orig_buf) : substitute(bufname('%'), '^Nrrwrgn_\zs.*\ze_\d\+$', submatch(0), ''))
|
||||
call a:1.add_section('airline_c', spc.bufname.spc)
|
||||
call a:1.split()
|
||||
else
|
||||
let dict=nrrwrgn#NrrwRgnStatus()
|
||||
let vmode = { 'v': 'Char ', 'V': 'Line ', '': 'Block '}
|
||||
let mode = dict.visual ? vmode[dict.visual] : vmode['V']
|
||||
let winwidth = winwidth(0)
|
||||
if winwidth < 80
|
||||
let mode = mode[0]
|
||||
endif
|
||||
let title = (winwidth < 80 ? "Nrrw" : "Narrowed ")
|
||||
let multi = (winwidth < 80 ? 'M' : 'Multi')
|
||||
call a:1.add_section('airline_a', printf('[%s%s%s#%d]%s', (dict.multi ? multi : ""),
|
||||
\ title, mode, b:nrrw_instn, spc))
|
||||
let name = dict.fullname
|
||||
if name !=# '[No Name]'
|
||||
if winwidth > 100
|
||||
" need some space
|
||||
let name = fnamemodify(dict.fullname, ':~')
|
||||
if strlen(name) > 8
|
||||
" shorten name
|
||||
let name = substitute(name, '\(.\)[^/\\]*\([/\\]\)', '\1\2', 'g')
|
||||
endif
|
||||
else
|
||||
let name = fnamemodify(dict.fullname, ':t')
|
||||
endif
|
||||
endif
|
||||
let range=(dict.multi ? '' : printf("[%d-%d]", dict.start[1], dict.end[1]))
|
||||
call a:1.add_section('airline_c', printf("%s %s %s", name, range,
|
||||
\ dict.enabled ? (&encoding ==? 'utf-8' ? "\u2713" : '') : '!'))
|
||||
call a:1.split()
|
||||
call a:1.add_section('airline_x', get(g:, 'airline_section_x').spc)
|
||||
call a:1.add_section('airline_y', spc.get(g:, 'airline_section_y').spc)
|
||||
call a:1.add_section('airline_z', spc.get(g:, 'airline_section_z'))
|
||||
endif
|
||||
return 1
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#nrrwrgn#init(ext)
|
||||
call a:ext.add_statusline_func('airline#extensions#nrrwrgn#apply')
|
||||
endfunction
|
||||
22
.vim/autoload/airline/extensions/obsession.vim
Normal file
22
.vim/autoload/airline/extensions/obsession.vim
Normal file
@ -0,0 +1,22 @@
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
if !exists('*ObsessionStatus')
|
||||
finish
|
||||
endif
|
||||
|
||||
let s:spc = g:airline_symbols.space
|
||||
|
||||
if !exists('g:airline#extensions#obsession#indicator_text')
|
||||
let g:airline#extensions#obsession#indicator_text = '$'
|
||||
endif
|
||||
|
||||
function! airline#extensions#obsession#init(ext)
|
||||
call airline#parts#define_function('obsession', 'airline#extensions#obsession#get_status')
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#obsession#get_status()
|
||||
return ObsessionStatus((g:airline#extensions#obsession#indicator_text . s:spc), '')
|
||||
endfunction
|
||||
|
||||
50
.vim/autoload/airline/extensions/po.vim
Normal file
50
.vim/autoload/airline/extensions/po.vim
Normal file
@ -0,0 +1,50 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
function! airline#extensions#po#shorten()
|
||||
if exists("g:airline#extensions#po#displayed_limit")
|
||||
let w:displayed_po_limit = g:airline#extensions#po#displayed_limit
|
||||
if len(b:airline_po_stats) > w:displayed_po_limit - 1
|
||||
let b:airline_po_stats = b:airline_po_stats[0:(w:displayed_po_limit - 2)].(&encoding==?'utf-8' ? '…' : '.'). ']'
|
||||
endif
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#po#apply(...)
|
||||
if &ft ==# 'po'
|
||||
call airline#extensions#prepend_to_section('z', '%{airline#extensions#po#stats()}')
|
||||
autocmd airline BufWritePost * unlet! b:airline_po_stats
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#po#stats()
|
||||
if exists('b:airline_po_stats') && !empty(b:airline_po_stats)
|
||||
return b:airline_po_stats
|
||||
endif
|
||||
|
||||
let cmd = 'msgfmt --statistics -o /dev/null -- '
|
||||
if g:airline#init#vim_async
|
||||
call airline#async#get_msgfmt_stat(cmd, expand('%:p'))
|
||||
elseif has("nvim")
|
||||
call airline#async#nvim_get_msgfmt_stat(cmd, expand('%:p'))
|
||||
else
|
||||
let airline_po_stats = system(cmd. shellescape(expand('%:p')))
|
||||
if v:shell_error
|
||||
return ''
|
||||
endif
|
||||
try
|
||||
let b:airline_po_stats = '['. split(airline_po_stats, '\n')[0]. ']'
|
||||
let b:airline_po_stats = substitute(b:airline_po_stats, ' \(message\|translation\)s*\.*', '', 'g')
|
||||
catch
|
||||
let b:airline_po_stats = ''
|
||||
endtry
|
||||
call airline#extensions#po#shorten()
|
||||
endif
|
||||
return get(b:, 'airline_po_stats', '')
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#po#init(ext)
|
||||
call a:ext.add_statusline_func('airline#extensions#po#apply')
|
||||
endfunction
|
||||
35
.vim/autoload/airline/extensions/promptline.vim
Normal file
35
.vim/autoload/airline/extensions/promptline.vim
Normal file
@ -0,0 +1,35 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
if !exists(':PromptlineSnapshot')
|
||||
finish
|
||||
endif
|
||||
|
||||
if !exists('airline#extensions#promptline#snapshot_file') || !len('airline#extensions#promptline#snapshot_file')
|
||||
finish
|
||||
endif
|
||||
|
||||
let s:prompt_snapshot_file = get(g:, 'airline#extensions#promptline#snapshot_file', '')
|
||||
let s:color_template = get(g:, 'airline#extensions#promptline#color_template', 'normal')
|
||||
|
||||
function! airline#extensions#promptline#init(ext)
|
||||
call a:ext.add_theme_func('airline#extensions#promptline#set_prompt_colors')
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#promptline#set_prompt_colors(palette)
|
||||
let color_template = has_key(a:palette, s:color_template) ? s:color_template : 'normal'
|
||||
let mode_palette = a:palette[color_template]
|
||||
|
||||
if !has_key(g:, 'promptline_symbols')
|
||||
let g:promptline_symbols = {
|
||||
\ 'left' : g:airline_left_sep,
|
||||
\ 'right' : g:airline_right_sep,
|
||||
\ 'left_alt' : g:airline_left_alt_sep,
|
||||
\ 'right_alt' : g:airline_right_alt_sep}
|
||||
endif
|
||||
|
||||
let promptline_theme = promptline#api#create_theme_from_airline(mode_palette)
|
||||
call promptline#api#create_snapshot_with_theme(s:prompt_snapshot_file, promptline_theme)
|
||||
endfunction
|
||||
53
.vim/autoload/airline/extensions/quickfix.vim
Normal file
53
.vim/autoload/airline/extensions/quickfix.vim
Normal file
@ -0,0 +1,53 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
let g:airline#extensions#quickfix#quickfix_text = 'Quickfix'
|
||||
let g:airline#extensions#quickfix#location_text = 'Location'
|
||||
|
||||
function! airline#extensions#quickfix#apply(...)
|
||||
if &buftype == 'quickfix'
|
||||
let w:airline_section_a = s:get_text()
|
||||
let w:airline_section_b = '%{get(w:, "quickfix_title", "")}'
|
||||
let w:airline_section_c = ''
|
||||
let w:airline_section_x = ''
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#quickfix#init(ext)
|
||||
call a:ext.add_statusline_func('airline#extensions#quickfix#apply')
|
||||
call a:ext.add_inactive_statusline_func('airline#extensions#quickfix#inactive_qf_window')
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#quickfix#inactive_qf_window(...)
|
||||
if getbufvar(a:2.bufnr, '&filetype') is# 'qf' && !empty(airline#util#getwinvar(a:2.winnr, 'quickfix_title', ''))
|
||||
call setwinvar(a:2.winnr, 'airline_section_c', '[%{get(w:, "quickfix_title", "")}] %f %m')
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:get_text()
|
||||
if exists("*win_getid") && exists("*getwininfo")
|
||||
let dict = getwininfo(win_getid())
|
||||
if len(dict) > 0 && get(dict[0], 'quickfix', 0) && !get(dict[0], 'loclist', 0)
|
||||
return g:airline#extensions#quickfix#quickfix_text
|
||||
elseif len(dict) > 0 && get(dict[0], 'quickfix', 0) && get(dict[0], 'loclist', 0)
|
||||
return g:airline#extensions#quickfix#location_text
|
||||
endif
|
||||
endif
|
||||
redir => buffers
|
||||
silent ls
|
||||
redir END
|
||||
|
||||
let nr = bufnr('%')
|
||||
for buf in split(buffers, '\n')
|
||||
if match(buf, '\v^\s*'.nr) > -1
|
||||
if match(buf, '\cQuickfix') > -1
|
||||
return g:airline#extensions#quickfix#quickfix_text
|
||||
else
|
||||
return g:airline#extensions#quickfix#location_text
|
||||
endif
|
||||
endif
|
||||
endfor
|
||||
return ''
|
||||
endfunction
|
||||
43
.vim/autoload/airline/extensions/syntastic.vim
Normal file
43
.vim/autoload/airline/extensions/syntastic.vim
Normal file
@ -0,0 +1,43 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
if !exists(':SyntasticCheck')
|
||||
finish
|
||||
endif
|
||||
|
||||
let s:error_symbol = get(g:, 'airline#extensions#syntastic#error_symbol', 'E:')
|
||||
let s:warning_symbol = get(g:, 'airline#extensions#syntastic#warning_symbol', 'W:')
|
||||
|
||||
function! airline#extensions#syntastic#get_warning()
|
||||
return airline#extensions#syntastic#get('warning')
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#syntastic#get_error()
|
||||
return airline#extensions#syntastic#get('error')
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#syntastic#get(type)
|
||||
let _backup = get(g:, 'syntastic_stl_format', '')
|
||||
let is_err = (a:type is# 'error')
|
||||
if is_err
|
||||
let g:syntastic_stl_format = get(g:, 'airline#extensions#syntastic#stl_format_err', '%E{[%e(#%fe)]}')
|
||||
else
|
||||
let g:syntastic_stl_format = get(g:, 'airline#extensions#syntastic#stl_format_warn', '%W{[%w(#%fw)]}')
|
||||
endif
|
||||
let cnt = SyntasticStatuslineFlag()
|
||||
if !empty(_backup)
|
||||
let g:syntastic_stl_format = _backup
|
||||
endif
|
||||
if empty(cnt)
|
||||
return ''
|
||||
else
|
||||
return (is_err ? s:error_symbol : s:warning_symbol).cnt
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#syntastic#init(ext)
|
||||
call airline#parts#define_function('syntastic-warn', 'airline#extensions#syntastic#get_warning')
|
||||
call airline#parts#define_function('syntastic-err', 'airline#extensions#syntastic#get_error')
|
||||
endfunction
|
||||
200
.vim/autoload/airline/extensions/tabline.vim
Normal file
200
.vim/autoload/airline/extensions/tabline.vim
Normal file
@ -0,0 +1,200 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
let s:formatter = get(g:, 'airline#extensions#tabline#formatter', 'default')
|
||||
let s:show_buffers = get(g:, 'airline#extensions#tabline#show_buffers', 1)
|
||||
let s:show_tabs = get(g:, 'airline#extensions#tabline#show_tabs', 1)
|
||||
let s:ignore_bufadd_pat = get(g:, 'airline#extensions#tabline#ignore_bufadd_pat', '\c\vgundo|undotree|vimfiler|tagbar|nerd_tree')
|
||||
|
||||
let s:taboo = get(g:, 'airline#extensions#taboo#enabled', 1) && get(g:, 'loaded_taboo', 0)
|
||||
if s:taboo
|
||||
let g:taboo_tabline = 0
|
||||
endif
|
||||
|
||||
let s:ctrlspace = get(g:, 'CtrlSpaceLoaded', 0)
|
||||
|
||||
function! airline#extensions#tabline#init(ext)
|
||||
if has('gui_running')
|
||||
set guioptions-=e
|
||||
endif
|
||||
|
||||
autocmd User AirlineToggledOn call s:toggle_on()
|
||||
autocmd User AirlineToggledOff call s:toggle_off()
|
||||
|
||||
call s:toggle_on()
|
||||
call a:ext.add_theme_func('airline#extensions#tabline#load_theme')
|
||||
endfunction
|
||||
|
||||
function! s:toggle_off()
|
||||
call airline#extensions#tabline#autoshow#off()
|
||||
call airline#extensions#tabline#tabs#off()
|
||||
call airline#extensions#tabline#buffers#off()
|
||||
if s:ctrlspace
|
||||
call airline#extensions#tabline#ctrlspace#off()
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:toggle_on()
|
||||
call airline#extensions#tabline#autoshow#on()
|
||||
call airline#extensions#tabline#tabs#on()
|
||||
call airline#extensions#tabline#buffers#on()
|
||||
if s:ctrlspace
|
||||
call airline#extensions#tabline#ctrlspace#on()
|
||||
endif
|
||||
|
||||
set tabline=%!airline#extensions#tabline#get()
|
||||
endfunction
|
||||
|
||||
function! s:update_tabline()
|
||||
if get(g:, 'airline#extensions#tabline#disable_refresh', 0)
|
||||
return
|
||||
endif
|
||||
let match = expand('<afile>')
|
||||
if pumvisible()
|
||||
return
|
||||
elseif !get(g:, 'airline#extensions#tabline#enabled', 0)
|
||||
return
|
||||
" return, if buffer matches ignore pattern or is directory (netrw)
|
||||
elseif empty(match)
|
||||
\ || match(match, s:ignore_bufadd_pat) > -1
|
||||
\ || isdirectory(expand("<afile>"))
|
||||
return
|
||||
endif
|
||||
doautocmd User BufMRUChange
|
||||
" sometimes, the tabline is not correctly updated see #1580
|
||||
" so force redraw here
|
||||
let &tabline = &tabline
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#tabline#load_theme(palette)
|
||||
if pumvisible()
|
||||
return
|
||||
endif
|
||||
let colors = get(a:palette, 'tabline', {})
|
||||
" Theme for tabs on the left
|
||||
let l:tab = get(colors, 'airline_tab', a:palette.normal.airline_b)
|
||||
let l:tabsel = get(colors, 'airline_tabsel', a:palette.normal.airline_a)
|
||||
let l:tabtype = get(colors, 'airline_tabtype', a:palette.visual.airline_a)
|
||||
let l:tabfill = get(colors, 'airline_tabfill', a:palette.normal.airline_c)
|
||||
let l:tabmod = get(colors, 'airline_tabmod', a:palette.insert.airline_a)
|
||||
let l:tabhid = get(colors, 'airline_tabhid', a:palette.normal.airline_c)
|
||||
if has_key(a:palette, 'normal_modified') && has_key(a:palette.normal_modified, 'airline_c')
|
||||
let l:tabmodu = get(colors, 'airline_tabmod_unsel', a:palette.normal_modified.airline_c)
|
||||
else
|
||||
"Fall back to normal airline_c if modified airline_c isn't present
|
||||
let l:tabmodu = get(colors, 'airline_tabmod_unsel', a:palette.normal.airline_c)
|
||||
endif
|
||||
call airline#highlighter#exec('airline_tab', l:tab)
|
||||
call airline#highlighter#exec('airline_tabsel', l:tabsel)
|
||||
call airline#highlighter#exec('airline_tabtype', l:tabtype)
|
||||
call airline#highlighter#exec('airline_tabfill', l:tabfill)
|
||||
call airline#highlighter#exec('airline_tabmod', l:tabmod)
|
||||
call airline#highlighter#exec('airline_tabmod_unsel', l:tabmodu)
|
||||
call airline#highlighter#exec('airline_tabhid', l:tabhid)
|
||||
|
||||
" Theme for tabs on the right
|
||||
let l:tabsel_right = get(colors, 'airline_tabsel_right', a:palette.normal.airline_a)
|
||||
let l:tab_right = get(colors, 'airline_tab_right', a:palette.inactive.airline_c)
|
||||
let l:tabmod_right = get(colors, 'airline_tabmod_right', a:palette.insert.airline_a)
|
||||
let l:tabhid_right = get(colors, 'airline_tabhid_right', a:palette.normal.airline_c)
|
||||
if has_key(a:palette, 'normal_modified') && has_key(a:palette.normal_modified, 'airline_c')
|
||||
let l:tabmodu_right = get(colors, 'airline_tabmod_unsel_right', a:palette.normal_modified.airline_c)
|
||||
else
|
||||
"Fall back to normal airline_c if modified airline_c isn't present
|
||||
let l:tabmodu_right = get(colors, 'airline_tabmod_unsel_right', a:palette.normal.airline_c)
|
||||
endif
|
||||
call airline#highlighter#exec('airline_tab_right', l:tab_right)
|
||||
call airline#highlighter#exec('airline_tabsel_right', l:tabsel_right)
|
||||
call airline#highlighter#exec('airline_tabmod_right', l:tabmod_right)
|
||||
call airline#highlighter#exec('airline_tabhid_right', l:tabhid_right)
|
||||
call airline#highlighter#exec('airline_tabmod_unsel_right', l:tabmodu_right)
|
||||
endfunction
|
||||
|
||||
let s:current_tabcnt = -1
|
||||
function! airline#extensions#tabline#get()
|
||||
let curtabcnt = tabpagenr('$')
|
||||
if curtabcnt != s:current_tabcnt
|
||||
let s:current_tabcnt = curtabcnt
|
||||
call airline#extensions#tabline#tabs#invalidate()
|
||||
call airline#extensions#tabline#buffers#invalidate()
|
||||
call airline#extensions#tabline#ctrlspace#invalidate()
|
||||
endif
|
||||
|
||||
if !exists('#airline#BufAdd#*')
|
||||
autocmd airline BufAdd * call <sid>update_tabline()
|
||||
endif
|
||||
if s:ctrlspace
|
||||
return airline#extensions#tabline#ctrlspace#get()
|
||||
elseif s:show_buffers && curtabcnt == 1 || !s:show_tabs
|
||||
return airline#extensions#tabline#buffers#get()
|
||||
else
|
||||
return airline#extensions#tabline#tabs#get()
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#tabline#title(n)
|
||||
let title = ''
|
||||
if s:taboo
|
||||
let title = TabooTabTitle(a:n)
|
||||
endif
|
||||
|
||||
if empty(title) && exists('*gettabvar')
|
||||
let title = gettabvar(a:n, 'title')
|
||||
endif
|
||||
|
||||
if empty(title)
|
||||
let buflist = tabpagebuflist(a:n)
|
||||
let winnr = tabpagewinnr(a:n)
|
||||
let all_buffers = airline#extensions#tabline#buflist#list()
|
||||
return airline#extensions#tabline#get_buffer_name(
|
||||
\ buflist[winnr - 1],
|
||||
\ filter(buflist, 'index(all_buffers, v:val) != -1'))
|
||||
endif
|
||||
|
||||
return title
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#tabline#get_buffer_name(nr, ...)
|
||||
let buffers = a:0 ? a:1 : airline#extensions#tabline#buflist#list()
|
||||
return airline#extensions#tabline#formatters#{s:formatter}#format(a:nr, buffers)
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#tabline#new_builder()
|
||||
let builder_context = {
|
||||
\ 'active' : 1,
|
||||
\ 'tabline' : 1,
|
||||
\ 'right_sep' : get(g:, 'airline#extensions#tabline#right_sep' , g:airline_right_sep),
|
||||
\ 'right_alt_sep' : get(g:, 'airline#extensions#tabline#right_alt_sep', g:airline_right_alt_sep),
|
||||
\ }
|
||||
if get(g:, 'airline_powerline_fonts', 0)
|
||||
let builder_context.left_sep = get(g:, 'airline#extensions#tabline#left_sep' , g:airline_left_sep)
|
||||
let builder_context.left_alt_sep = get(g:, 'airline#extensions#tabline#left_alt_sep' , g:airline_left_alt_sep)
|
||||
else
|
||||
let builder_context.left_sep = get(g:, 'airline#extensions#tabline#left_sep' , ' ')
|
||||
let builder_context.left_alt_sep = get(g:, 'airline#extensions#tabline#left_alt_sep' , '|')
|
||||
endif
|
||||
|
||||
return airline#builder#new(builder_context)
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#tabline#group_of_bufnr(tab_bufs, bufnr)
|
||||
let cur = bufnr('%')
|
||||
if cur == a:bufnr
|
||||
if g:airline_detect_modified && getbufvar(a:bufnr, '&modified')
|
||||
let group = 'airline_tabmod'
|
||||
else
|
||||
let group = 'airline_tabsel'
|
||||
endif
|
||||
else
|
||||
if g:airline_detect_modified && getbufvar(a:bufnr, '&modified')
|
||||
let group = 'airline_tabmod_unsel'
|
||||
elseif index(a:tab_bufs, a:bufnr) > -1
|
||||
let group = 'airline_tab'
|
||||
else
|
||||
let group = 'airline_tabhid'
|
||||
endif
|
||||
endif
|
||||
return group
|
||||
endfunction
|
||||
55
.vim/autoload/airline/extensions/tabline/autoshow.vim
Normal file
55
.vim/autoload/airline/extensions/tabline/autoshow.vim
Normal file
@ -0,0 +1,55 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
let s:show_buffers = get(g:, 'airline#extensions#tabline#show_buffers', 1)
|
||||
let s:buf_min_count = get(g:, 'airline#extensions#tabline#buffer_min_count', 0)
|
||||
let s:tab_min_count = get(g:, 'airline#extensions#tabline#tab_min_count', 0)
|
||||
|
||||
function! airline#extensions#tabline#autoshow#off()
|
||||
if exists('s:original_tabline')
|
||||
let &tabline = s:original_tabline
|
||||
let &showtabline = s:original_showtabline
|
||||
endif
|
||||
|
||||
augroup airline_tabline_autoshow
|
||||
autocmd!
|
||||
augroup END
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#tabline#autoshow#on()
|
||||
let [ s:original_tabline, s:original_showtabline ] = [ &tabline, &showtabline ]
|
||||
|
||||
augroup airline_tabline_autoshow
|
||||
autocmd!
|
||||
if s:buf_min_count <= 0 && s:tab_min_count <= 1
|
||||
if &lines > 3
|
||||
set showtabline=2
|
||||
endif
|
||||
else
|
||||
if s:show_buffers == 1
|
||||
autocmd BufEnter * call <sid>show_tabline(s:buf_min_count, len(airline#extensions#tabline#buflist#list()))
|
||||
autocmd BufUnload * call <sid>show_tabline(s:buf_min_count, len(airline#extensions#tabline#buflist#list()) - 1)
|
||||
else
|
||||
autocmd TabEnter * call <sid>show_tabline(s:tab_min_count, tabpagenr('$'))
|
||||
endif
|
||||
endif
|
||||
|
||||
" Invalidate cache. This has to come after the BufUnload for
|
||||
" s:show_buffers, to invalidate the cache for BufEnter.
|
||||
autocmd BufLeave,BufAdd,BufUnload * call airline#extensions#tabline#buflist#invalidate()
|
||||
augroup END
|
||||
endfunction
|
||||
|
||||
function! s:show_tabline(min_count, total_count)
|
||||
if a:total_count >= a:min_count
|
||||
if &showtabline != 2 && &lines > 3
|
||||
set showtabline=2
|
||||
endif
|
||||
else
|
||||
if &showtabline != 0
|
||||
set showtabline=0
|
||||
endif
|
||||
endif
|
||||
endfunction
|
||||
252
.vim/autoload/airline/extensions/tabline/buffers.vim
Normal file
252
.vim/autoload/airline/extensions/tabline/buffers.vim
Normal file
@ -0,0 +1,252 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
let s:buffer_idx_mode = get(g:, 'airline#extensions#tabline#buffer_idx_mode', 0)
|
||||
let s:show_tab_type = get(g:, 'airline#extensions#tabline#show_tab_type', 1)
|
||||
let s:buffers_label = get(g:, 'airline#extensions#tabline#buffers_label', 'buffers')
|
||||
let s:keymap_ignored_filetypes = get(g:, 'airline#extensions#tabline#keymap_ignored_filetypes', ['vimfiler', 'nerdtree'])
|
||||
let s:spc = g:airline_symbols.space
|
||||
|
||||
let s:current_bufnr = -1
|
||||
let s:current_modified = 0
|
||||
let s:current_tabline = ''
|
||||
let s:current_visible_buffers = []
|
||||
|
||||
let s:number_map = {
|
||||
\ '0': '⁰',
|
||||
\ '1': '¹',
|
||||
\ '2': '²',
|
||||
\ '3': '³',
|
||||
\ '4': '⁴',
|
||||
\ '5': '⁵',
|
||||
\ '6': '⁶',
|
||||
\ '7': '⁷',
|
||||
\ '8': '⁸',
|
||||
\ '9': '⁹'
|
||||
\ }
|
||||
let s:number_map = &encoding == 'utf-8'
|
||||
\ ? get(g:, 'airline#extensions#tabline#buffer_idx_format', s:number_map)
|
||||
\ : {}
|
||||
|
||||
function! airline#extensions#tabline#buffers#off()
|
||||
augroup airline_tabline_buffers
|
||||
autocmd!
|
||||
augroup END
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#tabline#buffers#on()
|
||||
augroup airline_tabline_buffers
|
||||
autocmd!
|
||||
autocmd BufDelete * call airline#extensions#tabline#buffers#invalidate()
|
||||
autocmd User BufMRUChange call airline#extensions#tabline#buflist#invalidate()
|
||||
autocmd User BufMRUChange call airline#extensions#tabline#buffers#invalidate()
|
||||
augroup END
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#tabline#buffers#invalidate()
|
||||
let s:current_bufnr = -1
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#tabline#buffers#get()
|
||||
call <sid>map_keys()
|
||||
let cur = bufnr('%')
|
||||
if cur == s:current_bufnr
|
||||
if !g:airline_detect_modified || getbufvar(cur, '&modified') == s:current_modified
|
||||
return s:current_tabline
|
||||
endif
|
||||
endif
|
||||
|
||||
let l:index = 1
|
||||
let b = airline#extensions#tabline#new_builder()
|
||||
let tab_bufs = tabpagebuflist(tabpagenr())
|
||||
for nr in s:get_visible_buffers()
|
||||
if nr < 0
|
||||
call b.add_raw('%#airline_tabhid#...')
|
||||
continue
|
||||
endif
|
||||
|
||||
let group = airline#extensions#tabline#group_of_bufnr(tab_bufs, nr)
|
||||
|
||||
if nr == cur
|
||||
let s:current_modified = (group == 'airline_tabmod') ? 1 : 0
|
||||
endif
|
||||
|
||||
" Neovim feature: Have clickable buffers
|
||||
if has("tablineat")
|
||||
call b.add_raw('%'.nr.'@airline#extensions#tabline#buffers#clickbuf@')
|
||||
endif
|
||||
if s:buffer_idx_mode
|
||||
if len(s:number_map) > 0
|
||||
call b.add_section(group, s:spc . get(s:number_map, l:index, '') . '%(%{airline#extensions#tabline#get_buffer_name('.nr.')}%)' . s:spc)
|
||||
else
|
||||
call b.add_section(group, '['.l:index.s:spc.'%(%{airline#extensions#tabline#get_buffer_name('.nr.')}%)'.']')
|
||||
endif
|
||||
let l:index = l:index + 1
|
||||
else
|
||||
call b.add_section(group, s:spc.'%(%{airline#extensions#tabline#get_buffer_name('.nr.')}%)'.s:spc)
|
||||
endif
|
||||
if has("tablineat")
|
||||
call b.add_raw('%X')
|
||||
endif
|
||||
endfor
|
||||
|
||||
call b.add_section('airline_tabfill', '')
|
||||
call b.split()
|
||||
call b.add_section('airline_tabfill', '')
|
||||
if s:show_tab_type
|
||||
call b.add_section_spaced('airline_tabtype', s:buffers_label)
|
||||
endif
|
||||
if tabpagenr('$') > 1
|
||||
call b.add_section_spaced('airline_tabmod', printf('%s %d/%d', "tab", tabpagenr(), tabpagenr('$')))
|
||||
endif
|
||||
|
||||
let s:current_bufnr = cur
|
||||
let s:current_tabline = b.build()
|
||||
return s:current_tabline
|
||||
endfunction
|
||||
|
||||
function! s:get_visible_buffers()
|
||||
let buffers = airline#extensions#tabline#buflist#list()
|
||||
let cur = bufnr('%')
|
||||
|
||||
let total_width = 0
|
||||
let max_width = 0
|
||||
|
||||
for nr in buffers
|
||||
let width = len(airline#extensions#tabline#get_buffer_name(nr)) + 4
|
||||
let total_width += width
|
||||
let max_width = max([max_width, width])
|
||||
endfor
|
||||
|
||||
" only show current and surrounding buffers if there are too many buffers
|
||||
let position = index(buffers, cur)
|
||||
let vimwidth = &columns
|
||||
if total_width > vimwidth && position > -1
|
||||
let buf_count = len(buffers)
|
||||
|
||||
" determine how many buffers to show based on the longest buffer width,
|
||||
" use one on the right side and put the rest on the left
|
||||
let buf_max = vimwidth / max_width
|
||||
let buf_right = 1
|
||||
let buf_left = max([0, buf_max - buf_right])
|
||||
|
||||
let start = max([0, position - buf_left])
|
||||
let end = min([buf_count, position + buf_right])
|
||||
|
||||
" fill up available space on the right
|
||||
if position < buf_left
|
||||
let end += (buf_left - position)
|
||||
endif
|
||||
|
||||
" fill up available space on the left
|
||||
if end > buf_count - 1 - buf_right
|
||||
let start -= max([0, buf_right - (buf_count - 1 - position)])
|
||||
endif
|
||||
|
||||
let buffers = eval('buffers[' . start . ':' . end . ']')
|
||||
|
||||
if start > 0
|
||||
call insert(buffers, -1, 0)
|
||||
endif
|
||||
|
||||
if end < buf_count - 1
|
||||
call add(buffers, -1)
|
||||
endif
|
||||
endif
|
||||
|
||||
let s:current_visible_buffers = buffers
|
||||
return buffers
|
||||
endfunction
|
||||
|
||||
function! s:select_tab(buf_index)
|
||||
" no-op when called in 'keymap_ignored_filetypes'
|
||||
if count(s:keymap_ignored_filetypes, &ft)
|
||||
return
|
||||
endif
|
||||
|
||||
let idx = a:buf_index
|
||||
if s:current_visible_buffers[0] == -1
|
||||
let idx = idx + 1
|
||||
endif
|
||||
|
||||
let buf = get(s:current_visible_buffers, idx, 0)
|
||||
if buf != 0
|
||||
exec 'b!' . buf
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:jump_to_tab(offset)
|
||||
let l = s:current_visible_buffers
|
||||
let i = index(l, bufnr('%'))
|
||||
if i > -1
|
||||
exec 'b!' . l[float2nr(fmod(i + a:offset, len(l)))]
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:map_keys()
|
||||
if s:buffer_idx_mode
|
||||
noremap <silent> <Plug>AirlineSelectTab1 :call <SID>select_tab(0)<CR>
|
||||
noremap <silent> <Plug>AirlineSelectTab2 :call <SID>select_tab(1)<CR>
|
||||
noremap <silent> <Plug>AirlineSelectTab3 :call <SID>select_tab(2)<CR>
|
||||
noremap <silent> <Plug>AirlineSelectTab4 :call <SID>select_tab(3)<CR>
|
||||
noremap <silent> <Plug>AirlineSelectTab5 :call <SID>select_tab(4)<CR>
|
||||
noremap <silent> <Plug>AirlineSelectTab6 :call <SID>select_tab(5)<CR>
|
||||
noremap <silent> <Plug>AirlineSelectTab7 :call <SID>select_tab(6)<CR>
|
||||
noremap <silent> <Plug>AirlineSelectTab8 :call <SID>select_tab(7)<CR>
|
||||
noremap <silent> <Plug>AirlineSelectTab9 :call <SID>select_tab(8)<CR>
|
||||
noremap <silent> <Plug>AirlineSelectPrevTab :<C-u>call <SID>jump_to_tab(-v:count1)<CR>
|
||||
noremap <silent> <Plug>AirlineSelectNextTab :<C-u>call <SID>jump_to_tab(v:count1)<CR>
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#tabline#buffers#clickbuf(minwid, clicks, button, modifiers) abort
|
||||
" Clickable buffers
|
||||
" works only in recent NeoVim with has('tablineat')
|
||||
|
||||
" single mouse button click without modifiers pressed
|
||||
if a:clicks == 1 && a:modifiers !~# '[^ ]'
|
||||
if a:button is# 'l'
|
||||
" left button - switch to buffer
|
||||
silent execute 'buffer' a:minwid
|
||||
elseif a:button is# 'm'
|
||||
" middle button - delete buffer
|
||||
|
||||
if get(g:, 'airline#extensions#tabline#middle_click_preserves_windows', 0) == 0
|
||||
" just simply delete the clicked buffer. This will cause windows
|
||||
" associated with the clicked buffer to be closed.
|
||||
silent execute 'bdelete' a:minwid
|
||||
else
|
||||
" find windows displaying the clicked buffer and open an new
|
||||
" buffer in them.
|
||||
let current_window = bufwinnr("%")
|
||||
let window_number = bufwinnr(a:minwid)
|
||||
let last_window_visited = -1
|
||||
|
||||
" Set to 1 if the clicked buffer was open in any windows.
|
||||
let buffer_in_window = 0
|
||||
|
||||
" Find the next window with the clicked buffer open. If bufwinnr()
|
||||
" returns the same window number, this is because we clicked a new
|
||||
" buffer, and then tried editing a new buffer. Vim won't create a
|
||||
" new empty buffer for the same window, so we get the same window
|
||||
" number from bufwinnr(). In this case we just give up and don't
|
||||
" delete the buffer.
|
||||
" This could be made cleaner if we could check if the clicked buffer
|
||||
" is a new buffer, but I don't know if there is a way to do that.
|
||||
while window_number != -1 && window_number != last_window_visited
|
||||
let buffer_in_window = 1
|
||||
silent execute window_number . 'wincmd w'
|
||||
silent execute 'enew'
|
||||
let last_window_visited = window_number
|
||||
let window_number = bufwinnr(a:minwid)
|
||||
endwhile
|
||||
silent execute current_window . 'wincmd w'
|
||||
if window_number != last_window_visited || buffer_in_window == 0
|
||||
silent execute 'bdelete' a:minwid
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endfunction
|
||||
44
.vim/autoload/airline/extensions/tabline/buflist.vim
Normal file
44
.vim/autoload/airline/extensions/tabline/buflist.vim
Normal file
@ -0,0 +1,44 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
function! airline#extensions#tabline#buflist#invalidate()
|
||||
unlet! s:current_buffer_list
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#tabline#buflist#list()
|
||||
if exists('s:current_buffer_list')
|
||||
return s:current_buffer_list
|
||||
endif
|
||||
|
||||
let excludes = get(g:, 'airline#extensions#tabline#excludes', [])
|
||||
let exclude_preview = get(g:, 'airline#extensions#tabline#exclude_preview', 1)
|
||||
|
||||
let list = (exists('g:did_bufmru') && g:did_bufmru) ? BufMRUList() : range(1, bufnr("$"))
|
||||
|
||||
let buffers = []
|
||||
" If this is too slow, we can switch to a different algorithm.
|
||||
" Basically branch 535 already does it, but since it relies on
|
||||
" BufAdd autocommand, I'd like to avoid this if possible.
|
||||
for nr in list
|
||||
if buflisted(nr)
|
||||
" Do not add to the bufferlist, if either
|
||||
" 1) buffername matches exclude pattern
|
||||
" 2) buffer is a quickfix buffer
|
||||
" 3) exclude preview windows (if 'bufhidden' == wipe
|
||||
" and 'buftype' == nofile
|
||||
if (!empty(excludes) && match(bufname(nr), join(excludes, '\|')) > -1) ||
|
||||
\ (getbufvar(nr, 'current_syntax') == 'qf') ||
|
||||
\ (exclude_preview && getbufvar(nr, '&bufhidden') == 'wipe'
|
||||
\ && getbufvar(nr, '&buftype') == 'nofile')
|
||||
continue
|
||||
endif
|
||||
call add(buffers, nr)
|
||||
endif
|
||||
endfor
|
||||
|
||||
let s:current_buffer_list = buffers
|
||||
return buffers
|
||||
endfunction
|
||||
|
||||
175
.vim/autoload/airline/extensions/tabline/ctrlspace.vim
Normal file
175
.vim/autoload/airline/extensions/tabline/ctrlspace.vim
Normal file
@ -0,0 +1,175 @@
|
||||
" MIT License. Copyright (c) 2016 Kevin Sapper
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
let s:current_bufnr = -1
|
||||
let s:current_tabnr = -1
|
||||
let s:current_tabline = ''
|
||||
|
||||
let s:buffers_label = get(g:, 'airline#extensions#tabline#buffers_label', 'buffers')
|
||||
let s:tabs_label = get(g:, 'airline#extensions#tabline#tabs_label', 'tabs')
|
||||
let s:switch_buffers_and_tabs = get(g:, 'airline#extensions#tabline#switch_buffers_and_tabs', 0)
|
||||
let s:show_buffers = get(g:, 'airline#extensions#tabline#show_buffers', 1)
|
||||
let s:show_tabs = get(g:, 'airline#extensions#tabline#show_tabs', 1)
|
||||
|
||||
function! airline#extensions#tabline#ctrlspace#off()
|
||||
augroup airline_tabline_ctrlspace
|
||||
autocmd!
|
||||
augroup END
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#tabline#ctrlspace#on()
|
||||
augroup airline_tabline_ctrlspace
|
||||
autocmd!
|
||||
autocmd BufDelete * call airline#extensions#tabline#ctrlspace#invalidate()
|
||||
augroup END
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#tabline#ctrlspace#invalidate()
|
||||
let s:current_bufnr = -1
|
||||
let s:current_tabnr = -1
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#tabline#ctrlspace#add_buffer_section(builder, cur_tab, cur_buf, pos)
|
||||
if a:pos == 0
|
||||
let pos_extension = ''
|
||||
else
|
||||
let pos_extension = '_right'
|
||||
endif
|
||||
|
||||
let s:buffer_list = ctrlspace#api#BufferList(a:cur_tab)
|
||||
" add by tenfy(tenfyzhong@qq.com)
|
||||
" if the current buffer no in the buffer list
|
||||
" return false and no redraw tabline.
|
||||
" Fixes #1515. if there a BufEnter autocmd execute redraw. The tabline may no update.
|
||||
let bufnr_list = map(copy(s:buffer_list), 'v:val["index"]')
|
||||
if index(bufnr_list, a:cur_buf) == -1
|
||||
return 0
|
||||
endif
|
||||
|
||||
for buffer in s:buffer_list
|
||||
if a:cur_buf == buffer.index
|
||||
if buffer.modified
|
||||
let group = 'airline_tabmod'.pos_extension
|
||||
else
|
||||
let group = 'airline_tabsel'.pos_extension
|
||||
endif
|
||||
else
|
||||
if buffer.modified
|
||||
let group = 'airline_tabmod_unsel'.pos_extension
|
||||
elseif buffer.visible
|
||||
let group = 'airline_tab'.pos_extension
|
||||
else
|
||||
let group = 'airline_tabhid'.pos_extension
|
||||
endif
|
||||
endif
|
||||
|
||||
let buf_name = '%(%{airline#extensions#tabline#get_buffer_name('.buffer.index.')}%)'
|
||||
|
||||
if has("tablineat")
|
||||
let buf_name = '%'.buffer.index.'@airline#extensions#tabline#buffers#clickbuf@'.buf_name.'%X'
|
||||
endif
|
||||
|
||||
call a:builder.add_section_spaced(group, buf_name)
|
||||
endfor
|
||||
" add by tenfy(tenfyzhong@qq.com)
|
||||
" if the selected buffer was updated
|
||||
" return true
|
||||
return 1
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#tabline#ctrlspace#add_tab_section(builder, pos)
|
||||
if a:pos == 0
|
||||
let pos_extension = ''
|
||||
else
|
||||
let pos_extension = '_right'
|
||||
endif
|
||||
|
||||
for tab in s:tab_list
|
||||
if tab.current
|
||||
if tab.modified
|
||||
let group = 'airline_tabmod'.pos_extension
|
||||
else
|
||||
let group = 'airline_tabsel'.pos_extension
|
||||
endif
|
||||
else
|
||||
if tab.modified
|
||||
let group = 'airline_tabmod_unsel'.pos_extension
|
||||
else
|
||||
let group = 'airline_tabhid'.pos_extension
|
||||
endif
|
||||
endif
|
||||
|
||||
call a:builder.add_section_spaced(group, '%'.tab.index.'T'.tab.title.ctrlspace#api#TabBuffersNumber(tab.index).'%T')
|
||||
endfor
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#tabline#ctrlspace#get()
|
||||
let cur_buf = bufnr('%')
|
||||
|
||||
call airline#extensions#tabline#tabs#map_keys()
|
||||
let s:tab_list = ctrlspace#api#TabList()
|
||||
for tab in s:tab_list
|
||||
if tab.current
|
||||
let cur_tab = tab.index
|
||||
endif
|
||||
endfor
|
||||
|
||||
if cur_buf == s:current_bufnr && cur_tab == s:current_tabnr
|
||||
return s:current_tabline
|
||||
endif
|
||||
|
||||
let builder = airline#extensions#tabline#new_builder()
|
||||
|
||||
" Add left tabline content
|
||||
if s:show_buffers == 0
|
||||
call airline#extensions#tabline#ctrlspace#add_tab_section(builder, 0)
|
||||
elseif s:show_tabs == 0
|
||||
" add by tenfy(tenfyzhong@qq.com)
|
||||
" if current buffer no in the buffer list, does't update tabline
|
||||
if airline#extensions#tabline#ctrlspace#add_buffer_section(builder, cur_tab, cur_buf, 0) == 0
|
||||
return s:current_tabline
|
||||
endif
|
||||
else
|
||||
if s:switch_buffers_and_tabs == 0
|
||||
call builder.add_section_spaced('airline_tabtype', s:buffers_label)
|
||||
" add by tenfy(tenfyzhong@qq.com)
|
||||
" if current buffer no in the buffer list, does't update tabline
|
||||
if airline#extensions#tabline#ctrlspace#add_buffer_section(builder, cur_tab, cur_buf, 0) == 0
|
||||
return s:current_tabline
|
||||
endif
|
||||
else
|
||||
call builder.add_section_spaced('airline_tabtype', s:tabs_label)
|
||||
call airline#extensions#tabline#ctrlspace#add_tab_section(builder, 0)
|
||||
endif
|
||||
endif
|
||||
|
||||
call builder.add_section('airline_tabfill', '')
|
||||
call builder.split()
|
||||
call builder.add_section('airline_tabfill', '')
|
||||
|
||||
" Add right tabline content
|
||||
if s:show_buffers == 0
|
||||
call builder.add_section_spaced('airline_tabtype', s:tabs_label)
|
||||
elseif s:show_tabs == 0
|
||||
call builder.add_section_spaced('airline_tabtype', s:buffers_label)
|
||||
else
|
||||
if s:switch_buffers_and_tabs == 0
|
||||
call airline#extensions#tabline#ctrlspace#add_tab_section(builder, 1)
|
||||
call builder.add_section_spaced('airline_tabtype', s:tabs_label)
|
||||
else
|
||||
" add by tenfy(tenfyzhong@qq.com)
|
||||
" if current buffer no in the buffer list, does't update tabline
|
||||
if airline#extensions#tabline#ctrlspace#add_buffer_section(builder, cur_tab, cur_buf, 0) == 0
|
||||
return s:current_tabline
|
||||
endif
|
||||
call builder.add_section_spaced('airline_tabtype', s:buffers_label)
|
||||
endif
|
||||
endif
|
||||
|
||||
let s:current_bufnr = cur_buf
|
||||
let s:current_tabnr = cur_tab
|
||||
let s:current_tabline = builder.build()
|
||||
return s:current_tabline
|
||||
endfunction
|
||||
@ -0,0 +1,41 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
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
|
||||
|
||||
function! airline#extensions#tabline#formatters#default#format(bufnr, buffers)
|
||||
let fmod = get(g:, 'airline#extensions#tabline#fnamemod', ':~:.')
|
||||
let _ = ''
|
||||
|
||||
let name = bufname(a:bufnr)
|
||||
if empty(name)
|
||||
let _ .= '[No Name]'
|
||||
else
|
||||
if s:fnamecollapse
|
||||
let _ .= substitute(fnamemodify(name, fmod), '\v\w\zs.{-}\ze(\\|/)', '', 'g')
|
||||
else
|
||||
let _ .= fnamemodify(name, 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, _)
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#tabline#formatters#default#wrap_name(bufnr, buffer_name)
|
||||
let _ = s:buf_nr_show ? printf(s:buf_nr_format, a:bufnr) : ''
|
||||
let _ .= substitute(a:buffer_name, '\\', '/', 'g')
|
||||
|
||||
if getbufvar(a:bufnr, '&modified') == 1
|
||||
let _ .= s:buf_modified_symbol
|
||||
endif
|
||||
return _
|
||||
endfunction
|
||||
@ -0,0 +1,40 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
function! airline#extensions#tabline#formatters#unique_tail#format(bufnr, buffers)
|
||||
let duplicates = {}
|
||||
let tails = {}
|
||||
let map = {}
|
||||
for nr in a:buffers
|
||||
let name = bufname(nr)
|
||||
if empty(name)
|
||||
let map[nr] = '[No Name]'
|
||||
else
|
||||
let tail = fnamemodify(name, ':s?/\+$??:t')
|
||||
if has_key(tails, tail)
|
||||
let duplicates[nr] = nr
|
||||
endif
|
||||
let tails[tail] = 1
|
||||
let map[nr] = airline#extensions#tabline#formatters#default#wrap_name(nr, tail)
|
||||
endif
|
||||
endfor
|
||||
|
||||
let fmod = get(g:, 'airline#extensions#tabline#fnamemod', ':p:.')
|
||||
for nr in values(duplicates)
|
||||
let fnamecollapse = get(g:, 'airline#extensions#tabline#fnamecollapse', 1)
|
||||
if fnamecollapse
|
||||
let map[nr] = airline#extensions#tabline#formatters#default#wrap_name(nr, substitute(fnamemodify(name, fmod), '\v\w\zs.{-}\ze(\\|/)', '', 'g'))
|
||||
else
|
||||
let map[nr] = airline#extensions#tabline#formatters#default#wrap_name(nr, fnamemodify(bufname(nr), fmod))
|
||||
endif
|
||||
endfor
|
||||
|
||||
if has_key(map, a:bufnr)
|
||||
return map[a:bufnr]
|
||||
endif
|
||||
|
||||
" if we get here, the buffer list isn't in sync with the selected buffer yet, fall back to the default
|
||||
return airline#extensions#tabline#formatters#default#format(a:bufnr, a:buffers)
|
||||
endfunction
|
||||
@ -0,0 +1,91 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
let s:skip_symbol = '…'
|
||||
|
||||
function! airline#extensions#tabline#formatters#unique_tail_improved#format(bufnr, buffers)
|
||||
if len(a:buffers) <= 1 " don't need to compare bufnames if has less than one buffer opened
|
||||
return airline#extensions#tabline#formatters#default#format(a:bufnr, a:buffers)
|
||||
endif
|
||||
|
||||
let curbuf_tail = fnamemodify(bufname(a:bufnr), ':t')
|
||||
let do_deduplicate = 0
|
||||
let path_tokens = {}
|
||||
|
||||
for nr in a:buffers
|
||||
let name = bufname(nr)
|
||||
if !empty(name) && nr != a:bufnr && fnamemodify(name, ':t') == curbuf_tail " only perform actions if curbuf_tail isn't unique
|
||||
let do_deduplicate = 1
|
||||
let tokens = reverse(split(substitute(fnamemodify(name, ':p:h'), '\\', '/', 'g'), '/'))
|
||||
let token_index = 0
|
||||
for token in tokens
|
||||
if token == '' | continue | endif
|
||||
if token == '.' | break | endif
|
||||
if !has_key(path_tokens, token_index)
|
||||
let path_tokens[token_index] = {}
|
||||
endif
|
||||
let path_tokens[token_index][token] = 1
|
||||
let token_index += 1
|
||||
endfor
|
||||
endif
|
||||
endfor
|
||||
|
||||
if do_deduplicate == 1
|
||||
let path = []
|
||||
let token_index = 0
|
||||
for token in reverse(split(substitute(fnamemodify(bufname(a:bufnr), ':p:h'), '\\', '/', 'g'), '/'))
|
||||
if token == '.' | break | endif
|
||||
let duplicated = 0
|
||||
let uniq = 1
|
||||
let single = 1
|
||||
if has_key(path_tokens, token_index)
|
||||
let duplicated = 1
|
||||
if len(keys(path_tokens[token_index])) > 1 | let single = 0 | endif
|
||||
if has_key(path_tokens[token_index], token) | let uniq = 0 | endif
|
||||
endif
|
||||
call insert(path, {'token': token, 'duplicated': duplicated, 'uniq': uniq, 'single': single})
|
||||
let token_index += 1
|
||||
endfor
|
||||
|
||||
let buf_name = [curbuf_tail]
|
||||
let has_uniq = 0
|
||||
let has_skipped = 0
|
||||
for token1 in reverse(path)
|
||||
if !token1['duplicated'] && len(buf_name) > 1
|
||||
call insert(buf_name, s:skip_symbol)
|
||||
let has_skipped = 0
|
||||
break
|
||||
endif
|
||||
|
||||
if has_uniq == 1
|
||||
call insert(buf_name, s:skip_symbol)
|
||||
let has_skipped = 0
|
||||
break
|
||||
endif
|
||||
|
||||
if token1['uniq'] == 0 && token1['single'] == 1
|
||||
let has_skipped = 1
|
||||
else
|
||||
if has_skipped == 1
|
||||
call insert(buf_name, s:skip_symbol)
|
||||
let has_skipped = 0
|
||||
endif
|
||||
call insert(buf_name, token1['token'])
|
||||
endif
|
||||
|
||||
if token1['uniq'] == 1
|
||||
let has_uniq = 1
|
||||
endif
|
||||
endfor
|
||||
|
||||
if has_skipped == 1
|
||||
call insert(buf_name, s:skip_symbol)
|
||||
endif
|
||||
|
||||
return airline#extensions#tabline#formatters#default#wrap_name(a:bufnr, join(buf_name, '/'))
|
||||
else
|
||||
return airline#extensions#tabline#formatters#default#format(a:bufnr, a:buffers)
|
||||
endif
|
||||
endfunction
|
||||
116
.vim/autoload/airline/extensions/tabline/tabs.vim
Normal file
116
.vim/autoload/airline/extensions/tabline/tabs.vim
Normal file
@ -0,0 +1,116 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
let s:show_close_button = get(g:, 'airline#extensions#tabline#show_close_button', 1)
|
||||
let s:show_tab_type = get(g:, 'airline#extensions#tabline#show_tab_type', 1)
|
||||
let s:show_tab_nr = get(g:, 'airline#extensions#tabline#show_tab_nr', 1)
|
||||
let s:tab_nr_type = get(g:, 'airline#extensions#tabline#tab_nr_type', 0)
|
||||
let s:close_symbol = get(g:, 'airline#extensions#tabline#close_symbol', 'X')
|
||||
let s:tabs_label = get(g:, 'airline#extensions#tabline#tabs_label', 'tabs')
|
||||
let s:show_splits = get(g:, 'airline#extensions#tabline#show_splits', 1)
|
||||
let s:spc = g:airline_symbols.space
|
||||
|
||||
let s:current_bufnr = -1
|
||||
let s:current_tabnr = -1
|
||||
let s:current_modified = 0
|
||||
|
||||
function! airline#extensions#tabline#tabs#off()
|
||||
augroup airline_tabline_tabs
|
||||
autocmd!
|
||||
augroup END
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#tabline#tabs#on()
|
||||
augroup airline_tabline_tabs
|
||||
autocmd!
|
||||
autocmd BufDelete * call airline#extensions#tabline#tabs#invalidate()
|
||||
augroup END
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#tabline#tabs#invalidate()
|
||||
let s:current_bufnr = -1
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#tabline#tabs#get()
|
||||
let curbuf = bufnr('%')
|
||||
let curtab = tabpagenr()
|
||||
call airline#extensions#tabline#tabs#map_keys()
|
||||
if curbuf == s:current_bufnr && curtab == s:current_tabnr
|
||||
if !g:airline_detect_modified || getbufvar(curbuf, '&modified') == s:current_modified
|
||||
return s:current_tabline
|
||||
endif
|
||||
endif
|
||||
|
||||
let b = airline#extensions#tabline#new_builder()
|
||||
|
||||
for i in range(1, tabpagenr('$'))
|
||||
if i == curtab
|
||||
let group = 'airline_tabsel'
|
||||
if g:airline_detect_modified
|
||||
for bi in tabpagebuflist(i)
|
||||
if getbufvar(bi, '&modified')
|
||||
let group = 'airline_tabmod'
|
||||
endif
|
||||
endfor
|
||||
endif
|
||||
let s:current_modified = (group == 'airline_tabmod') ? 1 : 0
|
||||
else
|
||||
let group = 'airline_tab'
|
||||
endif
|
||||
let val = '%('
|
||||
if s:show_tab_nr
|
||||
if s:tab_nr_type == 0
|
||||
let val .= (g:airline_symbols.space).'%{len(tabpagebuflist('.i.'))}'
|
||||
elseif s:tab_nr_type == 1
|
||||
let val .= (g:airline_symbols.space).i
|
||||
else "== 2
|
||||
let val .= (g:airline_symbols.space).i.'.%{len(tabpagebuflist('.i.'))}'
|
||||
endif
|
||||
endif
|
||||
call b.add_section(group, val.'%'.i.'T %{airline#extensions#tabline#title('.i.')} %)')
|
||||
endfor
|
||||
|
||||
call b.add_section('airline_tabfill', '')
|
||||
call b.split()
|
||||
call b.add_section('airline_tabfill', '')
|
||||
|
||||
if s:show_close_button
|
||||
call b.add_section('airline_tab_right', ' %999X'.s:close_symbol.' ')
|
||||
endif
|
||||
|
||||
if s:show_splits == 1
|
||||
let buffers = tabpagebuflist(curtab)
|
||||
for nr in buffers
|
||||
let group = airline#extensions#tabline#group_of_bufnr(buffers, nr) . "_right"
|
||||
call b.add_section_spaced(group, '%(%{airline#extensions#tabline#get_buffer_name('.nr.')}%)')
|
||||
endfor
|
||||
elseif s:show_tab_type == 1
|
||||
call b.add_section_spaced('airline_tabtype', s:tabs_label)
|
||||
endif
|
||||
|
||||
let s:current_bufnr = curbuf
|
||||
let s:current_tabnr = curtab
|
||||
let s:current_tabline = b.build()
|
||||
return s:current_tabline
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#tabline#tabs#map_keys()
|
||||
if exists("s:airline_tabline_map_key")
|
||||
return
|
||||
endif
|
||||
noremap <silent> <Plug>AirlineSelectTab1 :1tabn<CR>
|
||||
noremap <silent> <Plug>AirlineSelectTab2 :2tabn<CR>
|
||||
noremap <silent> <Plug>AirlineSelectTab3 :3tabn<CR>
|
||||
noremap <silent> <Plug>AirlineSelectTab4 :4tabn<CR>
|
||||
noremap <silent> <Plug>AirlineSelectTab5 :5tabn<CR>
|
||||
noremap <silent> <Plug>AirlineSelectTab6 :6tabn<CR>
|
||||
noremap <silent> <Plug>AirlineSelectTab7 :7tabn<CR>
|
||||
noremap <silent> <Plug>AirlineSelectTab8 :8tabn<CR>
|
||||
noremap <silent> <Plug>AirlineSelectTab9 :9tabn<CR>
|
||||
noremap <silent> <Plug>AirlineSelectPrevTab gT
|
||||
" tabn {count} goes to count tab does not go {count} tab pages forward!
|
||||
noremap <silent> <Plug>AirlineSelectNextTab :<C-U>exe repeat(':tabn\|', v:count1)<cr>
|
||||
let s:airline_tabline_map_key = 1
|
||||
endfunction
|
||||
59
.vim/autoload/airline/extensions/tagbar.vim
Normal file
59
.vim/autoload/airline/extensions/tagbar.vim
Normal file
@ -0,0 +1,59 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
if !exists(':TagbarToggle')
|
||||
finish
|
||||
endif
|
||||
|
||||
let s:flags = get(g:, 'airline#extensions#tagbar#flags', '')
|
||||
let s:spc = g:airline_symbols.space
|
||||
let s:init=0
|
||||
|
||||
" Arguments: current, sort, fname
|
||||
function! airline#extensions#tagbar#get_status(...)
|
||||
let builder = airline#builder#new({ 'active': a:1 })
|
||||
call builder.add_section('airline_a', s:spc.'Tagbar'.s:spc)
|
||||
call builder.add_section('airline_b', s:spc.a:2.s:spc)
|
||||
call builder.add_section('airline_c', s:spc.a:3.s:spc)
|
||||
return builder.build()
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#tagbar#inactive_apply(...)
|
||||
if getwinvar(a:2.winnr, '&filetype') == 'tagbar'
|
||||
return -1
|
||||
endif
|
||||
endfunction
|
||||
|
||||
let s:airline_tagbar_last_lookup_time = 0
|
||||
let s:airline_tagbar_last_lookup_val = ''
|
||||
function! airline#extensions#tagbar#currenttag()
|
||||
if get(w:, 'airline_active', 0)
|
||||
if !s:init
|
||||
try
|
||||
" try to load the plugin, if filetypes are disabled,
|
||||
" this will cause an error, so try only once
|
||||
let a=tagbar#currenttag('%', '', '')
|
||||
catch
|
||||
endtry
|
||||
unlet! a
|
||||
let s:init=1
|
||||
endif
|
||||
" function tagbar#currenttag does not exist, if filetype is not enabled
|
||||
if s:airline_tagbar_last_lookup_time != localtime() && exists("*tagbar#currenttag")
|
||||
let s:airline_tagbar_last_lookup_val = tagbar#currenttag('%s', '', s:flags)
|
||||
let s:airline_tagbar_last_lookup_time = localtime()
|
||||
endif
|
||||
return s:airline_tagbar_last_lookup_val
|
||||
endif
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#tagbar#init(ext)
|
||||
call a:ext.add_inactive_statusline_func('airline#extensions#tagbar#inactive_apply')
|
||||
let g:tagbar_status_func = 'airline#extensions#tagbar#get_status'
|
||||
|
||||
call airline#parts#define_function('tagbar', 'airline#extensions#tagbar#currenttag')
|
||||
endfunction
|
||||
|
||||
22
.vim/autoload/airline/extensions/term.vim
Normal file
22
.vim/autoload/airline/extensions/term.vim
Normal file
@ -0,0 +1,22 @@
|
||||
" MIT License.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
function! airline#extensions#term#apply(...)
|
||||
if &buftype == 'terminal'
|
||||
let spc = g:airline_symbols.space
|
||||
|
||||
call a:1.add_section('airline_a', spc.'TERMINAL'.spc)
|
||||
call a:1.add_section('airline_b', '')
|
||||
call a:1.add_section('airline_c', spc.'%f')
|
||||
call a:1.split()
|
||||
call a:1.add_section('airline_y', '')
|
||||
call a:1.add_section('airline_z', spc.airline#section#create_right(['linenr', 'maxlinenr']))
|
||||
return 1
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#term#init(ext)
|
||||
call a:ext.add_statusline_func('airline#extensions#term#apply')
|
||||
endfunction
|
||||
28
.vim/autoload/airline/extensions/tmuxline.vim
Normal file
28
.vim/autoload/airline/extensions/tmuxline.vim
Normal file
@ -0,0 +1,28 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
if !exists(':Tmuxline')
|
||||
finish
|
||||
endif
|
||||
|
||||
let s:tmuxline_snapshot_file = get(g:, 'airline#extensions#tmuxline#snapshot_file', '')
|
||||
let s:color_template = get(g:, 'airline#extensions#tmuxline#color_template', 'normal')
|
||||
|
||||
function! airline#extensions#tmuxline#init(ext)
|
||||
call a:ext.add_theme_func('airline#extensions#tmuxline#set_tmux_colors')
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#tmuxline#set_tmux_colors(palette)
|
||||
let color_template = has_key(a:palette, s:color_template) ? s:color_template : 'normal'
|
||||
let mode_palette = a:palette[color_template]
|
||||
|
||||
let tmuxline_theme = tmuxline#api#create_theme_from_airline(mode_palette)
|
||||
call tmuxline#api#set_theme(tmuxline_theme)
|
||||
|
||||
if strlen(s:tmuxline_snapshot_file)
|
||||
call tmuxline#api#snapshot(s:tmuxline_snapshot_file)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
29
.vim/autoload/airline/extensions/undotree.vim
Normal file
29
.vim/autoload/airline/extensions/undotree.vim
Normal file
@ -0,0 +1,29 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
if !exists(':UndotreeToggle')
|
||||
finish
|
||||
endif
|
||||
|
||||
function! airline#extensions#undotree#apply(...)
|
||||
if exists('t:undotree')
|
||||
if &ft == 'undotree'
|
||||
if exists('*t:undotree.GetStatusLine')
|
||||
call airline#extensions#apply_left_override('undo', '%{t:undotree.GetStatusLine()}')
|
||||
else
|
||||
call airline#extensions#apply_left_override('undotree', '%f')
|
||||
endif
|
||||
endif
|
||||
|
||||
if &ft == 'diff' && exists('*t:diffpanel.GetStatusLine')
|
||||
call airline#extensions#apply_left_override('diff', '%{t:diffpanel.GetStatusLine()}')
|
||||
endif
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#undotree#init(ext)
|
||||
call a:ext.add_statusline_func('airline#extensions#undotree#apply')
|
||||
endfunction
|
||||
|
||||
24
.vim/autoload/airline/extensions/unicode.vim
Normal file
24
.vim/autoload/airline/extensions/unicode.vim
Normal file
@ -0,0 +1,24 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
if !get(g:, 'loaded_unicodePlugin', 0)
|
||||
finish
|
||||
endif
|
||||
|
||||
function! airline#extensions#unicode#apply(...)
|
||||
if exists(":UnicodeTable") == 2 && bufname('') ==# 'UnicodeTable'
|
||||
call airline#parts#define('unicode', {
|
||||
\ 'text': '[UnicodeTable]',
|
||||
\ 'accent': 'bold' })
|
||||
let w:airline_section_a = airline#section#create(['unicode'])
|
||||
let w:airline_section_b = ''
|
||||
let w:airline_section_c = ' '
|
||||
let w:airline_section_y = ''
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#unicode#init(ext)
|
||||
call a:ext.add_statusline_func('airline#extensions#unicode#apply')
|
||||
endfunction
|
||||
25
.vim/autoload/airline/extensions/unite.vim
Normal file
25
.vim/autoload/airline/extensions/unite.vim
Normal file
@ -0,0 +1,25 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
if !get(g:, 'loaded_unite', 0)
|
||||
finish
|
||||
endif
|
||||
|
||||
function! airline#extensions#unite#apply(...)
|
||||
if &ft == 'unite'
|
||||
call a:1.add_section('airline_a', ' Unite ')
|
||||
call a:1.add_section('airline_b', ' %{get(unite#get_context(), "buffer_name", "")} ')
|
||||
call a:1.add_section('airline_c', ' %{unite#get_status_string()} ')
|
||||
call a:1.split()
|
||||
call a:1.add_section('airline_y', ' %{get(unite#get_context(), "real_buffer_name", "")} ')
|
||||
return 1
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#unite#init(ext)
|
||||
let g:unite_force_overwrite_statusline = 0
|
||||
call a:ext.add_statusline_func('airline#extensions#unite#apply')
|
||||
endfunction
|
||||
|
||||
30
.vim/autoload/airline/extensions/vimagit.vim
Normal file
30
.vim/autoload/airline/extensions/vimagit.vim
Normal file
@ -0,0 +1,30 @@
|
||||
" MIT License. Copyright (c) 2016 Jerome Reybert
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
" This plugin replace the whole section_a when in vimagit buffer
|
||||
scriptencoding utf-8
|
||||
|
||||
if !get(g:, 'loaded_magit', 0)
|
||||
finish
|
||||
endif
|
||||
|
||||
function! airline#extensions#vimagit#init(ext)
|
||||
call a:ext.add_statusline_func('airline#extensions#vimagit#apply')
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#vimagit#get_mode()
|
||||
if ( b:magit_current_commit_mode == '' )
|
||||
return "STAGING"
|
||||
elseif ( b:magit_current_commit_mode == 'CC' )
|
||||
return "COMMIT"
|
||||
elseif ( b:magit_current_commit_mode == 'CA' )
|
||||
return "AMEND"
|
||||
else
|
||||
return "???"
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#vimagit#apply(...)
|
||||
if ( &filetype == 'magit' )
|
||||
let w:airline_section_a = '%{airline#extensions#vimagit#get_mode()}'
|
||||
endif
|
||||
endfunction
|
||||
81
.vim/autoload/airline/extensions/vimtex.vim
Normal file
81
.vim/autoload/airline/extensions/vimtex.vim
Normal file
@ -0,0 +1,81 @@
|
||||
scriptencoding utf-8
|
||||
|
||||
let s:spc = g:airline_symbols.space
|
||||
|
||||
function! s:SetDefault(var, val)
|
||||
if !exists(a:var)
|
||||
execute 'let ' . a:var . '=' . string(a:val)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" Left and right delimiters (added only when status string is not empty)
|
||||
call s:SetDefault( 'g:airline#extensions#vimtex#left', "{")
|
||||
call s:SetDefault( 'g:airline#extensions#vimtex#right', "}")
|
||||
|
||||
" The current tex file is the main project file
|
||||
call s:SetDefault( 'g:airline#extensions#vimtex#main', "" )
|
||||
"
|
||||
" The current tex file is a subfile of the project
|
||||
" and the compilation is set for the main file
|
||||
call s:SetDefault( 'g:airline#extensions#vimtex#sub_main', "m")
|
||||
"
|
||||
" The current tex file is a subfile of the project
|
||||
" and the compilation is set for this subfile
|
||||
call s:SetDefault( 'g:airline#extensions#vimtex#sub_local', "l")
|
||||
"
|
||||
" Compilation is running and continuous compilation is off
|
||||
call s:SetDefault( 'g:airline#extensions#vimtex#compiled', "c₁")
|
||||
|
||||
" Compilation is running and continuous compilation is on
|
||||
call s:SetDefault( 'g:airline#extensions#vimtex#continuous', "c")
|
||||
|
||||
" Viewer is opened
|
||||
call s:SetDefault( 'g:airline#extensions#vimtex#viewer', "v")
|
||||
|
||||
function! airline#extensions#vimtex#init(ext)
|
||||
call airline#parts#define_raw('vimtex', '%{airline#extensions#vimtex#get_scope()}')
|
||||
call a:ext.add_statusline_func('airline#extensions#vimtex#apply')
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#vimtex#apply(...)
|
||||
if exists("b:vimtex")
|
||||
let w:airline_section_x = get(w:, 'airline_section_x', g:airline_section_x)
|
||||
let w:airline_section_x.=s:spc.g:airline_left_alt_sep.s:spc.'%{airline#extensions#vimtex#get_scope()}'
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#vimtex#get_scope()
|
||||
let l:status = ''
|
||||
|
||||
let vt_local = get(b:, 'vimtex_local', {})
|
||||
if empty(vt_local)
|
||||
let l:status .= g:airline#extensions#vimtex#main
|
||||
else
|
||||
if get(vt_local, 'active')
|
||||
let l:status .= g:airline#extensions#vimtex#sub_local
|
||||
else
|
||||
let l:status .= g:airline#extensions#vimtex#sub_main
|
||||
endif
|
||||
endif
|
||||
|
||||
if get(get(get(b:, 'vimtex', {}), 'viewer', {}), 'xwin_id')
|
||||
let l:status .= g:airline#extensions#vimtex#viewer
|
||||
endif
|
||||
|
||||
let l:compiler = get(get(b:, 'vimtex', {}), 'compiler', {})
|
||||
if !empty(l:compiler)
|
||||
if has_key(l:compiler, 'is_running') && b:vimtex.compiler.is_running()
|
||||
if get(l:compiler, 'continuous')
|
||||
let l:status .= g:airline#extensions#vimtex#continuous
|
||||
else
|
||||
let l:status .= g:airline#extensions#vimtex#compiled
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
if !empty(l:status)
|
||||
let l:status = g:airline#extensions#vimtex#left . l:status . g:airline#extensions#vimtex#right
|
||||
endif
|
||||
return l:status
|
||||
endfunction
|
||||
|
||||
31
.vim/autoload/airline/extensions/virtualenv.vim
Normal file
31
.vim/autoload/airline/extensions/virtualenv.vim
Normal file
@ -0,0 +1,31 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
let s:spc = g:airline_symbols.space
|
||||
|
||||
function! airline#extensions#virtualenv#init(ext)
|
||||
call a:ext.add_statusline_func('airline#extensions#virtualenv#apply')
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#virtualenv#apply(...)
|
||||
if &filetype =~# "python"
|
||||
if get(g:, 'virtualenv_loaded', 0)
|
||||
let statusline = virtualenv#statusline()
|
||||
else
|
||||
let statusline = fnamemodify($VIRTUAL_ENV, ':t')
|
||||
endif
|
||||
if !empty(statusline)
|
||||
call airline#extensions#append_to_section('x',
|
||||
\ s:spc.g:airline_right_alt_sep.s:spc.statusline)
|
||||
endif
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#virtualenv#update()
|
||||
if &filetype =~# "python"
|
||||
call airline#extensions#virtualenv#apply()
|
||||
call airline#update_statusline()
|
||||
endif
|
||||
endfunction
|
||||
168
.vim/autoload/airline/extensions/whitespace.vim
Normal file
168
.vim/autoload/airline/extensions/whitespace.vim
Normal file
@ -0,0 +1,168 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
" http://got-ravings.blogspot.com/2008/10/vim-pr0n-statusline-whitespace-flags.html
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
let s:show_message = get(g:, 'airline#extensions#whitespace#show_message', 1)
|
||||
let s:symbol = get(g:, 'airline#extensions#whitespace#symbol', g:airline_symbols.whitespace)
|
||||
let s:default_checks = ['indent', 'trailing', 'mixed-indent-file']
|
||||
|
||||
let s:enabled = get(g:, 'airline#extensions#whitespace#enabled', 1)
|
||||
let s:skip_check_ft = {'make': ['indent', 'mixed-indent-file'] }
|
||||
|
||||
function! s:check_mixed_indent()
|
||||
let indent_algo = get(g:, 'airline#extensions#whitespace#mixed_indent_algo', 0)
|
||||
if indent_algo == 1
|
||||
" [<tab>]<space><tab>
|
||||
" 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 than tabstop value
|
||||
let t_l_s = '(^\t+ {' . &ts . ',}' . '\S)'
|
||||
return search('\v' . t_s_t . '|' . t_l_s, 'nw')
|
||||
elseif indent_algo == 2
|
||||
return search('\v(^\t* +\t\s*\S)', 'nw')
|
||||
else
|
||||
return search('\v(^\t+ +)|(^ +\t+)', 'nw')
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:check_mixed_indent_file()
|
||||
let c_like_langs = get(g:, 'airline#extensions#c_like_langs',
|
||||
\ [ 'c', 'cpp', 'cuda', 'go', 'javascript', 'ld', 'php' ])
|
||||
if index(c_like_langs, &ft) > -1
|
||||
" for C-like languages: allow /** */ comment style with one space before the '*'
|
||||
let head_spc = '\v(^ +\*@!)'
|
||||
else
|
||||
let head_spc = '\v(^ +)'
|
||||
endif
|
||||
let indent_tabs = search('\v(^\t+)', 'nw')
|
||||
let indent_spc = search(head_spc, 'nw')
|
||||
if indent_tabs > 0 && indent_spc > 0
|
||||
return printf("%d:%d", indent_tabs, indent_spc)
|
||||
else
|
||||
return ''
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#whitespace#check()
|
||||
let max_lines = get(g:, 'airline#extensions#whitespace#max_lines', 20000)
|
||||
if &readonly || !&modifiable || !s:enabled || line('$') > max_lines
|
||||
\ || get(b:, 'airline_whitespace_disabled', 0)
|
||||
return ''
|
||||
endif
|
||||
|
||||
if !exists('b:airline_whitespace_check')
|
||||
let b:airline_whitespace_check = ''
|
||||
let checks = get(b:, 'airline_whitespace_checks', get(g:, 'airline#extensions#whitespace#checks', s:default_checks))
|
||||
|
||||
let trailing = 0
|
||||
if index(checks, 'trailing') > -1
|
||||
try
|
||||
let regexp = get(g:, 'airline#extensions#whitespace#trailing_regexp', '\s$')
|
||||
let trailing = search(regexp, 'nw')
|
||||
catch
|
||||
echomsg 'airline#whitespace: error occured evaluating '. regexp
|
||||
echomsg v:exception
|
||||
return ''
|
||||
endtry
|
||||
endif
|
||||
|
||||
let mixed = 0
|
||||
let check = 'indent'
|
||||
if index(checks, check) > -1 && index(get(s:skip_check_ft, &ft, []), check) < 0
|
||||
let mixed = s:check_mixed_indent()
|
||||
endif
|
||||
|
||||
let mixed_file = ''
|
||||
let check = 'mixed-indent-file'
|
||||
if index(checks, check) > -1 && index(get(s:skip_check_ft, &ft, []), check) < 0
|
||||
let mixed_file = s:check_mixed_indent_file()
|
||||
endif
|
||||
|
||||
let long = 0
|
||||
if index(checks, 'long') > -1 && &tw > 0
|
||||
let long = search('\%>'.&tw.'v.\+', 'nw')
|
||||
endif
|
||||
|
||||
if trailing != 0 || mixed != 0 || long != 0 || !empty(mixed_file)
|
||||
let b:airline_whitespace_check = s:symbol
|
||||
if strlen(s:symbol) > 0
|
||||
let space = (g:airline_symbols.space)
|
||||
else
|
||||
let space = ''
|
||||
endif
|
||||
|
||||
if s:show_message
|
||||
if trailing != 0
|
||||
let trailing_fmt = get(g:, 'airline#extensions#whitespace#trailing_format', '[%s]trailing')
|
||||
let b:airline_whitespace_check .= space.printf(trailing_fmt, trailing)
|
||||
endif
|
||||
if mixed != 0
|
||||
let mixed_indent_fmt = get(g:, 'airline#extensions#whitespace#mixed_indent_format', '[%s]mixed-indent')
|
||||
let b:airline_whitespace_check .= space.printf(mixed_indent_fmt, mixed)
|
||||
endif
|
||||
if long != 0
|
||||
let long_fmt = get(g:, 'airline#extensions#whitespace#long_format', '[%s]long')
|
||||
let b:airline_whitespace_check .= space.printf(long_fmt, long)
|
||||
endif
|
||||
if !empty(mixed_file)
|
||||
let mixed_indent_file_fmt = get(g:, 'airline#extensions#whitespace#mixed_indent_file_format', '[%s]mix-indent-file')
|
||||
let b:airline_whitespace_check .= space.printf(mixed_indent_file_fmt, mixed_file)
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
return airline#util#shorten(b:airline_whitespace_check, 120, 9)
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#whitespace#toggle()
|
||||
if s:enabled
|
||||
augroup airline_whitespace
|
||||
autocmd!
|
||||
augroup END
|
||||
augroup! airline_whitespace
|
||||
let s:enabled = 0
|
||||
else
|
||||
call airline#extensions#whitespace#init()
|
||||
let s:enabled = 1
|
||||
endif
|
||||
|
||||
if exists("g:airline#extensions#whitespace#enabled")
|
||||
let g:airline#extensions#whitespace#enabled = s:enabled
|
||||
if s:enabled && match(g:airline_section_warning, '#whitespace#check') < 0
|
||||
let g:airline_section_warning .= airline#section#create(['whitespace'])
|
||||
call airline#update_statusline()
|
||||
endif
|
||||
endif
|
||||
echo 'Whitespace checking: '.(s:enabled ? 'Enabled' : 'Disabled')
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#whitespace#disable()
|
||||
if s:enabled
|
||||
call airline#extensions#whitespace#toggle()
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#whitespace#init(...)
|
||||
call airline#parts#define_function('whitespace', 'airline#extensions#whitespace#check')
|
||||
|
||||
unlet! b:airline_whitespace_check
|
||||
augroup airline_whitespace
|
||||
autocmd!
|
||||
autocmd CursorHold,BufWritePost * call <sid>ws_refresh()
|
||||
augroup END
|
||||
endfunction
|
||||
|
||||
function! s:ws_refresh()
|
||||
if get(b:, 'airline_ws_changedtick', 0) == b:changedtick
|
||||
return
|
||||
endif
|
||||
unlet! b:airline_whitespace_check
|
||||
if get(g:, 'airline_skip_empty_sections', 0)
|
||||
exe ':AirlineRefresh'
|
||||
endif
|
||||
let b:airline_ws_changedtick = b:changedtick
|
||||
endfunction
|
||||
29
.vim/autoload/airline/extensions/windowswap.vim
Normal file
29
.vim/autoload/airline/extensions/windowswap.vim
Normal file
@ -0,0 +1,29 @@
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
if !exists('g:loaded_windowswap')
|
||||
finish
|
||||
endif
|
||||
|
||||
let s:spc = g:airline_symbols.space
|
||||
|
||||
if !exists('g:airline#extensions#windowswap#indicator_text')
|
||||
let g:airline#extensions#windowswap#indicator_text = 'WS'
|
||||
endif
|
||||
|
||||
function! airline#extensions#windowswap#init(ext)
|
||||
call airline#parts#define_function('windowswap', 'airline#extensions#windowswap#get_status')
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#windowswap#get_status()
|
||||
" use new tab-aware api if WS is up to date
|
||||
let s:mark = exists('*WindowSwap#IsCurrentWindowMarked') ?
|
||||
\WindowSwap#IsCurrentWindowMarked() :
|
||||
\(WindowSwap#HasMarkedWindow() && WindowSwap#GetMarkedWindowNum() == winnr())
|
||||
if s:mark
|
||||
return g:airline#extensions#windowswap#indicator_text.s:spc
|
||||
endif
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
43
.vim/autoload/airline/extensions/wordcount.vim
Normal file
43
.vim/autoload/airline/extensions/wordcount.vim
Normal file
@ -0,0 +1,43 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
let s:formatter = get(g:, 'airline#extensions#wordcount#formatter', 'default')
|
||||
let g:airline#extensions#wordcount#filetypes = get(g:, 'airline#extensions#wordcount#filetypes',
|
||||
\ '\vhelp|markdown|rst|org|text|asciidoc|tex|mail')
|
||||
|
||||
function! s:wordcount_update()
|
||||
if empty(bufname(''))
|
||||
return
|
||||
endif
|
||||
if match(&ft, get(g:, 'airline#extensions#wordcount#filetypes')) > -1
|
||||
let l:mode = mode()
|
||||
if l:mode ==# 'v' || l:mode ==# 'V' || l:mode ==# 's' || l:mode ==# 'S'
|
||||
let b:airline_wordcount = airline#extensions#wordcount#formatters#{s:formatter}#format()
|
||||
let b:airline_change_tick = b:changedtick
|
||||
else
|
||||
if get(b:, 'airline_wordcount_cache', '') is# '' ||
|
||||
\ b:airline_wordcount_cache isnot# get(b:, 'airline_wordcount', '') ||
|
||||
\ get(b:, 'airline_change_tick', 0) != b:changedtick ||
|
||||
\ get(b:, 'airline_winwidth', 0) != winwidth(0)
|
||||
" cache data
|
||||
let b:airline_wordcount = airline#extensions#wordcount#formatters#{s:formatter}#format()
|
||||
let b:airline_wordcount_cache = b:airline_wordcount
|
||||
let b:airline_change_tick = b:changedtick
|
||||
let b:airline_winwidth = winwidth(0)
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#wordcount#apply(...)
|
||||
if match(&ft, get(g:, 'airline#extensions#wordcount#filetypes')) > -1
|
||||
call airline#extensions#prepend_to_section('z', '%{get(b:, "airline_wordcount", "")}')
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#wordcount#init(ext)
|
||||
call a:ext.add_statusline_func('airline#extensions#wordcount#apply')
|
||||
autocmd BufReadPost,CursorMoved,CursorMovedI * call s:wordcount_update()
|
||||
endfunction
|
||||
@ -0,0 +1,66 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
function! airline#extensions#wordcount#formatters#default#format()
|
||||
let fmt = get(g:, 'airline#extensions#wordcount#formatter#default#fmt', '%s words')
|
||||
let fmt_short = get(g:, 'airline#extensions#wordcount#formatter#default#fmt_short', fmt == '%s words' ? '%sW' : fmt)
|
||||
let words = string(s:wordcount())
|
||||
if empty(words)
|
||||
return
|
||||
endif
|
||||
let result = g:airline_symbols.space . g:airline_right_alt_sep . g:airline_symbols.space
|
||||
if winwidth(0) >= 80
|
||||
let separator = s:get_decimal_group()
|
||||
if words > 999 && !empty(separator)
|
||||
" Format number according to locale, e.g. German: 1.245 or English: 1,245
|
||||
let words = substitute(words, '\d\@<=\(\(\d\{3\}\)\+\)$', separator.'&', 'g')
|
||||
endif
|
||||
let result = printf(fmt, words). result
|
||||
else
|
||||
let result = printf(fmt_short, words). result
|
||||
endif
|
||||
return result
|
||||
endfunction
|
||||
|
||||
function! s:wordcount()
|
||||
if exists("*wordcount")
|
||||
let l:mode = mode()
|
||||
if l:mode ==# 'v' || l:mode ==# 'V' || l:mode ==# 's' || l:mode ==# 'S'
|
||||
let l:visual_words = wordcount()['visual_words']
|
||||
if l:visual_words != ''
|
||||
return l:visual_words
|
||||
else
|
||||
return 0
|
||||
endif
|
||||
else
|
||||
return wordcount()['words']
|
||||
endif
|
||||
elseif mode() =~? 's'
|
||||
return
|
||||
else
|
||||
let old_status = v:statusmsg
|
||||
let position = getpos(".")
|
||||
exe "silent normal! g\<c-g>"
|
||||
let stat = v:statusmsg
|
||||
call setpos('.', position)
|
||||
let v:statusmsg = old_status
|
||||
|
||||
let parts = split(stat)
|
||||
if len(parts) > 11
|
||||
return str2nr(parts[11])
|
||||
else
|
||||
return
|
||||
endif
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:get_decimal_group()
|
||||
if match(v:lang, '\v\cC|en') > -1
|
||||
return ','
|
||||
elseif match(v:lang, '\v\cde|dk|fr|pt') > -1
|
||||
return '.'
|
||||
endif
|
||||
return ''
|
||||
endfunction
|
||||
25
.vim/autoload/airline/extensions/xkblayout.vim
Normal file
25
.vim/autoload/airline/extensions/xkblayout.vim
Normal file
@ -0,0 +1,25 @@
|
||||
" MIT License. Copyright (c) 2017 YoungHoon Rhiu.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
if !exists('g:XkbSwitchLib')
|
||||
finish
|
||||
endif
|
||||
|
||||
function! airline#extensions#xkblayout#status()
|
||||
let keyboard_layout = libcall(g:XkbSwitchLib, 'Xkb_Switch_getXkbLayout', '')
|
||||
let keyboard_layout = split(keyboard_layout, '\.')[-1]
|
||||
let short_codes = {'2SetKorean': 'KR', 'Chinese': 'CN', 'Japanese': 'JP'}
|
||||
|
||||
if has_key(short_codes, keyboard_layout)
|
||||
let keyboard_layout = short_codes[keyboard_layout]
|
||||
endif
|
||||
|
||||
return keyboard_layout
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#xkblayout#init(ext)
|
||||
call airline#parts#define_function('xkblayout', 'airline#extensions#xkblayout#status')
|
||||
endfunction
|
||||
|
||||
38
.vim/autoload/airline/extensions/ycm.vim
Normal file
38
.vim/autoload/airline/extensions/ycm.vim
Normal file
@ -0,0 +1,38 @@
|
||||
" MIT License. Copyright (c) 2015 Evgeny Firsov.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
let s:spc = g:airline_symbols.space
|
||||
let s:error_symbol = get(g:, 'airline#extensions#ycm#error_symbol', 'E:')
|
||||
let s:warning_symbol = get(g:, 'airline#extensions#ycm#warning_symbol', 'W:')
|
||||
|
||||
function! airline#extensions#ycm#init(ext)
|
||||
call airline#parts#define_function('ycm_error_count', 'airline#extensions#ycm#get_error_count')
|
||||
call airline#parts#define_function('ycm_warning_count', 'airline#extensions#ycm#get_warning_count')
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#ycm#get_error_count()
|
||||
if exists(':YcmDiag') && exists("*youcompleteme#GetErrorCount")
|
||||
let cnt = youcompleteme#GetErrorCount()
|
||||
|
||||
if cnt != 0
|
||||
return s:error_symbol.cnt
|
||||
endif
|
||||
endif
|
||||
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#ycm#get_warning_count()
|
||||
if exists(':YcmDiag') && exists("*youcompleteme#GetWarningCount")
|
||||
let cnt = youcompleteme#GetWarningCount()
|
||||
|
||||
if cnt != 0
|
||||
return s:warning_symbol.cnt.s:spc
|
||||
endif
|
||||
endif
|
||||
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
267
.vim/autoload/airline/highlighter.vim
Normal file
267
.vim/autoload/airline/highlighter.vim
Normal file
@ -0,0 +1,267 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
let s:is_win32term = (has('win32') || has('win64')) &&
|
||||
\ !has('gui_running') &&
|
||||
\ (empty($CONEMUBUILD) || &term !=? 'xterm') &&
|
||||
\ !(exists("+termguicolors") && &termguicolors)
|
||||
|
||||
let s:separators = {}
|
||||
let s:accents = {}
|
||||
let s:hl_groups = {}
|
||||
|
||||
function! s:gui2cui(rgb, fallback)
|
||||
if a:rgb == ''
|
||||
return a:fallback
|
||||
elseif match(a:rgb, '^\%(NONE\|[fb]g\)$') > -1
|
||||
return a:rgb
|
||||
endif
|
||||
let rgb = map(split(a:rgb[1:], '..\zs'), '0 + ("0x".v:val)')
|
||||
return airline#msdos#round_msdos_colors(rgb)
|
||||
endfunction
|
||||
|
||||
function! s:get_syn(group, what)
|
||||
if !exists("g:airline_gui_mode")
|
||||
let g:airline_gui_mode = airline#init#gui_mode()
|
||||
endif
|
||||
let color = ''
|
||||
if hlexists(a:group)
|
||||
let color = synIDattr(synIDtrans(hlID(a:group)), a:what, g:airline_gui_mode)
|
||||
endif
|
||||
if empty(color) || color == -1
|
||||
" should always exists
|
||||
let color = synIDattr(synIDtrans(hlID('Normal')), a:what, g:airline_gui_mode)
|
||||
" however, just in case
|
||||
if empty(color) || color == -1
|
||||
let color = 'NONE'
|
||||
endif
|
||||
endif
|
||||
return color
|
||||
endfunction
|
||||
|
||||
function! s:get_array(fg, bg, opts)
|
||||
let opts=empty(a:opts) ? '' : join(a:opts, ',')
|
||||
return g:airline_gui_mode ==# 'gui'
|
||||
\ ? [ a:fg, a:bg, '', '', opts ]
|
||||
\ : [ '', '', a:fg, a:bg, opts ]
|
||||
endfunction
|
||||
|
||||
function! airline#highlighter#reset_hlcache()
|
||||
let s:hl_groups = {}
|
||||
endfunction
|
||||
|
||||
function! airline#highlighter#get_highlight(group, ...)
|
||||
if get(g:, 'airline_highlighting_cache', 0) && has_key(s:hl_groups, a:group)
|
||||
return s:hl_groups[a:group]
|
||||
else
|
||||
let fg = s:get_syn(a:group, 'fg')
|
||||
let bg = s:get_syn(a:group, 'bg')
|
||||
let reverse = g:airline_gui_mode ==# 'gui'
|
||||
\ ? synIDattr(synIDtrans(hlID(a:group)), 'reverse', 'gui')
|
||||
\ : synIDattr(synIDtrans(hlID(a:group)), 'reverse', 'cterm')
|
||||
\|| synIDattr(synIDtrans(hlID(a:group)), 'reverse', 'term')
|
||||
let bold = synIDattr(synIDtrans(hlID(a:group)), 'bold')
|
||||
let opts = a:000
|
||||
if bold
|
||||
let opts = ['bold']
|
||||
endif
|
||||
let res = reverse ? s:get_array(bg, fg, opts) : s:get_array(fg, bg, opts)
|
||||
endif
|
||||
let s:hl_groups[a:group] = res
|
||||
return res
|
||||
endfunction
|
||||
|
||||
function! airline#highlighter#get_highlight2(fg, bg, ...)
|
||||
let fg = s:get_syn(a:fg[0], a:fg[1])
|
||||
let bg = s:get_syn(a:bg[0], a:bg[1])
|
||||
return s:get_array(fg, bg, a:000)
|
||||
endfunction
|
||||
|
||||
function! s:hl_group_exists(group)
|
||||
if !hlexists(a:group)
|
||||
return 0
|
||||
elseif empty(synIDattr(hlID(a:group), 'fg'))
|
||||
return 0
|
||||
endif
|
||||
return 1
|
||||
endfunction
|
||||
|
||||
function! airline#highlighter#exec(group, colors)
|
||||
if pumvisible()
|
||||
return
|
||||
endif
|
||||
let colors = a:colors
|
||||
if s:is_win32term
|
||||
let colors[2] = s:gui2cui(get(colors, 0, ''), get(colors, 2, ''))
|
||||
let colors[3] = s:gui2cui(get(colors, 1, ''), get(colors, 3, ''))
|
||||
endif
|
||||
let old_hi = airline#highlighter#get_highlight(a:group)
|
||||
if len(colors) == 4
|
||||
call add(colors, '')
|
||||
endif
|
||||
if g:airline_gui_mode ==# 'gui'
|
||||
let new_hi = [colors[0], colors[1], '', '', colors[4]]
|
||||
else
|
||||
let new_hi = ['', '', printf("%s", colors[2]), printf("%s", colors[3]), colors[4]]
|
||||
endif
|
||||
let colors = s:CheckDefined(colors)
|
||||
if old_hi != new_hi || !s:hl_group_exists(a:group)
|
||||
let cmd = printf('hi %s %s %s %s %s %s %s %s',
|
||||
\ a:group, s:Get(colors, 0, 'guifg='), s:Get(colors, 1, 'guibg='),
|
||||
\ s:Get(colors, 2, 'ctermfg='), s:Get(colors, 3, 'ctermbg='),
|
||||
\ s:Get(colors, 4, 'gui='), s:Get(colors, 4, 'cterm='),
|
||||
\ s:Get(colors, 4, 'term='))
|
||||
exe cmd
|
||||
if has_key(s:hl_groups, a:group)
|
||||
let s:hl_groups[a:group] = colors
|
||||
endif
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:CheckDefined(colors)
|
||||
" Checks, whether the definition of the colors is valid and is not empty or NONE
|
||||
" e.g. if the colors would expand to this:
|
||||
" hi airline_c ctermfg=NONE ctermbg=NONE
|
||||
" that means to clear that highlighting group, therefore, fallback to Normal
|
||||
" highlighting group for the cterm values
|
||||
|
||||
" This only works, if the Normal highlighting group is actually defined, so
|
||||
" return early, if it has been cleared
|
||||
if !exists("g:airline#highlighter#normal_fg_hi")
|
||||
let g:airline#highlighter#normal_fg_hi = synIDattr(synIDtrans(hlID('Normal')), 'fg', 'cterm')
|
||||
endif
|
||||
if empty(g:airline#highlighter#normal_fg_hi) || g:airline#highlighter#normal_fg_hi < 0
|
||||
return a:colors
|
||||
endif
|
||||
|
||||
for val in a:colors
|
||||
if !empty(val) && val !=# 'NONE'
|
||||
return a:colors
|
||||
endif
|
||||
endfor
|
||||
" this adds the bold attribute to the term argument of the :hi command,
|
||||
" but at least this makes sure, the group will be defined
|
||||
let fg = g:airline#highlighter#normal_fg_hi
|
||||
let bg = synIDattr(synIDtrans(hlID('Normal')), 'bg', 'cterm')
|
||||
if bg < 0
|
||||
" in case there is no background color defined for Normal
|
||||
let bg = a:colors[3]
|
||||
endif
|
||||
return a:colors[0:1] + [fg, bg] + [a:colors[4]]
|
||||
endfunction
|
||||
|
||||
function! s:Get(dict, key, prefix)
|
||||
let res=get(a:dict, a:key, '')
|
||||
if res is ''
|
||||
return ''
|
||||
else
|
||||
return a:prefix. res
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:exec_separator(dict, from, to, inverse, suffix)
|
||||
if pumvisible()
|
||||
return
|
||||
endif
|
||||
let l:from = airline#themes#get_highlight(a:from.a:suffix)
|
||||
let l:to = airline#themes#get_highlight(a:to.a:suffix)
|
||||
let group = a:from.'_to_'.a:to.a:suffix
|
||||
if a:inverse
|
||||
let colors = [ l:from[1], l:to[1], l:from[3], l:to[3] ]
|
||||
else
|
||||
let colors = [ l:to[1], l:from[1], l:to[3], l:from[3] ]
|
||||
endif
|
||||
let a:dict[group] = colors
|
||||
call airline#highlighter#exec(group, colors)
|
||||
endfunction
|
||||
|
||||
function! airline#highlighter#load_theme()
|
||||
if pumvisible()
|
||||
return
|
||||
endif
|
||||
for winnr in filter(range(1, winnr('$')), 'v:val != winnr()')
|
||||
call airline#highlighter#highlight_modified_inactive(winbufnr(winnr))
|
||||
endfor
|
||||
call airline#highlighter#highlight(['inactive'])
|
||||
if getbufvar( bufnr('%'), '&modified' )
|
||||
call airline#highlighter#highlight(['normal', 'modified'])
|
||||
else
|
||||
call airline#highlighter#highlight(['normal'])
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! airline#highlighter#add_separator(from, to, inverse)
|
||||
let s:separators[a:from.a:to] = [a:from, a:to, a:inverse]
|
||||
call <sid>exec_separator({}, a:from, a:to, a:inverse, '')
|
||||
endfunction
|
||||
|
||||
function! airline#highlighter#add_accent(accent)
|
||||
let s:accents[a:accent] = 1
|
||||
endfunction
|
||||
|
||||
function! airline#highlighter#highlight_modified_inactive(bufnr)
|
||||
if getbufvar(a:bufnr, '&modified')
|
||||
let colors = exists('g:airline#themes#{g:airline_theme}#palette.inactive_modified.airline_c')
|
||||
\ ? g:airline#themes#{g:airline_theme}#palette.inactive_modified.airline_c : []
|
||||
else
|
||||
let colors = exists('g:airline#themes#{g:airline_theme}#palette.inactive.airline_c')
|
||||
\ ? g:airline#themes#{g:airline_theme}#palette.inactive.airline_c : []
|
||||
endif
|
||||
|
||||
if !empty(colors)
|
||||
call airline#highlighter#exec('airline_c'.(a:bufnr).'_inactive', colors)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! airline#highlighter#highlight(modes, ...)
|
||||
let bufnr = a:0 ? a:1 : ''
|
||||
let p = g:airline#themes#{g:airline_theme}#palette
|
||||
|
||||
" draw the base mode, followed by any overrides
|
||||
let mapped = map(a:modes, 'v:val == a:modes[0] ? v:val : a:modes[0]."_".v:val')
|
||||
let suffix = a:modes[0] == 'inactive' ? '_inactive' : ''
|
||||
for mode in mapped
|
||||
if mode == 'inactive' && winnr('$') == 1
|
||||
" there exist no inactive windows, don't need to create all those
|
||||
" highlighting groups
|
||||
continue
|
||||
endif
|
||||
if exists('g:airline#themes#{g:airline_theme}#palette[mode]')
|
||||
let dict = g:airline#themes#{g:airline_theme}#palette[mode]
|
||||
for kvp in items(dict)
|
||||
let mode_colors = kvp[1]
|
||||
let name = kvp[0]
|
||||
if name is# 'airline_c' && !empty(bufnr) && suffix is# '_inactive'
|
||||
let name = 'airline_c'.bufnr
|
||||
endif
|
||||
call airline#highlighter#exec(name.suffix, mode_colors)
|
||||
|
||||
for accent in keys(s:accents)
|
||||
if !has_key(p.accents, accent)
|
||||
continue
|
||||
endif
|
||||
let colors = copy(mode_colors)
|
||||
if p.accents[accent][0] != ''
|
||||
let colors[0] = p.accents[accent][0]
|
||||
endif
|
||||
if p.accents[accent][2] != ''
|
||||
let colors[2] = p.accents[accent][2]
|
||||
endif
|
||||
if len(colors) >= 5
|
||||
let colors[4] = get(p.accents[accent], 4, '')
|
||||
else
|
||||
call add(colors, get(p.accents[accent], 4, ''))
|
||||
endif
|
||||
call airline#highlighter#exec(name.suffix.'_'.accent, colors)
|
||||
endfor
|
||||
endfor
|
||||
|
||||
" TODO: optimize this
|
||||
for sep in items(s:separators)
|
||||
call <sid>exec_separator(dict, sep[1][0], sep[1][1], sep[1][2], suffix)
|
||||
endfor
|
||||
endif
|
||||
endfor
|
||||
endfunction
|
||||
201
.vim/autoload/airline/init.vim
Normal file
201
.vim/autoload/airline/init.vim
Normal file
@ -0,0 +1,201 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
function! s:check_defined(variable, default)
|
||||
if !exists(a:variable)
|
||||
let {a:variable} = a:default
|
||||
endif
|
||||
endfunction
|
||||
|
||||
let s:loaded = 0
|
||||
function! airline#init#bootstrap()
|
||||
if s:loaded
|
||||
return
|
||||
endif
|
||||
let s:loaded = 1
|
||||
|
||||
let g:airline#init#bootstrapping = 1
|
||||
|
||||
let g:airline#init#vim_async = (v:version >= 800 && has('job'))
|
||||
let g:airline#init#is_windows = has('win32') || has('win64')
|
||||
|
||||
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_spell', 1)
|
||||
call s:check_defined('g:airline_detect_spelllang', 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'])
|
||||
call s:check_defined('g:airline_exclude_filetypes', [])
|
||||
call s:check_defined('g:airline_exclude_preview', 0)
|
||||
call s:check_defined('g:airline_gui_mode', airline#init#gui_mode())
|
||||
|
||||
call s:check_defined('g:airline_mode_map', {})
|
||||
call extend(g:airline_mode_map, {
|
||||
\ '__' : '------',
|
||||
\ 'n' : 'NORMAL',
|
||||
\ 'i' : 'INSERT',
|
||||
\ 'R' : 'REPLACE',
|
||||
\ 'v' : 'VISUAL',
|
||||
\ 'V' : 'V-LINE',
|
||||
\ 'c' : 'COMMAND',
|
||||
\ '' : 'V-BLOCK',
|
||||
\ 's' : 'SELECT',
|
||||
\ 'S' : 'S-LINE',
|
||||
\ '' : 'S-BLOCK',
|
||||
\ 't' : 'TERMINAL',
|
||||
\ }, 'keep')
|
||||
|
||||
call s:check_defined('g:airline_theme_map', {})
|
||||
call extend(g:airline_theme_map, {
|
||||
\ '\CTomorrow': 'tomorrow',
|
||||
\ 'base16': 'base16',
|
||||
\ 'mo[l|n]okai': 'molokai',
|
||||
\ 'wombat': 'wombat',
|
||||
\ 'zenburn': 'zenburn',
|
||||
\ 'solarized': 'solarized',
|
||||
\ 'flattened': 'solarized',
|
||||
\ '\CNeoSolarized': 'solarized',
|
||||
\ }, 'keep')
|
||||
|
||||
call s:check_defined('g:airline_symbols', {})
|
||||
" First define the symbols,
|
||||
" that are common in Powerline/Unicode/ASCII mode,
|
||||
" then add specific symbols for either mode
|
||||
call extend(g:airline_symbols, {
|
||||
\ 'paste': 'PASTE',
|
||||
\ 'spell': 'SPELL',
|
||||
\ 'modified': '+',
|
||||
\ 'space': ' ',
|
||||
\ 'keymap': 'Keymap:'
|
||||
\ }, 'keep')
|
||||
|
||||
if get(g:, 'airline_powerline_fonts', 0)
|
||||
" Symbols for Powerline terminals
|
||||
call s:check_defined('g:airline_left_sep', "\ue0b0") "
|
||||
call s:check_defined('g:airline_left_alt_sep', "\ue0b1") "
|
||||
call s:check_defined('g:airline_right_sep', "\ue0b2") "
|
||||
call s:check_defined('g:airline_right_alt_sep', "\ue0b3") "
|
||||
" ro=, ws=☲, lnr=☰, mlnr=, br=, nx=Ɇ, crypt=🔒
|
||||
call extend(g:airline_symbols, {
|
||||
\ 'readonly': "\ue0a2",
|
||||
\ 'whitespace': "\u2632",
|
||||
\ 'linenr': "\u2630 ",
|
||||
\ 'maxlinenr': " \ue0a1",
|
||||
\ 'branch': "\ue0a0",
|
||||
\ 'notexists': "\u0246",
|
||||
\ 'crypt': nr2char(0x1F512),
|
||||
\ }, 'keep')
|
||||
elseif &encoding==?'utf-8' && !get(g:, "airline_symbols_ascii", 0)
|
||||
" Symbols for Unicode terminals
|
||||
call s:check_defined('g:airline_left_sep', "")
|
||||
call s:check_defined('g:airline_left_alt_sep', "")
|
||||
call s:check_defined('g:airline_right_sep', "")
|
||||
call s:check_defined('g:airline_right_alt_sep', "")
|
||||
" ro=⊝, ws=☲, lnr=☰, mlnr=㏑, br=ᚠ, nx=Ɇ, crypt=🔒
|
||||
call extend(g:airline_symbols, {
|
||||
\ 'readonly': "\u229D",
|
||||
\ 'whitespace': "\u2632",
|
||||
\ 'linenr': "\u2630 ",
|
||||
\ 'maxlinenr': " \u33D1",
|
||||
\ 'branch': "\u16A0",
|
||||
\ 'notexists': "\u0246",
|
||||
\ 'crypt': nr2char(0x1F512),
|
||||
\ }, 'keep')
|
||||
else
|
||||
" Symbols for ASCII terminals
|
||||
call s:check_defined('g:airline_left_sep', "")
|
||||
call s:check_defined('g:airline_left_alt_sep', "")
|
||||
call s:check_defined('g:airline_right_sep', "")
|
||||
call s:check_defined('g:airline_right_alt_sep', "")
|
||||
call extend(g:airline_symbols, {
|
||||
\ 'readonly': 'RO',
|
||||
\ 'whitespace': '!',
|
||||
\ 'linenr': 'ln ',
|
||||
\ 'maxlinenr': ' :',
|
||||
\ 'branch': '',
|
||||
\ 'notexists': '?',
|
||||
\ 'crypt': 'cr',
|
||||
\ }, 'keep')
|
||||
endif
|
||||
|
||||
call airline#parts#define('mode', {
|
||||
\ 'function': 'airline#parts#mode',
|
||||
\ 'accent': 'bold',
|
||||
\ })
|
||||
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('spell', 'airline#parts#spell')
|
||||
call airline#parts#define_function('filetype', 'airline#parts#filetype')
|
||||
call airline#parts#define('readonly', {
|
||||
\ 'function': 'airline#parts#readonly',
|
||||
\ 'accent': 'red',
|
||||
\ })
|
||||
call airline#parts#define_raw('file', '%f%m')
|
||||
call airline#parts#define_raw('path', '%F%m')
|
||||
call airline#parts#define('linenr', {
|
||||
\ 'raw': '%{g:airline_symbols.linenr}%4l',
|
||||
\ 'accent': 'bold'})
|
||||
call airline#parts#define('maxlinenr', {
|
||||
\ 'raw': '/%L%{g:airline_symbols.maxlinenr}',
|
||||
\ 'accent': 'bold'})
|
||||
call airline#parts#define_function('ffenc', 'airline#parts#ffenc')
|
||||
call airline#parts#define_empty(['hunks', 'branch', 'obsession', 'tagbar',
|
||||
\ 'syntastic-warn', 'syntastic-err', 'eclim', 'whitespace','windowswap',
|
||||
\ 'ycm_error_count', 'ycm_warning_count', 'neomake_error_count',
|
||||
\ 'neomake_warning_count', 'ale_error_count', 'ale_warning_count'])
|
||||
call airline#parts#define_text('capslock', '')
|
||||
call airline#parts#define_text('xkblayout', '')
|
||||
call airline#parts#define_text('keymap', '')
|
||||
|
||||
unlet g:airline#init#bootstrapping
|
||||
endfunction
|
||||
|
||||
function! airline#init#gui_mode()
|
||||
return ((has('nvim') && exists('$NVIM_TUI_ENABLE_TRUE_COLOR') && !exists("+termguicolors"))
|
||||
\ || has('gui_running') || (has("termtruecolor") && &guicolors == 1) || (has("termguicolors") && &termguicolors == 1)) ?
|
||||
\ 'gui' : 'cterm'
|
||||
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', 'crypt', 'paste', 'keymap', 'spell', 'capslock', 'xkblayout', 'iminsert'])
|
||||
endif
|
||||
if !exists('g:airline_section_b')
|
||||
let g:airline_section_b = airline#section#create(['hunks', 'branch'])
|
||||
endif
|
||||
if !exists('g:airline_section_c')
|
||||
if exists("+autochdir") && &autochdir == 1
|
||||
let g:airline_section_c = airline#section#create(['%<', 'path', spc, 'readonly'])
|
||||
else
|
||||
let g:airline_section_c = airline#section#create(['%<', 'file', spc, 'readonly'])
|
||||
endif
|
||||
endif
|
||||
if !exists('g:airline_section_gutter')
|
||||
let g:airline_section_gutter = airline#section#create(['%='])
|
||||
endif
|
||||
if !exists('g:airline_section_x')
|
||||
let g:airline_section_x = airline#section#create_right(['tagbar', 'filetype'])
|
||||
endif
|
||||
if !exists('g:airline_section_y')
|
||||
let g:airline_section_y = airline#section#create_right(['ffenc'])
|
||||
endif
|
||||
if !exists('g:airline_section_z')
|
||||
if winwidth(0) > 80
|
||||
let g:airline_section_z = airline#section#create(['windowswap', 'obsession', '%3p%%'.spc, 'linenr', 'maxlinenr', spc.':%3v'])
|
||||
else
|
||||
let g:airline_section_z = airline#section#create(['%3p%%'.spc, 'linenr', ':%3v'])
|
||||
endif
|
||||
endif
|
||||
if !exists('g:airline_section_error')
|
||||
let g:airline_section_error = airline#section#create(['ycm_error_count', 'syntastic-err', 'eclim', 'neomake_error_count', 'ale_error_count'])
|
||||
endif
|
||||
if !exists('g:airline_section_warning')
|
||||
let g:airline_section_warning = airline#section#create(['ycm_warning_count', 'syntastic-warn', 'neomake_warning_count', 'ale_warning_count', 'whitespace'])
|
||||
endif
|
||||
endfunction
|
||||
59
.vim/autoload/airline/msdos.vim
Normal file
59
.vim/autoload/airline/msdos.vim
Normal file
@ -0,0 +1,59 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
" basic 16 msdos from MSDOS
|
||||
" see output of color, should be
|
||||
" 0 Black
|
||||
" 1 DarkBlue
|
||||
" 2 DarkGreen
|
||||
" 3 DarkCyan
|
||||
" 4 DarkRed
|
||||
" 5 DarkMagenta
|
||||
" 6 Brown
|
||||
" 7 LightGray
|
||||
" 8 DarkGray
|
||||
" 9 Blue
|
||||
" 10 Green
|
||||
" 11 Cyan
|
||||
" 12 Red
|
||||
" 13 Magenta
|
||||
" 14 Yellow
|
||||
" 15 White
|
||||
|
||||
let s:basic16 = [
|
||||
\ [ 0x00, 0x00, 0x00 ],
|
||||
\ [ 0x00, 0x00, 0x80 ],
|
||||
\ [ 0x00, 0x80, 0x00 ],
|
||||
\ [ 0x00, 0x80, 0x80 ],
|
||||
\ [ 0x80, 0x00, 0x00 ],
|
||||
\ [ 0x80, 0x00, 0x80 ],
|
||||
\ [ 0x80, 0x80, 0x00 ],
|
||||
\ [ 0xC0, 0xC0, 0xC0 ],
|
||||
\ [ 0x80, 0x80, 0x80 ],
|
||||
\ [ 0x00, 0x00, 0xFF ],
|
||||
\ [ 0x00, 0xFF, 0x00 ],
|
||||
\ [ 0x00, 0xFF, 0xFF ],
|
||||
\ [ 0xFF, 0x00, 0x00 ],
|
||||
\ [ 0xFF, 0x00, 0xFF ],
|
||||
\ [ 0xFF, 0xFF, 0x00 ],
|
||||
\ [ 0xFF, 0xFF, 0xFF ]
|
||||
\ ]
|
||||
|
||||
function! airline#msdos#round_msdos_colors(rgblist)
|
||||
" Check for values from MSDOS 16 color terminal
|
||||
let best = []
|
||||
let min = 100000
|
||||
let list = s:basic16
|
||||
for value in list
|
||||
let t = abs(value[0] - a:rgblist[0]) +
|
||||
\ abs(value[1] - a:rgblist[1]) +
|
||||
\ abs(value[2] - a:rgblist[2])
|
||||
if min > t
|
||||
let min = t
|
||||
let best = value
|
||||
endif
|
||||
endfor
|
||||
return index(s:basic16, best)
|
||||
endfunction
|
||||
109
.vim/autoload/airline/parts.vim
Normal file
109
.vim/autoload/airline/parts.vim
Normal file
@ -0,0 +1,109 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
let s:parts = {}
|
||||
|
||||
" PUBLIC API {{{
|
||||
|
||||
function! airline#parts#define(key, config)
|
||||
let s:parts[a:key] = get(s:parts, a:key, {})
|
||||
if exists('g:airline#init#bootstrapping')
|
||||
call extend(s:parts[a:key], a:config, 'keep')
|
||||
else
|
||||
call extend(s:parts[a:key], a:config, 'force')
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! airline#parts#define_function(key, name)
|
||||
call airline#parts#define(a:key, { 'function': a:name })
|
||||
endfunction
|
||||
|
||||
function! airline#parts#define_text(key, text)
|
||||
call airline#parts#define(a:key, { 'text': a:text })
|
||||
endfunction
|
||||
|
||||
function! airline#parts#define_raw(key, raw)
|
||||
call airline#parts#define(a:key, { 'raw': a:raw })
|
||||
endfunction
|
||||
|
||||
function! airline#parts#define_minwidth(key, width)
|
||||
call airline#parts#define(a:key, { 'minwidth': a:width })
|
||||
endfunction
|
||||
|
||||
function! airline#parts#define_condition(key, predicate)
|
||||
call airline#parts#define(a:key, { 'condition': a:predicate })
|
||||
endfunction
|
||||
|
||||
function! airline#parts#define_accent(key, accent)
|
||||
call airline#parts#define(a:key, { 'accent': a:accent })
|
||||
endfunction
|
||||
|
||||
function! airline#parts#define_empty(keys)
|
||||
for key in a:keys
|
||||
call airline#parts#define_raw(key, '')
|
||||
endfor
|
||||
endfunction
|
||||
|
||||
function! airline#parts#get(key)
|
||||
return get(s:parts, a:key, {})
|
||||
endfunction
|
||||
|
||||
" }}}
|
||||
|
||||
function! airline#parts#mode()
|
||||
return airline#util#shorten(get(w:, 'airline_current_mode', ''), 79, 1)
|
||||
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
|
||||
|
||||
function! airline#parts#spell()
|
||||
let spelllang = g:airline_detect_spelllang ? printf(" [%s]", toupper(substitute(&spelllang, ',', '/', 'g'))) : ''
|
||||
if g:airline_detect_spell && &spell
|
||||
if winwidth(0) >= 90
|
||||
return g:airline_symbols.spell . spelllang
|
||||
elseif winwidth(0) >= 70
|
||||
return g:airline_symbols.spell
|
||||
else
|
||||
return split(g:airline_symbols.spell, '\zs')[0]
|
||||
endif
|
||||
endif
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
function! airline#parts#iminsert()
|
||||
if g:airline_detect_iminsert && &iminsert && exists('b:keymap_name')
|
||||
return toupper(b:keymap_name)
|
||||
endif
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
function! airline#parts#readonly()
|
||||
if &readonly && !filereadable(bufname('%'))
|
||||
return '[noperm]'
|
||||
else
|
||||
return &readonly ? g:airline_symbols.readonly : ''
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! airline#parts#filetype()
|
||||
return winwidth(0) < 90 && strlen(&filetype) > 3 ? matchstr(&filetype, '...'). (&encoding is? 'utf-8' ? '…' : '>') : &filetype
|
||||
endfunction
|
||||
|
||||
function! airline#parts#ffenc()
|
||||
let expected = get(g:, 'airline#parts#ffenc#skip_expected_string', '')
|
||||
let bomb = &l:bomb ? '[BOM]' : ''
|
||||
let ff = strlen(&ff) ? '['.&ff.']' : ''
|
||||
if expected is# &fenc.bomb.ff
|
||||
return ''
|
||||
else
|
||||
return &fenc.bomb.ff
|
||||
endif
|
||||
endfunction
|
||||
85
.vim/autoload/airline/section.vim
Normal file
85
.vim/autoload/airline/section.vim
Normal file
@ -0,0 +1,85 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
call airline#init#bootstrap()
|
||||
let s:spc = g:airline_symbols.space
|
||||
|
||||
function! s:wrap_accent(part, value)
|
||||
if exists('a:part.accent')
|
||||
call airline#highlighter#add_accent(a:part.accent)
|
||||
return '%#__accent_'.(a:part.accent).'#'.a:value.'%#__restore__#'
|
||||
endif
|
||||
return a:value
|
||||
endfunction
|
||||
|
||||
function! s:create(parts, append)
|
||||
let _ = ''
|
||||
for idx in range(len(a:parts))
|
||||
let part = airline#parts#get(a:parts[idx])
|
||||
let val = ''
|
||||
let add_sep = get(l:, 'add_sep', 0)
|
||||
|
||||
if exists('part.function')
|
||||
let func = (part.function).'()'
|
||||
elseif exists('part.text')
|
||||
let func = '"'.(part.text).'"'
|
||||
else
|
||||
if a:append > 0 && idx != 0
|
||||
let val .= s:spc.g:airline_left_alt_sep.s:spc
|
||||
endif
|
||||
if a:append < 0 && idx != 0
|
||||
let t = ''
|
||||
if !add_sep
|
||||
let t = s:spc.g:airline_right_alt_sep.s:spc
|
||||
endif
|
||||
let val = t.val
|
||||
endif
|
||||
if exists('part.raw')
|
||||
let _ .= s:wrap_accent(part, val.(part.raw))
|
||||
continue
|
||||
else
|
||||
let _ .= s:wrap_accent(part, val.a:parts[idx])
|
||||
continue
|
||||
endif
|
||||
endif
|
||||
|
||||
let minwidth = get(part, 'minwidth', 0)
|
||||
|
||||
if a:append > 0 && idx != 0
|
||||
let partval = printf('%%{airline#util#append(%s,%s)}', func, minwidth)
|
||||
" will add an extra separator, if minwidth is zero
|
||||
let add_sep = (minwidth == 0)
|
||||
elseif a:append < 0 && idx != len(a:parts) - 1
|
||||
let partval = printf('%%{airline#util#prepend(%s,%s)}', func, minwidth)
|
||||
" will add an extra separator, if minwidth is zero
|
||||
let add_sep = (minwidth == 0)
|
||||
else
|
||||
let partval = printf('%%{airline#util#wrap(%s,%s)}', func, minwidth)
|
||||
let add_sep = 0
|
||||
endif
|
||||
|
||||
if exists('part.condition')
|
||||
let partval = substitute(partval, '{', '\="{".(part.condition)." ? "', '')
|
||||
let partval = substitute(partval, '}', ' : ""}', '')
|
||||
endif
|
||||
|
||||
let val .= s:wrap_accent(part, partval)
|
||||
let _ .= val
|
||||
endfor
|
||||
return _
|
||||
endfunction
|
||||
|
||||
function! airline#section#create(parts)
|
||||
return s:create(a:parts, 0)
|
||||
endfunction
|
||||
|
||||
function! airline#section#create_left(parts)
|
||||
return s:create(a:parts, 1)
|
||||
endfunction
|
||||
|
||||
function! airline#section#create_right(parts)
|
||||
return s:create(a:parts, -1)
|
||||
endfunction
|
||||
|
||||
77
.vim/autoload/airline/themes.vim
Normal file
77
.vim/autoload/airline/themes.vim
Normal file
@ -0,0 +1,77 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
" generates a dictionary which defines the colors for each highlight group
|
||||
function! airline#themes#generate_color_map(sect1, sect2, sect3, ...)
|
||||
let palette = {
|
||||
\ 'airline_a': [ a:sect1[0] , a:sect1[1] , a:sect1[2] , a:sect1[3] , get(a:sect1 , 4 , '') ] ,
|
||||
\ 'airline_b': [ a:sect2[0] , a:sect2[1] , a:sect2[2] , a:sect2[3] , get(a:sect2 , 4 , '') ] ,
|
||||
\ 'airline_c': [ a:sect3[0] , a:sect3[1] , a:sect3[2] , a:sect3[3] , get(a:sect3 , 4 , '') ] ,
|
||||
\ }
|
||||
|
||||
if a:0 > 0
|
||||
call extend(palette, {
|
||||
\ 'airline_x': [ a:1[0] , a:1[1] , a:1[2] , a:1[3] , get(a:1 , 4 , '' ) ] ,
|
||||
\ 'airline_y': [ a:2[0] , a:2[1] , a:2[2] , a:2[3] , get(a:2 , 4 , '' ) ] ,
|
||||
\ 'airline_z': [ a:3[0] , a:3[1] , a:3[2] , a:3[3] , get(a:3 , 4 , '' ) ] ,
|
||||
\ })
|
||||
else
|
||||
call extend(palette, {
|
||||
\ 'airline_x': [ a:sect3[0] , a:sect3[1] , a:sect3[2] , a:sect3[3] , '' ] ,
|
||||
\ 'airline_y': [ a:sect2[0] , a:sect2[1] , a:sect2[2] , a:sect2[3] , '' ] ,
|
||||
\ 'airline_z': [ a:sect1[0] , a:sect1[1] , a:sect1[2] , a:sect1[3] , '' ] ,
|
||||
\ })
|
||||
endif
|
||||
|
||||
return palette
|
||||
endfunction
|
||||
|
||||
function! airline#themes#get_highlight(group, ...)
|
||||
return call('airline#highlighter#get_highlight', [a:group] + a:000)
|
||||
endfunction
|
||||
|
||||
function! airline#themes#get_highlight2(fg, bg, ...)
|
||||
return call('airline#highlighter#get_highlight2', [a:fg, a:bg] + a:000)
|
||||
endfunction
|
||||
|
||||
function! airline#themes#patch(palette)
|
||||
for mode in keys(a:palette)
|
||||
if !has_key(a:palette[mode], 'airline_warning')
|
||||
let a:palette[mode]['airline_warning'] = [ '#000000', '#df5f00', 232, 166 ]
|
||||
endif
|
||||
if !has_key(a:palette[mode], 'airline_error')
|
||||
let a:palette[mode]['airline_error'] = [ '#000000', '#990000', 232, 160 ]
|
||||
endif
|
||||
if !has_key(a:palette[mode], 'airline_term')
|
||||
"let a:palette[mode]['airline_term'] = [ '#9cffd3', '#202020', 85, 232]
|
||||
let a:palette[mode]['airline_term'] = airline#highlighter#get_highlight('airline_c')
|
||||
endif
|
||||
endfor
|
||||
|
||||
let a:palette.accents = get(a:palette, 'accents', {})
|
||||
let a:palette.accents.none = [ '', '', '', '', '' ]
|
||||
let a:palette.accents.bold = [ '', '', '', '', 'bold' ]
|
||||
let a:palette.accents.italic = [ '', '', '', '', 'italic' ]
|
||||
|
||||
if !has_key(a:palette.accents, 'red')
|
||||
let a:palette.accents.red = [ '#ff0000' , '' , 160 , '' ]
|
||||
endif
|
||||
if !has_key(a:palette.accents, 'green')
|
||||
let a:palette.accents.green = [ '#008700' , '' , 22 , '' ]
|
||||
endif
|
||||
if !has_key(a:palette.accents, 'blue')
|
||||
let a:palette.accents.blue = [ '#005fff' , '' , 27 , '' ]
|
||||
endif
|
||||
if !has_key(a:palette.accents, 'yellow')
|
||||
let a:palette.accents.yellow = [ '#dfff00' , '' , 190 , '' ]
|
||||
endif
|
||||
if !has_key(a:palette.accents, 'orange')
|
||||
let a:palette.accents.orange = [ '#df5f00' , '' , 166 , '' ]
|
||||
endif
|
||||
if !has_key(a:palette.accents, 'purple')
|
||||
let a:palette.accents.purple = [ '#af00df' , '' , 128 , '' ]
|
||||
endif
|
||||
endfunction
|
||||
|
||||
103
.vim/autoload/airline/themes/dark.vim
Normal file
103
.vim/autoload/airline/themes/dark.vim
Normal file
@ -0,0 +1,103 @@
|
||||
scriptencoding utf-8
|
||||
|
||||
" Each theme is contained in its own file and declares variables scoped to the
|
||||
" file. These variables represent the possible "modes" that airline can
|
||||
" detect. The mode is the return value of mode(), which gets converted to a
|
||||
" readable string. The following is a list currently supported modes: normal,
|
||||
" insert, replace, visual, and inactive.
|
||||
"
|
||||
" Each mode can also have overrides. These are small changes to the mode that
|
||||
" don't require a completely different look. "modified" and "paste" are two
|
||||
" such supported overrides. These are simply suffixed to the major mode,
|
||||
" separated by an underscore. For example, "normal_modified" would be normal
|
||||
" mode where the current buffer is modified.
|
||||
"
|
||||
" The theming algorithm is a 2-pass system where the mode will draw over all
|
||||
" parts of the statusline, and then the override is applied after. This means
|
||||
" it is possible to specify a subset of the theme in overrides, as it will
|
||||
" simply overwrite the previous colors. If you want simultaneous overrides,
|
||||
" then they will need to change different parts of the statusline so they do
|
||||
" not conflict with each other.
|
||||
"
|
||||
" First, let's define an empty dictionary and assign it to the "palette"
|
||||
" variable. The # is a separator that maps with the directory structure. If
|
||||
" you get this wrong, Vim will complain loudly.
|
||||
let g:airline#themes#dark#palette = {}
|
||||
|
||||
" First let's define some arrays. The s: is just a VimL thing for scoping the
|
||||
" variables to the current script. Without this, these variables would be
|
||||
" declared globally. Now let's declare some colors for normal mode and add it
|
||||
" to the dictionary. The array is in the format:
|
||||
" [ guifg, guibg, ctermfg, ctermbg, opts ]. See "help attr-list" for valid
|
||||
" values for the "opt" value.
|
||||
let s:N1 = [ '#00005f' , '#dfff00' , 17 , 190 ]
|
||||
let s:N2 = [ '#ffffff' , '#444444' , 255 , 238 ]
|
||||
let s:N3 = [ '#9cffd3' , '#202020' , 85 , 234 ]
|
||||
let g:airline#themes#dark#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3)
|
||||
|
||||
" Here we define overrides for when the buffer is modified. This will be
|
||||
" applied after g:airline#themes#dark#palette.normal, hence why only certain keys are
|
||||
" declared.
|
||||
let g:airline#themes#dark#palette.normal_modified = {
|
||||
\ 'airline_c': [ '#ffffff' , '#5f005f' , 255 , 53 , '' ] ,
|
||||
\ }
|
||||
|
||||
|
||||
let s:I1 = [ '#00005f' , '#00dfff' , 17 , 45 ]
|
||||
let s:I2 = [ '#ffffff' , '#005fff' , 255 , 27 ]
|
||||
let s:I3 = [ '#ffffff' , '#000080' , 15 , 17 ]
|
||||
let g:airline#themes#dark#palette.insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3)
|
||||
let g:airline#themes#dark#palette.insert_modified = {
|
||||
\ 'airline_c': [ '#ffffff' , '#5f005f' , 255 , 53 , '' ] ,
|
||||
\ }
|
||||
let g:airline#themes#dark#palette.insert_paste = {
|
||||
\ 'airline_a': [ s:I1[0] , '#d78700' , s:I1[2] , 172 , '' ] ,
|
||||
\ }
|
||||
|
||||
|
||||
let g:airline#themes#dark#palette.replace = copy(g:airline#themes#dark#palette.insert)
|
||||
let g:airline#themes#dark#palette.replace.airline_a = [ s:I2[0] , '#af0000' , s:I2[2] , 124 , '' ]
|
||||
let g:airline#themes#dark#palette.replace_modified = g:airline#themes#dark#palette.insert_modified
|
||||
|
||||
|
||||
let s:V1 = [ '#000000' , '#ffaf00' , 232 , 214 ]
|
||||
let s:V2 = [ '#000000' , '#ff5f00' , 232 , 202 ]
|
||||
let s:V3 = [ '#ffffff' , '#5f0000' , 15 , 52 ]
|
||||
let g:airline#themes#dark#palette.visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3)
|
||||
let g:airline#themes#dark#palette.visual_modified = {
|
||||
\ 'airline_c': [ '#ffffff' , '#5f005f' , 255 , 53 , '' ] ,
|
||||
\ }
|
||||
|
||||
|
||||
let s:IA1 = [ '#4e4e4e' , '#1c1c1c' , 239 , 234 , '' ]
|
||||
let s:IA2 = [ '#4e4e4e' , '#262626' , 239 , 235 , '' ]
|
||||
let s:IA3 = [ '#4e4e4e' , '#303030' , 239 , 236 , '' ]
|
||||
let g:airline#themes#dark#palette.inactive = airline#themes#generate_color_map(s:IA1, s:IA2, s:IA3)
|
||||
let g:airline#themes#dark#palette.inactive_modified = {
|
||||
\ 'airline_c': [ '#875faf' , '' , 97 , '' , '' ] ,
|
||||
\ }
|
||||
|
||||
|
||||
" Accents are used to give parts within a section a slightly different look or
|
||||
" color. Here we are defining a "red" accent, which is used by the 'readonly'
|
||||
" part by default. Only the foreground colors are specified, so the background
|
||||
" colors are automatically extracted from the underlying section colors. What
|
||||
" this means is that regardless of which section the part is defined in, it
|
||||
" will be red instead of the section's foreground color. You can also have
|
||||
" multiple parts with accents within a section.
|
||||
let g:airline#themes#dark#palette.accents = {
|
||||
\ 'red': [ '#ff0000' , '' , 160 , '' ]
|
||||
\ }
|
||||
|
||||
|
||||
" Here we define the color map for ctrlp. We check for the g:loaded_ctrlp
|
||||
" variable so that related functionality is loaded iff the user is using
|
||||
" ctrlp. Note that this is optional, and if you do not define ctrlp colors
|
||||
" they will be chosen automatically from the existing palette.
|
||||
if get(g:, 'loaded_ctrlp', 0)
|
||||
let g:airline#themes#dark#palette.ctrlp = airline#extensions#ctrlp#generate_color_map(
|
||||
\ [ '#d7d7ff' , '#5f00af' , 189 , 55 , '' ],
|
||||
\ [ '#ffffff' , '#875fd7' , 231 , 98 , '' ],
|
||||
\ [ '#5f00af' , '#ffffff' , 55 , 231 , 'bold' ])
|
||||
endif
|
||||
|
||||
88
.vim/autoload/airline/util.vim
Normal file
88
.vim/autoload/airline/util.vim
Normal file
@ -0,0 +1,88 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
" TODO: Try to cache winwidth(0) function
|
||||
" e.g. store winwidth per window and access that, only update it, if the size
|
||||
" actually changed.
|
||||
scriptencoding utf-8
|
||||
|
||||
call airline#init#bootstrap()
|
||||
let s:spc = g:airline_symbols.space
|
||||
|
||||
function! airline#util#shorten(text, winwidth, minwidth, ...)
|
||||
if winwidth(0) < a:winwidth && len(split(a:text, '\zs')) > a:minwidth
|
||||
if get(a:000, 0, 0)
|
||||
" shorten from tail
|
||||
return '…'.matchstr(a:text, '.\{'.a:minwidth.'}$')
|
||||
else
|
||||
" shorten from beginning of string
|
||||
return matchstr(a:text, '^.\{'.a:minwidth.'}').'…'
|
||||
endif
|
||||
else
|
||||
return a:text
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! airline#util#wrap(text, minwidth)
|
||||
if a:minwidth > 0 && winwidth(0) < a:minwidth
|
||||
return ''
|
||||
endif
|
||||
return a:text
|
||||
endfunction
|
||||
|
||||
function! airline#util#append(text, minwidth)
|
||||
if a:minwidth > 0 && winwidth(0) < a:minwidth
|
||||
return ''
|
||||
endif
|
||||
let prefix = s:spc == "\ua0" ? s:spc : s:spc.s:spc
|
||||
return empty(a:text) ? '' : prefix.g:airline_left_alt_sep.s:spc.a:text
|
||||
endfunction
|
||||
|
||||
function! airline#util#warning(msg)
|
||||
echohl WarningMsg
|
||||
echomsg "airline: ".a:msg
|
||||
echohl Normal
|
||||
endfunction
|
||||
|
||||
function! airline#util#prepend(text, minwidth)
|
||||
if a:minwidth > 0 && winwidth(0) < a:minwidth
|
||||
return ''
|
||||
endif
|
||||
return empty(a:text) ? '' : a:text.s:spc.g:airline_right_alt_sep.s:spc
|
||||
endfunction
|
||||
|
||||
if v:version >= 704
|
||||
function! airline#util#getwinvar(winnr, key, def)
|
||||
return getwinvar(a:winnr, a:key, a:def)
|
||||
endfunction
|
||||
else
|
||||
function! airline#util#getwinvar(winnr, key, def)
|
||||
let winvals = getwinvar(a:winnr, '')
|
||||
return get(winvals, a:key, a:def)
|
||||
endfunction
|
||||
endif
|
||||
|
||||
if v:version >= 704
|
||||
function! airline#util#exec_funcrefs(list, ...)
|
||||
for Fn in a:list
|
||||
let code = call(Fn, a:000)
|
||||
if code != 0
|
||||
return code
|
||||
endif
|
||||
endfor
|
||||
return 0
|
||||
endfunction
|
||||
else
|
||||
function! airline#util#exec_funcrefs(list, ...)
|
||||
" for 7.2; we cannot iterate the list, hence why we use range()
|
||||
" for 7.3-[97, 328]; we cannot reuse the variable, hence the {}
|
||||
for i in range(0, len(a:list) - 1)
|
||||
let Fn{i} = a:list[i]
|
||||
let code = call(Fn{i}, a:000)
|
||||
if code != 0
|
||||
return code
|
||||
endif
|
||||
endfor
|
||||
return 0
|
||||
endfunction
|
||||
endif
|
||||
264
.vim/autoload/pathogen.vim
Normal file
264
.vim/autoload/pathogen.vim
Normal file
@ -0,0 +1,264 @@
|
||||
" pathogen.vim - path option manipulation
|
||||
" Maintainer: Tim Pope <http://tpo.pe/>
|
||||
" Version: 2.4
|
||||
|
||||
" Install in ~/.vim/autoload (or ~\vimfiles\autoload).
|
||||
"
|
||||
" For management of individually installed plugins in ~/.vim/bundle (or
|
||||
" ~\vimfiles\bundle), adding `execute pathogen#infect()` to the top of your
|
||||
" .vimrc is the only other setup necessary.
|
||||
"
|
||||
" The API is documented inline below.
|
||||
|
||||
if exists("g:loaded_pathogen") || &cp
|
||||
finish
|
||||
endif
|
||||
let g:loaded_pathogen = 1
|
||||
|
||||
" Point of entry for basic default usage. Give a relative path to invoke
|
||||
" pathogen#interpose() or an absolute path to invoke pathogen#surround().
|
||||
" Curly braces are expanded with pathogen#expand(): "bundle/{}" finds all
|
||||
" subdirectories inside "bundle" inside all directories in the runtime path.
|
||||
" If no arguments are given, defaults "bundle/{}", and also "pack/{}/start/{}"
|
||||
" on versions of Vim without native package support.
|
||||
function! pathogen#infect(...) abort
|
||||
if a:0
|
||||
let paths = filter(reverse(copy(a:000)), 'type(v:val) == type("")')
|
||||
else
|
||||
let paths = ['bundle/{}', 'pack/{}/start/{}']
|
||||
endif
|
||||
if has('packages')
|
||||
call filter(paths, 'v:val !~# "^pack/[^/]*/start/[^/]*$"')
|
||||
endif
|
||||
let static = '^\%([$~\\/]\|\w:[\\/]\)[^{}*]*$'
|
||||
for path in filter(copy(paths), 'v:val =~# static')
|
||||
call pathogen#surround(path)
|
||||
endfor
|
||||
for path in filter(copy(paths), 'v:val !~# static')
|
||||
if path =~# '^\%([$~\\/]\|\w:[\\/]\)'
|
||||
call pathogen#surround(path)
|
||||
else
|
||||
call pathogen#interpose(path)
|
||||
endif
|
||||
endfor
|
||||
call pathogen#cycle_filetype()
|
||||
if pathogen#is_disabled($MYVIMRC)
|
||||
return 'finish'
|
||||
endif
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
" Split a path into a list.
|
||||
function! pathogen#split(path) abort
|
||||
if type(a:path) == type([]) | return a:path | endif
|
||||
if empty(a:path) | return [] | endif
|
||||
let split = split(a:path,'\\\@<!\%(\\\\\)*\zs,')
|
||||
return map(split,'substitute(v:val,''\\\([\\,]\)'',''\1'',"g")')
|
||||
endfunction
|
||||
|
||||
" Convert a list to a path.
|
||||
function! pathogen#join(...) abort
|
||||
if type(a:1) == type(1) && a:1
|
||||
let i = 1
|
||||
let space = ' '
|
||||
else
|
||||
let i = 0
|
||||
let space = ''
|
||||
endif
|
||||
let path = ""
|
||||
while i < a:0
|
||||
if type(a:000[i]) == type([])
|
||||
let list = a:000[i]
|
||||
let j = 0
|
||||
while j < len(list)
|
||||
let escaped = substitute(list[j],'[,'.space.']\|\\[\,'.space.']\@=','\\&','g')
|
||||
let path .= ',' . escaped
|
||||
let j += 1
|
||||
endwhile
|
||||
else
|
||||
let path .= "," . a:000[i]
|
||||
endif
|
||||
let i += 1
|
||||
endwhile
|
||||
return substitute(path,'^,','','')
|
||||
endfunction
|
||||
|
||||
" Convert a list to a path with escaped spaces for 'path', 'tag', etc.
|
||||
function! pathogen#legacyjoin(...) abort
|
||||
return call('pathogen#join',[1] + a:000)
|
||||
endfunction
|
||||
|
||||
" Turn filetype detection off and back on again if it was already enabled.
|
||||
function! pathogen#cycle_filetype() abort
|
||||
if exists('g:did_load_filetypes')
|
||||
filetype off
|
||||
filetype on
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" Check if a bundle is disabled. A bundle is considered disabled if its
|
||||
" basename or full name is included in the list g:pathogen_blacklist or the
|
||||
" comma delimited environment variable $VIMBLACKLIST.
|
||||
function! pathogen#is_disabled(path) abort
|
||||
if a:path =~# '\~$'
|
||||
return 1
|
||||
endif
|
||||
let sep = pathogen#slash()
|
||||
let blacklist = get(g:, 'pathogen_blacklist', get(g:, 'pathogen_disabled', [])) + pathogen#split($VIMBLACKLIST)
|
||||
if !empty(blacklist)
|
||||
call map(blacklist, 'substitute(v:val, "[\\/]$", "", "")')
|
||||
endif
|
||||
return index(blacklist, fnamemodify(a:path, ':t')) != -1 || index(blacklist, a:path) != -1
|
||||
endfunction
|
||||
|
||||
" Prepend the given directory to the runtime path and append its corresponding
|
||||
" after directory. Curly braces are expanded with pathogen#expand().
|
||||
function! pathogen#surround(path) abort
|
||||
let sep = pathogen#slash()
|
||||
let rtp = pathogen#split(&rtp)
|
||||
let path = fnamemodify(a:path, ':s?[\\/]\=$??')
|
||||
let before = filter(pathogen#expand(path), '!pathogen#is_disabled(v:val)')
|
||||
let after = filter(reverse(pathogen#expand(path, sep.'after')), '!pathogen#is_disabled(v:val[0:-7])')
|
||||
call filter(rtp, 'index(before + after, v:val) == -1')
|
||||
let &rtp = pathogen#join(before, rtp, after)
|
||||
return &rtp
|
||||
endfunction
|
||||
|
||||
" For each directory in the runtime path, add a second entry with the given
|
||||
" argument appended. Curly braces are expanded with pathogen#expand().
|
||||
function! pathogen#interpose(name) abort
|
||||
let sep = pathogen#slash()
|
||||
let name = a:name
|
||||
if has_key(s:done_bundles, name)
|
||||
return ""
|
||||
endif
|
||||
let s:done_bundles[name] = 1
|
||||
let list = []
|
||||
for dir in pathogen#split(&rtp)
|
||||
if dir =~# '\<after$'
|
||||
let list += reverse(filter(pathogen#expand(dir[0:-6].name, sep.'after'), '!pathogen#is_disabled(v:val[0:-7])')) + [dir]
|
||||
else
|
||||
let list += [dir] + filter(pathogen#expand(dir.sep.name), '!pathogen#is_disabled(v:val)')
|
||||
endif
|
||||
endfor
|
||||
let &rtp = pathogen#join(pathogen#uniq(list))
|
||||
return 1
|
||||
endfunction
|
||||
|
||||
let s:done_bundles = {}
|
||||
|
||||
" Invoke :helptags on all non-$VIM doc directories in runtimepath.
|
||||
function! pathogen#helptags() abort
|
||||
let sep = pathogen#slash()
|
||||
for glob in pathogen#split(&rtp)
|
||||
for dir in map(split(glob(glob), "\n"), 'v:val.sep."/doc/".sep')
|
||||
if (dir)[0 : strlen($VIMRUNTIME)] !=# $VIMRUNTIME.sep && filewritable(dir) == 2 && !empty(split(glob(dir.'*.txt'))) && (!filereadable(dir.'tags') || filewritable(dir.'tags'))
|
||||
silent! execute 'helptags' pathogen#fnameescape(dir)
|
||||
endif
|
||||
endfor
|
||||
endfor
|
||||
endfunction
|
||||
|
||||
command! -bar Helptags :call pathogen#helptags()
|
||||
|
||||
" Execute the given command. This is basically a backdoor for --remote-expr.
|
||||
function! pathogen#execute(...) abort
|
||||
for command in a:000
|
||||
execute command
|
||||
endfor
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
" Section: Unofficial
|
||||
|
||||
function! pathogen#is_absolute(path) abort
|
||||
return a:path =~# (has('win32') ? '^\%([\\/]\|\w:\)[\\/]\|^[~$]' : '^[/~$]')
|
||||
endfunction
|
||||
|
||||
" Given a string, returns all possible permutations of comma delimited braced
|
||||
" alternatives of that string. pathogen#expand('/{a,b}/{c,d}') yields
|
||||
" ['/a/c', '/a/d', '/b/c', '/b/d']. Empty braces are treated as a wildcard
|
||||
" and globbed. Actual globs are preserved.
|
||||
function! pathogen#expand(pattern, ...) abort
|
||||
let after = a:0 ? a:1 : ''
|
||||
let pattern = substitute(a:pattern, '^[~$][^\/]*', '\=expand(submatch(0))', '')
|
||||
if pattern =~# '{[^{}]\+}'
|
||||
let [pre, pat, post] = split(substitute(pattern, '\(.\{-\}\){\([^{}]\+\)}\(.*\)', "\\1\001\\2\001\\3", ''), "\001", 1)
|
||||
let found = map(split(pat, ',', 1), 'pre.v:val.post')
|
||||
let results = []
|
||||
for pattern in found
|
||||
call extend(results, pathogen#expand(pattern))
|
||||
endfor
|
||||
elseif pattern =~# '{}'
|
||||
let pat = matchstr(pattern, '^.*{}[^*]*\%($\|[\\/]\)')
|
||||
let post = pattern[strlen(pat) : -1]
|
||||
let results = map(split(glob(substitute(pat, '{}', '*', 'g')), "\n"), 'v:val.post')
|
||||
else
|
||||
let results = [pattern]
|
||||
endif
|
||||
let vf = pathogen#slash() . 'vimfiles'
|
||||
call map(results, 'v:val =~# "\\*" ? v:val.after : isdirectory(v:val.vf.after) ? v:val.vf.after : isdirectory(v:val.after) ? v:val.after : ""')
|
||||
return filter(results, '!empty(v:val)')
|
||||
endfunction
|
||||
|
||||
" \ on Windows unless shellslash is set, / everywhere else.
|
||||
function! pathogen#slash() abort
|
||||
return !exists("+shellslash") || &shellslash ? '/' : '\'
|
||||
endfunction
|
||||
|
||||
function! pathogen#separator() abort
|
||||
return pathogen#slash()
|
||||
endfunction
|
||||
|
||||
" Convenience wrapper around glob() which returns a list.
|
||||
function! pathogen#glob(pattern) abort
|
||||
let files = split(glob(a:pattern),"\n")
|
||||
return map(files,'substitute(v:val,"[".pathogen#slash()."/]$","","")')
|
||||
endfunction
|
||||
|
||||
" Like pathogen#glob(), only limit the results to directories.
|
||||
function! pathogen#glob_directories(pattern) abort
|
||||
return filter(pathogen#glob(a:pattern),'isdirectory(v:val)')
|
||||
endfunction
|
||||
|
||||
" Remove duplicates from a list.
|
||||
function! pathogen#uniq(list) abort
|
||||
let i = 0
|
||||
let seen = {}
|
||||
while i < len(a:list)
|
||||
if (a:list[i] ==# '' && exists('empty')) || has_key(seen,a:list[i])
|
||||
call remove(a:list,i)
|
||||
elseif a:list[i] ==# ''
|
||||
let i += 1
|
||||
let empty = 1
|
||||
else
|
||||
let seen[a:list[i]] = 1
|
||||
let i += 1
|
||||
endif
|
||||
endwhile
|
||||
return a:list
|
||||
endfunction
|
||||
|
||||
" Backport of fnameescape().
|
||||
function! pathogen#fnameescape(string) abort
|
||||
if exists('*fnameescape')
|
||||
return fnameescape(a:string)
|
||||
elseif a:string ==# '-'
|
||||
return '\-'
|
||||
else
|
||||
return substitute(escape(a:string," \t\n*?[{`$\\%#'\"|!<"),'^[+>]','\\&','')
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" Like findfile(), but hardcoded to use the runtimepath.
|
||||
function! pathogen#runtime_findfile(file,count) abort
|
||||
let rtp = pathogen#join(1,pathogen#split(&rtp))
|
||||
let file = findfile(a:file,rtp,a:count)
|
||||
if file ==# ''
|
||||
return ''
|
||||
else
|
||||
return fnamemodify(file,':p')
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" vim:set et sw=2 foldmethod=expr foldexpr=getline(v\:lnum)=~'^\"\ Section\:'?'>1'\:getline(v\:lnum)=~#'^fu'?'a1'\:getline(v\:lnum)=~#'^endf'?'s1'\:'=':
|
||||
BIN
.vim/bundle/.DS_Store
vendored
Normal file
BIN
.vim/bundle/.DS_Store
vendored
Normal file
Binary file not shown.
1117
.vim/colors/solarized.vim
Normal file
1117
.vim/colors/solarized.vim
Normal file
File diff suppressed because it is too large
Load Diff
1283
.vim/doc/airline.txt
Normal file
1283
.vim/doc/airline.txt
Normal file
File diff suppressed because it is too large
Load Diff
156
.vim/plugin/airline.vim
Normal file
156
.vim/plugin/airline.vim
Normal file
@ -0,0 +1,156 @@
|
||||
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
if &cp || v:version < 702 || (exists('g:loaded_airline') && g:loaded_airline)
|
||||
finish
|
||||
endif
|
||||
let g:loaded_airline = 1
|
||||
|
||||
let s:airline_initialized = 0
|
||||
function! s:init()
|
||||
if s:airline_initialized
|
||||
return
|
||||
endif
|
||||
let s:airline_initialized = 1
|
||||
|
||||
call airline#extensions#load()
|
||||
call airline#init#sections()
|
||||
|
||||
let s:theme_in_vimrc = exists('g:airline_theme')
|
||||
if s:theme_in_vimrc
|
||||
try
|
||||
let palette = g:airline#themes#{g:airline_theme}#palette
|
||||
catch
|
||||
echom 'Could not resolve airline theme "' . g:airline_theme . '". Themes have been migrated to github.com/vim-airline/vim-airline-themes.'
|
||||
let g:airline_theme = 'dark'
|
||||
endtry
|
||||
silent call airline#switch_theme(g:airline_theme)
|
||||
else
|
||||
let g:airline_theme = 'dark'
|
||||
silent call s:on_colorscheme_changed()
|
||||
endif
|
||||
|
||||
silent doautocmd User AirlineAfterInit
|
||||
endfunction
|
||||
|
||||
function! s:on_window_changed()
|
||||
if pumvisible() && (!&previewwindow || g:airline_exclude_preview)
|
||||
return
|
||||
endif
|
||||
" Handle each window only once, since we might come here several times for
|
||||
" different autocommands.
|
||||
let l:key = [bufnr('%'), winnr(), winnr('$'), tabpagenr(), &ft]
|
||||
if get(g:, 'airline_last_window_changed', []) == l:key
|
||||
\ && &stl is# '%!airline#statusline('.winnr().')'
|
||||
\ && &ft !~? 'gitcommit'
|
||||
" fugitive is special, it changes names and filetypes several times,
|
||||
" make sure the caching does not get into its way
|
||||
return
|
||||
endif
|
||||
let g:airline_last_window_changed = l:key
|
||||
call s:init()
|
||||
call airline#update_statusline()
|
||||
endfunction
|
||||
|
||||
function! s:on_colorscheme_changed()
|
||||
call s:init()
|
||||
unlet! g:airline#highlighter#normal_fg_hi
|
||||
call airline#highlighter#reset_hlcache()
|
||||
let g:airline_gui_mode = airline#init#gui_mode()
|
||||
if !s:theme_in_vimrc
|
||||
call airline#switch_matching_theme()
|
||||
endif
|
||||
|
||||
" couldn't find a match, or theme was defined, just refresh
|
||||
call airline#load_theme()
|
||||
endfunction
|
||||
|
||||
function! airline#cmdwinenter(...)
|
||||
call airline#extensions#apply_left_override('Command Line', '')
|
||||
endfunction
|
||||
|
||||
function! s:airline_toggle()
|
||||
if exists("#airline")
|
||||
augroup airline
|
||||
au!
|
||||
augroup END
|
||||
augroup! airline
|
||||
|
||||
if exists("s:stl")
|
||||
let &stl = s:stl
|
||||
endif
|
||||
call airline#highlighter#reset_hlcache()
|
||||
|
||||
silent doautocmd User AirlineToggledOff
|
||||
else
|
||||
let s:stl = &statusline
|
||||
augroup airline
|
||||
autocmd!
|
||||
|
||||
autocmd CmdwinEnter *
|
||||
\ call airline#add_statusline_func('airline#cmdwinenter')
|
||||
\ | call <sid>on_window_changed()
|
||||
autocmd CmdwinLeave * call airline#remove_statusline_func('airline#cmdwinenter')
|
||||
|
||||
autocmd GUIEnter,ColorScheme * call <sid>on_colorscheme_changed()
|
||||
autocmd VimEnter,WinEnter,BufWinEnter,FileType,BufUnload *
|
||||
\ call <sid>on_window_changed()
|
||||
if exists('#CompleteDone')
|
||||
autocmd CompleteDone * call <sid>on_window_changed()
|
||||
endif
|
||||
|
||||
autocmd VimResized * unlet! w:airline_lastmode | :call <sid>airline_refresh()
|
||||
autocmd TabEnter * :unlet! w:airline_lastmode | let w:airline_active=1
|
||||
autocmd BufWritePost */autoload/airline/themes/*.vim
|
||||
\ exec 'source '.split(globpath(&rtp, 'autoload/airline/themes/'.g:airline_theme.'.vim', 1), "\n")[0]
|
||||
\ | call airline#load_theme()
|
||||
augroup END
|
||||
|
||||
if &laststatus < 2
|
||||
set laststatus=2
|
||||
endif
|
||||
if s:airline_initialized
|
||||
call s:on_window_changed()
|
||||
endif
|
||||
|
||||
silent doautocmd User AirlineToggledOn
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:get_airline_themes(a, l, p)
|
||||
let files = split(globpath(&rtp, 'autoload/airline/themes/'.a:a.'*'), "\n")
|
||||
return map(files, 'fnamemodify(v:val, ":t:r")')
|
||||
endfunction
|
||||
|
||||
function! s:airline_theme(...)
|
||||
if a:0
|
||||
call airline#switch_theme(a:1)
|
||||
else
|
||||
echo g:airline_theme
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:airline_refresh()
|
||||
if !exists("#airline")
|
||||
" disabled
|
||||
return
|
||||
endif
|
||||
let nomodeline=''
|
||||
if v:version > 703 || v:version == 703 && has("patch438")
|
||||
let nomodeline = '<nomodeline>'
|
||||
endif
|
||||
exe printf("silent doautocmd %s User AirlineBeforeRefresh", nomodeline)
|
||||
call airline#highlighter#reset_hlcache()
|
||||
call airline#load_theme()
|
||||
call airline#update_statusline()
|
||||
endfunction
|
||||
|
||||
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 s:airline_refresh()
|
||||
|
||||
call airline#init#bootstrap()
|
||||
call s:airline_toggle()
|
||||
33
.vim/plugin/bracketed-paste.vim
Normal file
33
.vim/plugin/bracketed-paste.vim
Normal file
@ -0,0 +1,33 @@
|
||||
" Code from:
|
||||
" http://stackoverflow.com/questions/5585129/pasting-code-into-terminal-window-into-vim-on-mac-os-x
|
||||
" then https://coderwall.com/p/if9mda
|
||||
" and then https://github.com/aaronjensen/vimfiles/blob/59a7019b1f2d08c70c28a41ef4e2612470ea0549/plugin/terminaltweaks.vim
|
||||
" to fix the escape time problem with insert mode.
|
||||
"
|
||||
" Docs on bracketed paste mode:
|
||||
" http://www.xfree86.org/current/ctlseqs.html
|
||||
" Docs on mapping fast escape codes in vim
|
||||
" http://vim.wikia.com/wiki/Mapping_fast_keycodes_in_terminal_Vim
|
||||
|
||||
if exists("g:loaded_bracketed_paste")
|
||||
finish
|
||||
endif
|
||||
let g:loaded_bracketed_paste = 1
|
||||
|
||||
let &t_ti .= "\<Esc>[?2004h"
|
||||
let &t_te .= "\<Esc>[?2004l"
|
||||
|
||||
function! XTermPasteBegin(ret)
|
||||
set pastetoggle=<f29>
|
||||
set paste
|
||||
return a:ret
|
||||
endfunction
|
||||
|
||||
execute "set <f28>=\<Esc>[200~"
|
||||
execute "set <f29>=\<Esc>[201~"
|
||||
map <expr> <f28> XTermPasteBegin("i")
|
||||
imap <expr> <f28> XTermPasteBegin("")
|
||||
vmap <expr> <f28> XTermPasteBegin("c")
|
||||
cmap <f28> <nop>
|
||||
cmap <f29> <nop>
|
||||
|
||||
103
.vimrc
Normal file
103
.vimrc
Normal file
@ -0,0 +1,103 @@
|
||||
" Don't try to be vi compatible
|
||||
set nocompatible
|
||||
|
||||
" Helps force plugins to load correctly when it is turned back on below
|
||||
filetype off
|
||||
|
||||
" TODO: Load plugins here (pathogen or vundle)
|
||||
|
||||
" Turn on syntax highlighting
|
||||
syntax on
|
||||
|
||||
" For plugins to load correctly
|
||||
filetype plugin indent on
|
||||
|
||||
" TODO: Pick a leader key
|
||||
" let mapleader = ","
|
||||
|
||||
" Security
|
||||
set modelines=0
|
||||
|
||||
" Show line numbers
|
||||
set number
|
||||
|
||||
" Show file stats
|
||||
set ruler
|
||||
|
||||
" Blink cursor on error instead of beeping (grr)
|
||||
set visualbell
|
||||
|
||||
" Encoding
|
||||
set encoding=utf-8
|
||||
|
||||
" Whitespace
|
||||
set wrap
|
||||
set textwidth=79
|
||||
set formatoptions=tcqrn1
|
||||
"set tabstop=2
|
||||
"set shiftwidth=2
|
||||
"set softtabstop=2
|
||||
set expandtab
|
||||
set noshiftround
|
||||
|
||||
" Cursor motion
|
||||
set scrolloff=3
|
||||
set backspace=indent,eol,start
|
||||
set matchpairs+=<:> " use % to jump between pairs
|
||||
runtime! macros/matchit.vim
|
||||
|
||||
" Move up/down editor lines
|
||||
nnoremap j gj
|
||||
nnoremap k gk
|
||||
|
||||
" Allow hidden buffers
|
||||
set hidden
|
||||
|
||||
" Rendering
|
||||
set ttyfast
|
||||
|
||||
" Status bar
|
||||
set laststatus=2
|
||||
|
||||
" Last line
|
||||
set showmode
|
||||
set showcmd
|
||||
|
||||
" Searching
|
||||
"nnoremap / /\v
|
||||
vnoremap / /\v
|
||||
set hlsearch
|
||||
set incsearch
|
||||
set ignorecase
|
||||
set smartcase
|
||||
set showmatch
|
||||
map <leader><space> :let @/=''<cr> " clear search
|
||||
|
||||
" Remap help key.
|
||||
inoremap <F1> <ESC>:set invfullscreen<CR>a
|
||||
nnoremap <F1> :set invfullscreen<CR>
|
||||
vnoremap <F1> :set invfullscreen<CR>
|
||||
|
||||
" Textmate holdouts
|
||||
|
||||
" Formatting
|
||||
map <leader>q gqip
|
||||
autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o
|
||||
|
||||
" Visualize tabs and newlines
|
||||
set listchars=tab:▸\ ,eol:¬
|
||||
" Uncomment this to enable by default:
|
||||
" set list " To enable by default
|
||||
" Or use your leader key + l to toggle on/off
|
||||
map <leader>l :set list!<CR> " Toggle tabs and EOL
|
||||
|
||||
" Color scheme (terminal)
|
||||
set t_Co=256
|
||||
set background=dark
|
||||
let g:solarized_termcolors=256
|
||||
let g:solarized_termtrans=1
|
||||
" put https://raw.github.com/altercation/vim-colors-solarized/master/colors/solarized.vim
|
||||
" in ~/.vim/colors/ and uncomment:
|
||||
colorscheme solarized
|
||||
|
||||
set sessionoptions-=options
|
||||
18
LICENSE.MIT
Normal file
18
LICENSE.MIT
Normal file
@ -0,0 +1,18 @@
|
||||
Copyright 2012— Gregory Pakosz
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
13
LICENSE.WTFPLv2
Normal file
13
LICENSE.WTFPLv2
Normal file
@ -0,0 +1,13 @@
|
||||
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
||||
Version 2, December 2004
|
||||
|
||||
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim or modified
|
||||
copies of this license document, and changing it is allowed as long
|
||||
as the name is changed.
|
||||
|
||||
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. You just DO WHAT THE FUCK YOU WANT TO.
|
||||
321
README.md
Normal file
321
README.md
Normal file
@ -0,0 +1,321 @@
|
||||
|
||||
Tmux configs originally are from: https://github.com/gpakosz/.tmux and have been tweaked from there.
|
||||
|
||||
.tmux
|
||||
=====
|
||||
|
||||
Self-contained, pretty and versatile `.tmux.conf` configuration file.
|
||||
|
||||

|
||||
|
||||
Installation
|
||||
------------
|
||||
|
||||
Requirements:
|
||||
|
||||
- tmux **`>= 2.1`** running inside Linux, Mac, OpenBSD, Cygwin or WSL (Bash on
|
||||
Ubuntu on Windows)
|
||||
- outside of tmux, `$TERM` must be set to `xterm-256color`
|
||||
|
||||
To install, run the following from your terminal: (you may want to backup your
|
||||
existing `~/.tmux.conf` first)
|
||||
|
||||
```
|
||||
$ cd
|
||||
$ git clone https://github.com/gpakosz/.tmux.git
|
||||
$ ln -s -f .tmux/.tmux.conf
|
||||
$ cp .tmux/.tmux.conf.local .
|
||||
```
|
||||
|
||||
Then proceed to [customize] your `~/.tmux.conf.local` copy.
|
||||
|
||||
[customize]: #enabling-the-powerline-look
|
||||
|
||||
If you're a Vim user, setting the `$EDITOR` environment variable to `vim` will
|
||||
enable and further customize the vi-style key bindings (see tmux manual).
|
||||
|
||||
If you're new to tmux, I recommmend you read [tmux 2: Productive Mouse-Free
|
||||
Development][bhtmux2] by [@bphogan].
|
||||
|
||||
[bhtmux2]: https://pragprog.com/book/bhtmux2/tmux-2
|
||||
[@bphogan]: https://twitter.com/bphogan
|
||||
|
||||
Troubleshooting
|
||||
---------------
|
||||
|
||||
- **I'm running tmux `HEAD` and things don't work properly. What should I do?**
|
||||
|
||||
Please open an issue describing what doesn't work with upcoming tmux. I'll do
|
||||
my best to address it.
|
||||
|
||||
- **Status line is broken and/or gets duplicated at the bottom of the screen.
|
||||
What gives?**
|
||||
|
||||
This particularly happens on Linux when the distribution provides a version
|
||||
of glib that received Unicode 9.0 upgrades (glib `>= 2.50.1`) while providing
|
||||
a version of glibc that didn't (glibc `< 2.26`). You may also configure
|
||||
`LC_CTYPE` to use an `UTF-8` locale. Typically VTE based terminal emulators
|
||||
rely on glib's `g_unichar_iswide()` function while tmux relies on glibc's
|
||||
`wcwidth()` function. When these two functions disagree, display gets messed
|
||||
up.
|
||||
|
||||
This can also happen on macOS when using iTerm2 and "Use Unicode version 9
|
||||
character widths" is enabled in `Preferences... > Profiles > Text`
|
||||
|
||||
For that reason, the default `~/.tmux.conf.local` file stopped using Unicode
|
||||
characters for which width changed in between Unicode 8.0 and 9.0 standards,
|
||||
as well as Emojis.
|
||||
|
||||
- **I installed Powerline and/or (patched) fonts but can't see Powerline
|
||||
symbols.**
|
||||
|
||||
First, you don't need to install Powerline. You only need fonts patched with
|
||||
Powerline symbols or the standalone `PowerlineSymbols.otf` font. Then make
|
||||
sure your `~/.tmux.conf.local` copy uses the right code points for
|
||||
`tmux_conf_theme_left_separator_XXX` values.
|
||||
|
||||
- **I'm using Bash On Windows (WSL), colors and Powerline look are broken.**
|
||||
|
||||
There is currently a [bug][1681] in the new console powering Bash On Windows
|
||||
preventing text attributes (bold, underscore, ...) to combine properly with
|
||||
colors. The workaround is to search your `~/.tmux.conf.local` copy and
|
||||
replace attributes with `'none'`.
|
||||
|
||||
Also, until Window's console replaces its GDI based render with a DirectWrite
|
||||
one, Powerline symbols will be broken.
|
||||
|
||||
The alternative is to use the [Mintty terminal for WSL][wsltty].
|
||||
|
||||
[1681]: https://github.com/Microsoft/BashOnWindows/issues/1681
|
||||
[wsltty]: https://github.com/mintty/wsltty
|
||||
|
||||
Features
|
||||
--------
|
||||
|
||||
- `C-a` acts as secondary prefix, while keeping default `C-b` prefix
|
||||
- visual theme inspired by [Powerline][]
|
||||
- [maximize any pane to a new window with `<prefix> +`][maximize-pane]
|
||||
- SSH aware username and hostname status line information
|
||||
- mouse mode toggle with `<prefix> m`
|
||||
- automatic usage of [`reattach-to-user-namespace`][reattach-to-user-namespace]
|
||||
if available
|
||||
- laptop battery status line information
|
||||
- uptime status line information
|
||||
- optional highlight of focused pane (tmux `>= 2.1`)
|
||||
- configurable new windows and panes behavior (optionally retain current path)
|
||||
- SSH aware split pane (reconnects to remote server, experimental)
|
||||
- copy to OS clipboard (needs [`reattach-to-user-namespace`][reattach-to-user-namespace]
|
||||
on macOS, `xsel` or `xclip` on Linux)
|
||||
- [Facebook PathPicker][] integration if available
|
||||
- [Urlview][] integration if available
|
||||
|
||||
[Powerline]: https://github.com/Lokaltog/powerline
|
||||
[maximize-pane]: http://pempek.net/articles/2013/04/14/maximizing-tmux-pane-new-window/
|
||||
[reattach-to-user-namespace]: https://github.com/ChrisJohnsen/tmux-MacOSX-pasteboard
|
||||
[Facebook PathPicker]: https://facebook.github.io/PathPicker/
|
||||
[Urlview]: https://packages.debian.org/stable/misc/urlview
|
||||
|
||||
tmux may be controlled from an attached client by using a key combination of a
|
||||
prefix key, followed by a command key. This configuration uses `C-a` as a
|
||||
secondary prefix while keeping `C-b` as the default prefix. In the following
|
||||
list of key bindings:
|
||||
- `<prefix>` means you have to either hit <kbd>Ctrl</kbd> + <kbd>a</kbd> or <kbd>Ctrl</kbd> + <kbd>b</kbd>
|
||||
- `<prefix> c` means you have to hit <kbd>Ctrl</kbd> + <kbd>a</kbd> or <kbd>Ctrl</kbd> + <kbd>b</kbd> followed by <kbd>c</kbd>
|
||||
- `<prefix> C-c` means you have to hit <kbd>Ctrl</kbd> + <kbd>a</kbd> or <kbd>Ctrl</kbd> + <kbd>b</kbd> followed by <kbd>Ctrl</kbd> + <kbd>c</kbd>
|
||||
|
||||
This configuration uses the following bindings:
|
||||
|
||||
- `<prefix> C-c` creates a new session
|
||||
- `<prefix> e` opens `~/.tmux.conf.local` with the editor defined by the
|
||||
`$EDITOR` environment variable (defaults to `vim` when empty)
|
||||
- `<prefix> r` reloads the configuration
|
||||
- `<prefix> C-f` lets you switch to another session by name
|
||||
- `<prefix> C-h` and `<prefix> C-l` let you navigate windows (default
|
||||
`<prefix> n` and `<prefix> p` are unbound)
|
||||
- `<prefix> Tab` brings you to the last active window
|
||||
- `<prefix> h`, `<prefix> j`, `<prefix> k` and `<prefix> l` let you navigate
|
||||
panes ala Vim
|
||||
- `<prefix> H`, `<prefix> J`, `<prefix> K`, `<prefix> L` let you resize panes
|
||||
- `<prefix> <` and `<prefix> >` let you swap panes
|
||||
- `<prefix> +` maximizes the current pane to a new window
|
||||
- `<prefix> m` toggles mouse mode on or off
|
||||
- `<prefix> U` launches Urlview (if available)
|
||||
- `<prefix> F` launches Facebook PathPicker (if available)
|
||||
- `<prefix> Enter` enters copy-mode
|
||||
- `<prefix> b` lists the paste-buffers
|
||||
- `<prefix> p` pastes from the top paste-buffer
|
||||
- `<prefix> P` lets you choose the paste-buffer to paste from
|
||||
- `C-l` clears both the screen and the history
|
||||
|
||||
Additionally, `vi-choice`, `vi-edit` and `vi-copy` named tables are adjusted
|
||||
to closely match [my own Vim configuration][]
|
||||
|
||||
[my own Vim configuration]: https://github.com/gpakosz/.vim.git
|
||||
|
||||
Bindings for the `vi-choice` mode-table:
|
||||
|
||||
- `h` collapses the current tree node
|
||||
- `l` expands the current tree node
|
||||
- `H` collapses all the tree nodes
|
||||
- `L` expands all the tree nodes
|
||||
- `K` jumps to the start of list (tmux `2.0+`)
|
||||
- `L` jumps to the end of list (tmux `2.0+`)
|
||||
- `Escape` cancels the current operation
|
||||
|
||||
Bindings for the `vi-edit` mode-table:
|
||||
|
||||
- `H` jumps to the start of line
|
||||
- `L` jumps to the end of line
|
||||
- `q` cancels the current operation
|
||||
- `Escape` cancels the current operation
|
||||
|
||||
Bindings for the `vi-copy` mode-table:
|
||||
|
||||
- `v` begins selection / visual mode
|
||||
- `C-v` toggles between blockwise visual mode and visual mode
|
||||
- `H` jumps to the start of line
|
||||
- `L` jumps to the end of line
|
||||
- `y` copies the selection to the top paste-buffer
|
||||
- `Escape` cancels the current operation
|
||||
|
||||
The "maximize any pane to a new window with `<prefix> +`" feature is different
|
||||
from builtin `resize-pane -Z` as it allows you to further split a maximized
|
||||
pane. It's also more flexible by allowing you to maximize a pane to a new
|
||||
window, then change window, then go back and the pane is still in maximized
|
||||
state in its own window. You can then minimize a pane by using `<prefix> +`
|
||||
either from the source window or the maximized window.
|
||||
|
||||

|
||||
|
||||
Mouse mode allows you to set the active window, set the active pane, resize
|
||||
panes and automatically switches to copy-mode to select text.
|
||||
|
||||

|
||||
|
||||
Configuration
|
||||
-------------
|
||||
|
||||
While this configuration tries to bring sane default settings, you may want to
|
||||
customize it further to your needs. Instead of altering the `~/.tmux.conf` file
|
||||
and diverging from upstream, the proper way is to edit the `~/.tmux.conf.local`
|
||||
file.
|
||||
|
||||
Please refer to the default `~/.tmux.conf.local` file to know more about
|
||||
variables you can adjust to alter different behaviors. Pressing `<prefix> e`
|
||||
will open `~/.tmux.conf.local` with the editor defined by the `$EDITOR`
|
||||
environment variable (defaults to `vim` when empty).
|
||||
|
||||
### Enabling the Powerline look
|
||||
|
||||
Powerline originated as a status-line plugin for Vim. Its popular eye-catching
|
||||
look is based on the use of special symbols: <img width="80" alt="Powerline Symbols" style="vertical-align: middle;" src="https://cloud.githubusercontent.com/assets/553208/10687156/1b76dda6-796b-11e5-83a1-1634337c4571.png" />
|
||||
|
||||
To make use of these symbols, there are several options:
|
||||
|
||||
- use a font that already bundles those: this is e.g. the case of the
|
||||
[2.030R-ro/1.050R-it version][source code pro] of the Source Code Pro] font
|
||||
- use a [pre-patched font][powerline patched fonts]
|
||||
- use your preferred font along with the [Powerline font][powerline font] (that
|
||||
only contains the Powerline symbols): [this highly depends on your operating
|
||||
system and your terminal emulator][terminal support]
|
||||
- [patch your preferred font][powerline font patcher] by adding the missing
|
||||
Powerline symbols: this is the most difficult way and is no more documented in
|
||||
the [Powerline manual]
|
||||
|
||||
[source code pro]: https://github.com/adobe-fonts/source-code-pro/releases/tag/2.030R-ro/1.050R-it
|
||||
[powerline patched fonts]: https://github.com/powerline/fonts
|
||||
[powerline font]: https://github.com/powerline/powerline/raw/develop/font/PowerlineSymbols.otf
|
||||
[powerline font patcher]: https://github.com/powerline/fontpatcher
|
||||
[terminal support]: http://powerline.readthedocs.io/en/master/usage.html#usage-terminal-emulators
|
||||
[Powerline manual]: http://powerline.readthedocs.org/en/latest/installation.html#fonts-installation
|
||||
|
||||
Please see the [Powerline manual] for further details.
|
||||
|
||||
Then edit the `~/.tmux.conf.local` file (`<prefix> e`) and adjust the following
|
||||
variables:
|
||||
|
||||
```
|
||||
tmux_conf_theme_left_separator_main=''
|
||||
tmux_conf_theme_left_separator_sub=''
|
||||
tmux_conf_theme_right_separator_main=''
|
||||
tmux_conf_theme_right_separator_sub=''
|
||||
```
|
||||
### Configuring the status line
|
||||
|
||||
Contrary to the first iterations of this configuration, by now you have total
|
||||
control on the content and order of `status-left` and `status-right`.
|
||||
|
||||
Edit the `~/.tmux.conf.local` file (`<prefix> e`) and adjust the
|
||||
`tmux_conf_theme_status_left` and `tmux_conf_theme_status_right` variables to
|
||||
your own preferences.
|
||||
|
||||
This configuration supports the following builtin variables:
|
||||
|
||||
- `#{battery_bar}`: horizontal battery charge bar
|
||||
- `#{battery_percentage}`: battery percentage
|
||||
- `#{battery_status}`: is battery charging or discharging?
|
||||
- `#{battery_vbar}`: vertical battery charge bar
|
||||
- `#{circled_session_name}`: circled session number, up to 20
|
||||
- `#{hostname}`: SSH aware hostname information
|
||||
- `#{hostname_ssh}`: SSH aware hostname information, blank when no SSH
|
||||
connection detected
|
||||
- `#{loadavg}`: load average
|
||||
- `#{pairing}`: is session attached to more than one client?
|
||||
- `#{prefix}`: is prefix being depressed?
|
||||
- `#{root}`: is current user root?
|
||||
- `#{uptime_d}`: uptime days
|
||||
- `#{uptime_h}`: uptime hours
|
||||
- `#{uptime_m}`: uptime minutes
|
||||
- `#{uptime_s}`: uptime seconds
|
||||
- `#{username}`: SSH aware username information
|
||||
- `#{username_ssh}`: SSH aware username information, blank when no SSH
|
||||
connection detected
|
||||
|
||||
### Accessing the macOS clipboard from within tmux sessions
|
||||
|
||||
[Chris Johnsen created the `reattach-to-user-namespace`
|
||||
utility][reattach-to-user-namespace] that makes `pbcopy` and `pbpaste` work
|
||||
again within tmux.
|
||||
|
||||
To install `reattach-to-user-namespace`, use either [MacPorts][] or
|
||||
[Homebrew][]:
|
||||
|
||||
$ port install tmux-pasteboard
|
||||
|
||||
or
|
||||
|
||||
$ brew install reattach-to-user-namespace
|
||||
|
||||
Once installed, `reattach-to-usernamespace` will be automatically detected.
|
||||
|
||||
[MacPorts]: http://www.macports.org/
|
||||
[Homebrew]: http://brew.sh/
|
||||
|
||||
### Using the configuration under Cygwin within Mintty
|
||||
|
||||
**I don't recommend running this configuration with Cygwin anymore. Forking
|
||||
under Cygwin is extremely slow and this configuration issues a lot of
|
||||
`run-shell` commands under the hood. As such, you will experience high CPU
|
||||
usage. As an alternative consider using [Mintty terminal for WSL][wsltty].**
|
||||
|
||||

|
||||
|
||||
It is possible to use this configuration under Cygwin within Mintty, however
|
||||
support for Unicode symbols and emojis lacks behind Mac and Linux.
|
||||
|
||||
Particularly, Mintty's text rendering is implemented with GDI which has
|
||||
limitations:
|
||||
|
||||
- color emojis are only available through DirectWrite starting with Windows 8.1
|
||||
- display of double width symbols, like the battery discharging symbol indicator
|
||||
(U+1F50B) is buggy
|
||||
|
||||
To get Unicode symbols displayed properly, you have to use [font linking].
|
||||
Open `regedit.exe` then navigate to the registry key at
|
||||
`HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontLink\SystemLink`
|
||||
and add a new entry for you preferred font to link it with the Segoe UI Symbol
|
||||
font.
|
||||
|
||||

|
||||
|
||||
[font linking]: https://msdn.microsoft.com/en-us/goglobal/bb688134.aspx
|
||||
31
makesymlinks.sh
Executable file
31
makesymlinks.sh
Executable file
@ -0,0 +1,31 @@
|
||||
#!/usr/bin/env bash
|
||||
############################
|
||||
# .make.sh
|
||||
# This script creates symlinks from the home directory to any desired dotfiles in ~/dotfiles
|
||||
############################
|
||||
|
||||
########## Variables
|
||||
|
||||
dir=~/dotfiles # dotfiles directory
|
||||
olddir=~/dotfiles_old # old dotfiles backup directory
|
||||
files=".tmux.conf .tmux.conf.local .vimrc .vim .tcshrc .inputrc" # list of files/folders to symlink in homedir
|
||||
|
||||
##########
|
||||
|
||||
# create dotfiles_old in homedir
|
||||
echo "Creating $olddir for backup of any existing dotfiles in ~"
|
||||
mkdir -p $olddir
|
||||
echo "...done"
|
||||
|
||||
# change to the dotfiles directory
|
||||
echo "Changing to the $dir directory"
|
||||
cd $dir
|
||||
echo "...done"
|
||||
|
||||
# move any existing dotfiles in homedir to dotfiles_old directory, then create symlinks
|
||||
for file in $files; do
|
||||
echo "Moving any existing dotfiles from ~ to $olddir"
|
||||
mv ~/$file ~/dotfiles_old/ > /dev/null 2>&1
|
||||
echo "Creating symlink to $file in home directory."
|
||||
ln -s $dir/$file ~/$file > /dev/null 2>&1
|
||||
done
|
||||
Reference in New Issue
Block a user