airline.txt 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880
  1. *airline.txt* Lean and mean status/tabline that's light as air
  2. *airline*
  3. _ _ _ _ ~
  4. __ _(_)_ __ ___ __ _(_)_ __| (_)_ __ ___ ~
  5. \ \ / / | '_ ` _ \ _____ / _` | | '__| | | '_ \ / _ \ ~
  6. \ V /| | | | | | |_____| (_| | | | | | | | | | __/ ~
  7. \_/ |_|_| |_| |_| \__,_|_|_| |_|_|_| |_|\___| ~
  8. ~
  9. ==============================================================================
  10. CONTENTS *airline-contents*
  11. 01. Intro ............................................... |airline-intro|
  12. 02. Features ......................................... |airline-features|
  13. 03. Name ................................................. |airline-name|
  14. 04. Configuration ............................... |airline-configuration|
  15. 05. Commands ......................................... |airline-commands|
  16. 06. Autocommands ................................. |airline-autocommands|
  17. 07. Customization ............................... |airline-customization|
  18. 08. Extensions ..................................... |airline-extensions|
  19. 09. Advanced Customization ............. |airline-advanced-customization|
  20. 10. Funcrefs ......................................... |airline-funcrefs|
  21. 11. Pipeline ......................................... |airline-pipeline|
  22. 12. Writing Extensions ..................... |airline-writing-extensions|
  23. 13. Writing Themes ..................................... |airline-themes|
  24. 14. Troubleshooting ........................... |airline-troubleshooting|
  25. 15. Contributions ............................... |airline-contributions|
  26. 16. License ........................................... |airline-license|
  27. ==============================================================================
  28. INTRODUCTION *airline-intro*
  29. vim-airline is a fast and lightweight alternative to powerline, written
  30. in 100% vimscript with no outside dependencies.
  31. ==============================================================================
  32. FEATURES *airline-features*
  33. * tiny core written with extensibility in mind.
  34. * integrates with many popular plugins.
  35. * looks good with regular fonts, and provides configuration points so you
  36. can use unicode or powerline symbols.
  37. * optimized for speed; it loads in under a millisecond.
  38. * fully customizable; if you know a little 'statusline' syntax you can
  39. tweak it to your needs.
  40. * extremely easy to write themes.
  41. ==============================================================================
  42. NAME *airline-name*
  43. Where did the name come from?
  44. I wrote this on an airplane, and since it's light as air it turned out to be a
  45. good name :-)
  46. ==============================================================================
  47. CONFIGURATION *airline-configuration*
  48. There are a couple configuration values available (shown with their default
  49. values):
  50. * the separator used on the left side >
  51. let g:airline_left_sep='>'
  52. <
  53. * the separator used on the right side >
  54. let g:airline_right_sep='<'
  55. <
  56. * enable modified detection >
  57. let g:airline_detect_modified=1
  58. * enable paste detection >
  59. let g:airline_detect_paste=1
  60. <
  61. * enable crypt detection >
  62. let g:airline_detect_crypt=1
  63. <
  64. * enable iminsert detection >
  65. let g:airline_detect_iminsert=0
  66. <
  67. * determine whether inactive windows should have the left section collapsed to
  68. only the filename of that buffer. >
  69. let g:airline_inactive_collapse=1
  70. <
  71. * themes are automatically selected based on the matching colorscheme. this
  72. can be overridden by defining a value. >
  73. let g:airline_theme=
  74. <
  75. * if you want to patch the airline theme before it gets applied, you can
  76. supply the name of a function where you can modify the palette. >
  77. let g:airline_theme_patch_func = 'AirlineThemePatch'
  78. function! AirlineThemePatch(palette)
  79. if g:airline_theme == 'badwolf'
  80. for colors in values(a:palette.inactive)
  81. let colors[3] = 245
  82. endfor
  83. endif
  84. endfunction
  85. <
  86. * enable/disable automatic population of the `g:airline_symbols` dictionary
  87. with powerline symbols. >
  88. let g:airline_powerline_fonts=0
  89. <
  90. * define the set of text to display for each mode. >
  91. let g:airline_mode_map = {} " see source for the defaults
  92. " or copy paste the following into your vimrc for shortform text
  93. let g:airline_mode_map = {
  94. \ '__' : '-',
  95. \ 'n' : 'N',
  96. \ 'i' : 'I',
  97. \ 'R' : 'R',
  98. \ 'c' : 'C',
  99. \ 'v' : 'V',
  100. \ 'V' : 'V',
  101. \ '' : 'V',
  102. \ 's' : 'S',
  103. \ 'S' : 'S',
  104. \ '' : 'S',
  105. \ }
  106. <
  107. * define the set of filename match queries which excludes a window from having
  108. its statusline modified >
  109. let g:airline_exclude_filenames = [] " see source for current list
  110. <
  111. * define the set of filetypes which are excluded from having its window
  112. statusline modified >
  113. let g:airline_exclude_filetypes = [] " see source for current list
  114. <
  115. * defines whether the preview window should be excluded from have its window
  116. statusline modified (may help with plugins which use the preview window
  117. heavily) >
  118. let g:airline_exclude_preview = 0
  119. <
  120. * disable the Airline customization for selective windows (this is a
  121. window-local variable so you can disable it for only some windows) >
  122. let w:airline_disabled = 1
  123. <
  124. ==============================================================================
  125. COMMANDS *airline-commands*
  126. :AirlineTheme {theme-name} *:AirlineTheme*
  127. Displays or changes the current theme.
  128. :AirlineToggleWhitespace *:AirlineToggleWhitespace*
  129. Toggles whitespace detection.
  130. :AirlineToggle *:AirlineToggle*
  131. Toggles between the standard 'statusline' and airline.
  132. :AirlineRefresh *:AirlineRefresh*
  133. Refreshes all highlight groups and redraws the statusline.
  134. ==============================================================================
  135. AUTOCOMMANDS *airline-autocommands*
  136. Airline comes with some user-defined autocommands.
  137. |AirlineAfterInit| after plugin is initialized, but before the statusline
  138. is replaced
  139. |AirlineToggledOn| after airline is activated and replaced the statusline
  140. |AirlineToggledOff| after airline is deactivated and the statusline is
  141. restored to the original
  142. ==============================================================================
  143. CUSTOMIZATION *airline-customization*
  144. The following are some unicode symbols for customizing the left/right
  145. separators, as well as the powerline font glyphs.
  146. Note: You must define the dictionary first before setting values. Also, it's a
  147. good idea to check whether it exists as to avoid accidentally overwriting
  148. its contents. >
  149. if !exists('g:airline_symbols')
  150. let g:airline_symbols = {}
  151. endif
  152. " unicode symbols
  153. let g:airline_left_sep = '»'
  154. let g:airline_left_sep = '▶'
  155. let g:airline_right_sep = '«'
  156. let g:airline_right_sep = '◀'
  157. let g:airline_symbols.crypt = '🔒'
  158. let g:airline_symbols.linenr = '␊'
  159. let g:airline_symbols.linenr = '␤'
  160. let g:airline_symbols.linenr = '¶'
  161. let g:airline_symbols.branch = '⎇'
  162. let g:airline_symbols.paste = 'ρ'
  163. let g:airline_symbols.paste = 'Þ'
  164. let g:airline_symbols.paste = '∥'
  165. let g:airline_symbols.whitespace = 'Ξ'
  166. " powerline symbols
  167. let g:airline_left_sep = ''
  168. let g:airline_left_alt_sep = ''
  169. let g:airline_right_sep = ''
  170. let g:airline_right_alt_sep = ''
  171. let g:airline_symbols.branch = ''
  172. let g:airline_symbols.readonly = ''
  173. let g:airline_symbols.linenr = ''
  174. " old vim-powerline symbols
  175. let g:airline_left_sep = '⮀'
  176. let g:airline_left_alt_sep = '⮁'
  177. let g:airline_right_sep = '⮂'
  178. let g:airline_right_alt_sep = '⮃'
  179. let g:airline_symbols.branch = '⭠'
  180. let g:airline_symbols.readonly = '⭤'
  181. let g:airline_symbols.linenr = '⭡'
  182. <
  183. For more intricate customizations, you can replace the predefined sections
  184. with the usual statusline syntax.
  185. Note: If you define any section variables it will replace the default values
  186. entirely. If you want to disable only certain parts of a section you can try
  187. using variables defined in the |airline-configuration| or |airline-extensions|
  188. section.
  189. >
  190. variable names default contents
  191. ----------------------------------------------------------------------------
  192. let g:airline_section_a (mode, crypt, paste, iminsert)
  193. let g:airline_section_b (hunks, branch)
  194. let g:airline_section_c (bufferline or filename)
  195. let g:airline_section_gutter (readonly, csv)
  196. let g:airline_section_x (tagbar, filetype, virtualenv)
  197. let g:airline_section_y (fileencoding, fileformat)
  198. let g:airline_section_z (percentage, line number, column number)
  199. let g:airline_section_warning (syntastic, whitespace)
  200. " here is an example of how you could replace the branch indicator with
  201. " the current working directory, followed by the filename.
  202. let g:airline_section_b = '%{getcwd()}'
  203. let g:airline_section_c = '%t'
  204. <
  205. ==============================================================================
  206. EXTENSIONS *airline-extensions*
  207. Most extensions are enabled by default and lazily loaded when the
  208. corresponding plugin (if any) is detected.
  209. By default, airline will attempt to load any extension it can find in the
  210. 'runtimepath'. On some systems this can result in an undesirable startup
  211. cost. You can disable the check with the following flag. >
  212. let g:airline#extensions#disable_rtp_load = 1
  213. <
  214. Note: Third party plugins that rely on this behavior will be affected. You
  215. will need to manually load them.
  216. Alternatively, if you want a minimalistic setup and would rather opt-in which
  217. extensions get loaded instead of disabling each individually, you can declare
  218. the following list variable: >
  219. " an empty list disables all extensions
  220. let g:airline_extensions = []
  221. " or only load what you want
  222. let g:airline_extensions = ['branch', 'tabline']
  223. <
  224. ------------------------------------- *airline-default*
  225. The default extension understands all of the `g:` variables in the
  226. |airline-configuration| section, however it also has some more fine-tuned
  227. configuration values that you can use.
  228. * control which sections get truncated and at what width. >
  229. let g:airline#extensions#default#section_truncate_width = {
  230. \ 'b': 79,
  231. \ 'x': 60,
  232. \ 'y': 88,
  233. \ 'z': 45,
  234. \ }
  235. " Note: set to an empty dictionary to disable truncation.
  236. let g:airline#extensions#default#section_truncate_width = {}
  237. <
  238. * configure the layout of the sections by specifying an array of two arrays
  239. (first array is the left side, second array is the right side). >
  240. let g:airline#extensions#default#layout = [
  241. \ [ 'a', 'b', 'c' ],
  242. \ [ 'x', 'y', 'z', 'warning' ]
  243. \ ]
  244. <
  245. ------------------------------------- *airline-quickfix*
  246. The quickfix extension is a simple built-in extension which determines
  247. whether the buffer is a quickfix or location list buffer, and adjusts the
  248. title accordingly.
  249. * configure the title text for quickfix buffers >
  250. let g:airline#extensions#quickfix#quickfix_text = 'Quickfix'
  251. <
  252. * configure the title text for location list buffers >
  253. let g:airline#extensions#quickfix#location_text = 'Location'
  254. <
  255. ------------------------------------- *airline-bufferline*
  256. vim-bufferline <https://github.com/bling/vim-bufferline>
  257. * enable/disable bufferline integration >
  258. let g:airline#extensions#bufferline#enabled = 1
  259. <
  260. * determine whether bufferline will overwrite customization variables >
  261. let g:airline#extensions#bufferline#overwrite_variables = 1
  262. <
  263. ------------------------------------- *airline-branch*
  264. fugitive.vim <https://github.com/tpope/vim-fugitive>
  265. lawrencium <https://bitbucket.org/ludovicchabant/vim-lawrencium>
  266. vcscommand <http://www.vim.org/scripts/script.php?script_id=90>
  267. * enable/disable fugitive/lawrencium integration >
  268. let g:airline#extensions#branch#enabled = 1
  269. <
  270. * change the text for when no branch is detected >
  271. let g:airline#extensions#branch#empty_message = ''
  272. <
  273. * use vcscommand.vim if available >
  274. let g:airline#extensions#branch#use_vcscommand = 0
  275. <
  276. * truncate long branch names to a fixed length >
  277. let g:airline#extensions#branch#displayed_head_limit = 10
  278. <
  279. * customize formatting of branch name >
  280. " default value leaves the name unmodifed
  281. let g:airline#extensions#branch#format = 0
  282. " to only show the tail, e.g. a branch 'feature/foo' show 'foo'
  283. let g:airline#extensions#branch#format = 1
  284. " if a string is provided, it should be the name of a function that
  285. " takes a string and returns the desired value
  286. let g:airline#extensions#branch#format = 'CustomBranchName'
  287. function! CustomBranchName(name)
  288. return '[' . a:name . ']'
  289. endfunction
  290. <
  291. ------------------------------------- *airline-syntastic*
  292. syntastic <https://github.com/scrooloose/syntastic>
  293. * enable/disable syntastic integration >
  294. let g:airline#extensions#syntastic#enabled = 1
  295. <
  296. ------------------------------------- *airline-tagbar*
  297. tagbar <https://github.com/majutsushi/tagbar>
  298. * enable/disable tagbar integration >
  299. let g:airline#extensions#tagbar#enabled = 1
  300. <
  301. * change how tags are displayed (:help tagbar-statusline) >
  302. let g:airline#extensions#tagbar#flags = '' (default)
  303. let g:airline#extensions#tagbar#flags = 'f'
  304. let g:airline#extensions#tagbar#flags = 's'
  305. let g:airline#extensions#tagbar#flags = 'p'
  306. <
  307. ------------------------------------- *airline-csv*
  308. csv.vim <https://github.com/chrisbra/csv.vim>
  309. * enable/disable csv integration for displaying the current column. >
  310. let g:airline#extensions#csv#enabled = 1
  311. <
  312. * change how columns are displayed. >
  313. let g:airline#extensions#csv#column_display = 'Number' (default)
  314. let g:airline#extensions#csv#column_display = 'Name'
  315. <
  316. ------------------------------------- *airline-hunks*
  317. vim-gitgutter <https://github.com/airblade/vim-gitgutter>
  318. vim-signify <https://github.com/mhinz/vim-signify>
  319. changesPlugin <https://github.com/chrisbra/changesPlugin>
  320. quickfixsigns <https://github.com/tomtom/quickfixsigns_vim>
  321. * enable/disable showing a summary of changed hunks under source control. >
  322. let g:airline#extensions#hunks#enabled = 1
  323. <
  324. * enable/disable showing only non-zero hunks. >
  325. let g:airline#extensions#hunks#non_zero_only = 0
  326. <
  327. * set hunk count symbols. >
  328. let g:airline#extensions#hunks#hunk_symbols = ['+', '~', '-']
  329. <
  330. ------------------------------------- *airline-ctrlp*
  331. ctrlp <https://github.com/kien/ctrlp.vim>
  332. * configure which mode colors should ctrlp window use (takes effect
  333. only if the active airline theme doesn't define ctrlp colors) >
  334. let g:airline#extensions#ctrlp#color_template = 'insert' (default)
  335. let g:airline#extensions#ctrlp#color_template = 'normal'
  336. let g:airline#extensions#ctrlp#color_template = 'visual'
  337. let g:airline#extensions#ctrlp#color_template = 'replace'
  338. <
  339. * configure whether to show the previous and next modes (mru, buffer, etc...)
  340. >
  341. let g:airline#extensions#ctrlp#show_adjacent_modes = 1
  342. <
  343. ------------------------------------- *airline-virtualenv*
  344. virtualenv <https://github.com/jmcantrell/vim-virtualenv>
  345. * enable/disable virtualenv integration >
  346. let g:airline#extensions#virtualenv#enabled = 1
  347. <
  348. ------------------------------------- *airline-eclim*
  349. eclim <https://eclim.org>
  350. * enable/disable eclim integration, which works well with the
  351. |airline-syntastic| extension. >
  352. let g:airline#extensions#eclim#enabled = 1
  353. ------------------------------------- *airline-wordcount*
  354. * enable/disable word counting. >
  355. let g:airline#extensions#wordcount#enabled = 1
  356. <
  357. * regex of filetypes to enable word counting. >
  358. " the default value matches filetypes typically used for documentation
  359. " such as markdown and help files.
  360. let g:airline#extensions#wordcount#filetypes = ...
  361. <
  362. ------------------------------------- *airline-whitespace*
  363. * enable/disable detection of whitespace errors. >
  364. let g:airline#extensions#whitespace#enabled = 1
  365. <
  366. * customize the type of mixed indent checking to perform. >
  367. " must be all spaces or all tabs before the first non-whitespace character
  368. let g:airline#extensions#whitespace#mixed_indent_algo = 0 (default)
  369. " certain number of spaces are allowed after tabs, but not in between
  370. " this algorithm works well for /** */ style comments in a tab-indented file
  371. let g:airline#extensions#whitespace#mixed_indent_algo = 1
  372. " spaces are allowed after tabs, but not in between
  373. " this algorithm works well with programming styles that use tabs for
  374. " indentation and spaces for alignment
  375. let g:airline#extensions#whitespace#mixed_indent_algo = 2
  376. <
  377. * customize the whitespace symbol. >
  378. let g:airline#extensions#whitespace#symbol = '!'
  379. <
  380. * configure which whitespace checks to enable. >
  381. let g:airline#extensions#whitespace#checks = [ 'indent', 'trailing', 'long' ]
  382. <
  383. * configure the maximum number of lines where whitespace checking is enabled. >
  384. let g:airline#extensions#whitespace#max_lines = 20000
  385. <
  386. * configure whether a message should be displayed. >
  387. let g:airline#extensions#whitespace#show_message = 1
  388. <
  389. * configure the formatting of the warning messages. >
  390. let g:airline#extensions#whitespace#trailing_format = 'trailing[%s]'
  391. let g:airline#extensions#whitespace#mixed_indent_format = 'mixed-indent[%s]'
  392. let g:airline#extensions#whitespace#long_format = 'long[%s]'
  393. <
  394. ------------------------------------- *airline-tabline*
  395. * enable/disable enhanced tabline. >
  396. let g:airline#extensions#tabline#enabled = 0
  397. <
  398. * enable/disable displaying buffers with a single tab. >
  399. let g:airline#extensions#tabline#show_buffers = 1
  400. <
  401. * enable/disable displaying tabs, regardless of number. >
  402. let g:airline#extensions#tabline#show_tabs = 1
  403. <
  404. * configure filename match rules to exclude from the tabline. >
  405. let g:airline#extensions#tabline#excludes = []
  406. * enable/disable display preview window buffer in the tabline.
  407. let g:airline#extensions#tabline#exclude_preview = 1
  408. * configure how numbers are displayed in tab mode. >
  409. let g:airline#extensions#tabline#tab_nr_type = 0 " # of splits (default)
  410. let g:airline#extensions#tabline#tab_nr_type = 1 " tab number
  411. let g:airline#extensions#tabline#tab_nr_type = 2 " splits and tab number
  412. <
  413. * enable/disable displaying tab number in tabs mode. >
  414. let g:airline#extensions#tabline#show_tab_nr = 1
  415. * enable/disable displaying tab type (far right)
  416. let g:airline#extensions#tabline#show_tab_type = 1
  417. * enable/disable displaying index of the buffer.
  418. When enabled, numbers will be displayed in the tabline and mappings will be
  419. exposed to allow you to select a buffer directly. Up to 9 mappings will be
  420. exposed.
  421. let g:airline#extensions#tabline#buffer_idx_mode = 1
  422. nmap <leader>1 <Plug>AirlineSelectTab1
  423. nmap <leader>2 <Plug>AirlineSelectTab2
  424. nmap <leader>3 <Plug>AirlineSelectTab3
  425. nmap <leader>4 <Plug>AirlineSelectTab4
  426. nmap <leader>5 <Plug>AirlineSelectTab5
  427. nmap <leader>6 <Plug>AirlineSelectTab6
  428. nmap <leader>7 <Plug>AirlineSelectTab7
  429. nmap <leader>8 <Plug>AirlineSelectTab8
  430. nmap <leader>9 <Plug>AirlineSelectTab9
  431. Note: Mappings will be ignored within a NERDTree buffer.
  432. * defines the name of a formatter for how buffer names are displayed. >
  433. let g:airline#extensions#tabline#formatter = 'default'
  434. " here is how you can define a 'foo' formatter:
  435. function! airline#extensions#tabline#foo#format(bufnr, buffers)
  436. return fnamemodify(bufname(a:bufnr), ':t')
  437. endfunction
  438. let g:airline#extensions#tabline#formatter = 'foo'
  439. <
  440. Note: the following variables are only used by the 'default' formatter.
  441. When no disambiguation is needed, both 'unique_tail_improved' and
  442. 'unique_tail' delegate formatting to 'default', so these variables also
  443. control rendering of unique filenames when using these formatters.
  444. * configure whether buffer numbers should be shown. >
  445. let g:airline#extensions#tabline#buffer_nr_show = 0
  446. <
  447. * configure how buffer numbers should be formatted with |printf|. >
  448. let g:airline#extensions#tabline#buffer_nr_format = '%s: '
  449. <
  450. * configure the formatting of filenames (see |filename-modifiers|). >
  451. let g:airline#extensions#tabline#fnamemod = ':p:.'
  452. <
  453. * configure collapsing parent directories in buffer name. >
  454. let g:airline#extensions#tabline#fnamecollapse = 1
  455. <
  456. * configure truncating non-active buffer names to specified length. >
  457. let g:airline#extensions#tabline#fnametruncate = 0
  458. " The `unique_tail` algorithm will display the tail of the filename, unless
  459. " there is another file of the same name, in which it will display it along
  460. " with the containing parent directory.
  461. let g:airline#extensions#tabline#formatter = 'unique_tail'
  462. " The `unique_tail_improved` - another algorithm, that will smartly uniquify
  463. " buffers names with similar filename, suppressing common parts of paths.
  464. let g:airline#extensions#tabline#formatter = 'unique_tail_improved'
  465. <
  466. * configure the minimum number of buffers needed to show the tabline. >
  467. let g:airline#extensions#tabline#buffer_min_count = 0
  468. <
  469. Note: this setting only applies to a single tab and when `show_buffers` is
  470. true.
  471. * configure the minimum number of tabs needed to show the tabline. >
  472. let g:airline#extensions#tabline#tab_min_count = 0
  473. <
  474. Note: this setting only applies when `show_buffers` is false.
  475. * configure separators for the tabline only. >
  476. let g:airline#extensions#tabline#left_sep = ''
  477. let g:airline#extensions#tabline#left_alt_sep = ''
  478. let g:airline#extensions#tabline#right_sep = ''
  479. let g:airline#extensions#tabline#right_alt_sep = ''
  480. * configure whether close button should be shown
  481. let g:airline#extensions#tabline#show_close_button = 1
  482. * configure symbol used to represent close button
  483. let g:airline#extensions#tabline#close_symbol = 'X'
  484. <
  485. Note: Enabling this extension will modify 'showtabline' and 'guioptions'.
  486. ------------------------------------- *airline-tmuxline*
  487. tmuxline <https://github.com/edkolev/tmuxline.vim>
  488. * enable/disable tmuxline integration >
  489. let g:airline#extensions#tmuxline#enabled = 0
  490. <
  491. * configure which mode colors should be used in tmux statusline >
  492. let airline#extensions#tmuxline#color_template = 'normal' (default)
  493. let airline#extensions#tmuxline#color_template = 'insert'
  494. let airline#extensions#tmuxline#color_template = 'visual'
  495. let airline#extensions#tmuxline#color_template = 'replace'
  496. <
  497. * if specified, setting this option will trigger writing to the file whenever the
  498. airline theme is applied, i.e. when :AirlineTheme is executed and on vim
  499. startup >
  500. airline#extensions#tmuxline#snapshot_file = "~/.tmux-statusline-colors.conf"
  501. <
  502. ------------------------------------- *airline-promptline*
  503. promptline <https://github.com/edkolev/promptline.vim>
  504. * configure the path to the snapshot .sh file. Mandatory option. The created
  505. file should be sourced by the shell on login >
  506. " in .vimrc
  507. airline#extensions#promptline#snapshot_file = "~/.shell_prompt.sh"
  508. " in .bashrc/.zshrc
  509. [ -f ~/.shell_prompt.sh ] && source ~/.shell_prompt.sh
  510. <
  511. * enable/disable promptline integration >
  512. let g:airline#extensions#promptline#enabled = 0
  513. <
  514. * configure which mode colors should be used in prompt >
  515. let airline#extensions#promptline#color_template = 'normal' (default)
  516. let airline#extensions#promptline#color_template = 'insert'
  517. let airline#extensions#promptline#color_template = 'visual'
  518. let airline#extensions#promptline#color_template = 'replace'
  519. <
  520. ------------------------------------- *airline-nrrwrgn*
  521. NrrwRgn <https://github.com/chrisbra/NrrwRgn>
  522. * enable/disable NrrwRgn integration >
  523. let g:airline#extensions#nrrwrgn#enabled = 1
  524. ------------------------------------- *airline-capslock*
  525. vim-capslock <https://github.com/tpope/vim-capslock>
  526. * enable/disable vim-capslock integration >
  527. let g:airline#extensions#capslock#enabled = 1
  528. ------------------------------------- *airline-windowswap*
  529. vim-windowswap <https://github.com/wesQ3/vim-windowswap>
  530. * enable/disable vim-windowswap integration >
  531. let g:airline#extensions#windowswap#enabled = 1
  532. * set marked window indicator string >
  533. let g:airline#extensions#windowswap#indicator_text = 'WS'
  534. <
  535. ------------------------------------- *airline-taboo*
  536. taboo.vim <https://github.com/gcmt/taboo.vim>
  537. * enable/disable taboo.vim integration >
  538. let g:airline#extensions#taboo#enabled = 1
  539. <
  540. ------------------------------------- *airline-ctrlspace*
  541. vim-ctrlspace <https://github.com/szw/vim-ctrlspace>
  542. * enable/disable vim-ctrlspace integration >
  543. let g:airline#extensions#ctrlspace#enabled = 1
  544. <
  545. ==============================================================================
  546. ADVANCED CUSTOMIZATION *airline-advanced-customization*
  547. The defaults will accommodate the mass majority of users with minimal
  548. configuration. However, if you want to reposition sections or contents you can
  549. do so with built-in helper functions, which makes it possible to create
  550. sections in a more declarative style.
  551. ------------------------------------- *airline-parts*
  552. A part is something that contains metadata that eventually gets rendered into
  553. the statusline. You can define parts that contain constant strings or
  554. functions. Defining parts is needed if you want to use features like automatic
  555. insertion of separators or hiding based on window width.
  556. For example, this is how you would define a part function: >
  557. call airline#parts#define_function('foo', 'GetFooText')
  558. <
  559. Here is how you would define a part that is visible only if the window width
  560. greater than a minimum width. >
  561. call airline#parts#define_minwidth('foo', 50)
  562. <
  563. Parts can be configured to be visible conditionally. >
  564. call airline#parts#define_condition('foo', 'getcwd() =~ "work_dir"')
  565. <
  566. Note: Part definitions are combinative; e.g. the two examples above modify the
  567. same `foo` part.
  568. Note: Look at the source code and tests for the full API.
  569. ------------------------------------- *airline-predefined-parts*
  570. Before is a list of parts that are predefined by vim-airline.
  571. * `mode` displays the current mode
  572. * `iminsert` displays the current insert method
  573. * `paste` displays the paste indicator
  574. * crypt displays the crypted indicator
  575. * `filetype` displays the file type
  576. * `readonly` displays the read only indicator
  577. * `file` displays the filename and modified indicator
  578. * `ffenc` displays the file format and encoding
  579. And the following are defined for their respective extensions:
  580. `hunks`, `branch`, `tagbar`, `syntastic`, `whitespace`
  581. ------------------------------------- *airline-accents*
  582. Accents can be defined on any part, like so: >
  583. call airline#parts#define_accent('foo', 'red')
  584. <
  585. This will override the colors of that part by using what is defined in that
  586. particular accent. In the above example, the `red` accent is used, which means
  587. regardless of which section the part is used in, it will have red foreground
  588. colors instead of the section's default foreground color.
  589. The following accents are defined by default. Themes can define their variants
  590. of the colors, but defaults will be provided if missing. >
  591. bold, italic, red, green, blue, yellow, orange, purple
  592. <
  593. The defaults configure the mode and line number parts to be bold, and the
  594. readonly part to be red.
  595. ------------------------------------- *airline-sections*
  596. Once a part is defined, you can use helper functions to generate the
  597. statuslines for each section. For example, to use the part above, we could
  598. define a section like this: >
  599. function! AirlineInit()
  600. let g:airline_section_a = airline#section#create(['mode', ' ', 'foo'])
  601. let g:airline_section_b = airline#section#create_left(['ffenc','file'])
  602. let g:airline_section_c = airline#section#create(['%{getcwd()}'])
  603. endfunction
  604. autocmd User AirlineAfterInit call AirlineInit()
  605. <
  606. This will create a section with the `mode`, followed by a space, and our `foo`
  607. part in section `a`. Section `b` will have two parts with a left-side
  608. separator. And section `c` will contain the current path. You may notice that
  609. the space and cwd are not defined parts. For convenience, if a part of that
  610. key does not exist, it will be inserted as is. The unit tests will be a good
  611. resource for possibilities.
  612. Note: The use of |VimEnter| is important, because most extensions are lazily
  613. loaded, so we must give them a chance to define their parts before we can use
  614. them.
  615. Note: The `airline#section#create` function and friends will do its best to
  616. create a section with the appropriate separators, but it only works for
  617. function and text parts. Special 'statusline' items like %f or raw/undefined
  618. parts will not work as it is not possible to inspect their widths/contents
  619. before rendering to the statusline.
  620. ==============================================================================
  621. FUNCREFS *airline-funcrefs*
  622. vim-airline internally uses funcrefs to integrate with third party plugins,
  623. and you can tap into this functionality to extend it for you needs. This is
  624. the most powerful way to customize the statusline, and sometimes it may be
  625. easier to go this route than the above methods.
  626. Every section can have two values. The default value is the global `g:`
  627. variable which is used in the absence of a `w:` value. This makes it very easy
  628. to override only certain parts of the statusline by only defining window-local
  629. variables for a subset of all sections.
  630. ------------------------------------- *add_statusline_func*
  631. The following is an example of how you can extend vim-airline to support a
  632. new plugin. >
  633. function! MyPlugin(...)
  634. if &filetype == 'MyPluginFileType'
  635. let w:airline_section_a = 'MyPlugin'
  636. let w:airline_section_b = '%f'
  637. let w:airline_section_c = '%{MyPlugin#function()}'
  638. let g:airline_variable_referenced_in_statusline = 'foo'
  639. endif
  640. endfunction
  641. call airline#add_statusline_func('MyPlugin')
  642. <
  643. Notice that only the left side of the statusline is overwritten. This means
  644. the right side (the line/column numbers, etc) will be intact.
  645. ------------------------------------- *remove_statusline_func*
  646. You can also remove a function as well, which is useful for when you want a
  647. temporary override. >
  648. call airline#remove_statusline_func('MyPlugin')
  649. <
  650. ==============================================================================
  651. PIPELINE *airline-pipeline*
  652. Sometimes you want to do more than just use overrides. The statusline funcref
  653. is invoked and passed two arguments. The first of these arguments is the
  654. statusline builder. You can use this to build completely custom statuslines
  655. to your liking. Here is an example: >
  656. >
  657. function! MyPlugin(...)
  658. " first variable is the statusline builder
  659. let builder = a:1
  660. " WARNING: the API for the builder is not finalized and may change
  661. call builder.add_section('Normal', '%f')
  662. call builder.add_section('WarningMsg', '%{getcwd()}')
  663. call builder.split()
  664. call builder.add_section('airline_z', '%p%%')
  665. " tell the core to use the contents of the builder
  666. return 1
  667. endfunction
  668. <
  669. The above example uses various example highlight groups to demonstrate
  670. that you can use any combination from the loaded colorscheme. However, if
  671. you want colors to change between modes, you should use one of the section
  672. highlight groups, e.g. `airline_a` and `airline_b`.
  673. The second variable is the context, which is a dictionary containing various
  674. values such as whether the statusline is active or not, and the window number.
  675. >
  676. context = {
  677. 'winnr': 'the window number for the statusline',
  678. 'active': 'whether the window is active or not',
  679. 'bufnr': 'the current buffer for this window',
  680. }
  681. <
  682. ------------------------------------- *airline-pipeline-return-codes*
  683. The pipeline accepts various return codes and can be used to determine the
  684. next action. The following are the supported codes: >
  685. 0 the default, continue on with the next funcref
  686. -1 do not modify the statusline
  687. 1 modify the statusline with the current contents of the builder
  688. <
  689. Note: Any value other than 0 will halt the pipeline and prevent the next
  690. funcref from executing.
  691. ==============================================================================
  692. WRITING EXTENSIONS *airline-writing-extensions*
  693. For contributions into the plugin, here are the following guidelines:
  694. 1. For simple 'filetype' checks, they can be added directly into the
  695. `extensions.vim` file.
  696. 2. Pretty much everything else should live as a separate file under the
  697. `extensions/` directory.
  698. a. Inside `extensions.vim`, add a check for some variable or command that
  699. is always available (these must be defined in `plugin/`, and _not_
  700. `autoload/` of the other plugin). If it exists, then initialize the
  701. extension. This ensures that the extension is loaded if and only if the
  702. user has the other plugin installed. Also, a check to
  703. `airline#extensions#foo_plugin#enabled` should be performed to allow the
  704. user to disable it.
  705. b. Configuration variables for the extension should reside in the
  706. extension, e.g. `g:airline#extensions#foo_plugin#bar_variable`.
  707. See the source of |example.vim| for documented code of how to write one.
  708. Looking at the other extensions is also a good resource.
  709. ==============================================================================
  710. WRITING THEMES *airline-themes*
  711. Themes are written "close to the metal" -- you will need to know some basic
  712. VimL syntax to write a theme, but if you've written in any programming
  713. language before it will be easy to pick up.
  714. The |dark.vim| theme fully documents this procedure and will guide you through
  715. the process. The |jellybeans.vim| theme is another example of how to write a
  716. theme, but instead of manually declaring colors, it extracts the values from
  717. highlight groups.
  718. ==============================================================================
  719. TROUBLESHOOTING *airline-troubleshooting*
  720. Q. There are no colors.
  721. A. You need to set up your terminal correctly. For more details, see
  722. <http://vim.wikia.com/wiki/256_colors_in_vim>. Alternatively, if you want
  723. to bypass the automatic detection of terminal colors, you can force Vim
  724. into 256 color mode with this: >
  725. set t_Co=256
  726. <
  727. Q. The statusline does not appear until I create a split.
  728. A. This is the default setting of 'laststatus'. If you want it to appear all
  729. the time, add the following to your vimrc: >
  730. set laststatus=2
  731. <
  732. Q. Powerline symbols are not showing up.
  733. A. First, you must install patched powerline fonts. Second, you must enable
  734. unicode in vim. >
  735. set encoding=utf-8
  736. <
  737. Q. There is a pause when leaving insert mode.
  738. A. Add the following to your vimrc. >
  739. set ttimeoutlen=50
  740. <
  741. Q. The colors look a little off for some themes.
  742. A. Certain themes are derived from the active colorscheme by extracting colors
  743. from predefined highlight groups. These airline themes will look good for
  744. their intended matching colorschemes, but will be hit or miss when loaded
  745. with other colorschemes.
  746. Solutions to other common problems can be found in the Wiki:
  747. <https://github.com/bling/vim-airline/wiki/FAQ>
  748. ==============================================================================
  749. CONTRIBUTIONS *airline-contributions*
  750. Contributions and pull requests are welcome.
  751. ==============================================================================
  752. LICENSE *airline-license*
  753. MIT License. Copyright © 2013-2015 Bailey Ling.
  754. vim:tw=78:ts=8:ft=help:norl: