Updated vim plugins

pull/327/head
amix 6 years ago
parent 48a2c325c3
commit 391f8b5c06
  1. 22
      sources_non_forked/ctrlp.vim/autoload/ctrlp.vim
  2. 2
      sources_non_forked/ctrlp.vim/autoload/ctrlp/buffertag.vim
  3. 13
      sources_non_forked/ctrlp.vim/autoload/ctrlp/line.vim
  4. 2
      sources_non_forked/lightline.vim/LICENSE
  5. 752
      sources_non_forked/lightline.vim/README.md
  6. 92
      sources_non_forked/lightline.vim/doc/lightline.txt
  7. 9
      sources_non_forked/nerdtree/CHANGELOG
  8. 33
      sources_non_forked/nerdtree/autoload/nerdtree.vim
  9. 40
      sources_non_forked/nerdtree/autoload/nerdtree/ui_glue.vim
  10. 82
      sources_non_forked/nerdtree/doc/NERD_tree.txt
  11. 117
      sources_non_forked/nerdtree/lib/nerdtree/bookmark.vim
  12. 2
      sources_non_forked/nerdtree/lib/nerdtree/creator.vim
  13. 31
      sources_non_forked/nerdtree/lib/nerdtree/path.vim
  14. 406
      sources_non_forked/nerdtree/lib/nerdtree/tree_dir_node.vim
  15. 4
      sources_non_forked/nerdtree/lib/nerdtree/ui.vim
  16. 2
      sources_non_forked/nerdtree/plugin/NERD_tree.vim
  17. 15
      sources_non_forked/syntastic/autoload/syntastic/preprocess.vim
  18. 23
      sources_non_forked/syntastic/autoload/syntastic/util.vim
  19. 26
      sources_non_forked/syntastic/doc/syntastic-checkers.txt
  20. 2
      sources_non_forked/syntastic/plugin/syntastic.vim
  21. 44
      sources_non_forked/syntastic/syntax_checkers/coffee/coffee_jshint.vim
  22. 1
      sources_non_forked/syntastic/syntax_checkers/css/csslint.vim
  23. 6
      sources_non_forked/syntastic/syntax_checkers/lisp/clisp.vim
  24. 1
      sources_non_forked/vim-abolish/.gitignore
  25. 1
      sources_non_forked/vim-abolish/CONTRIBUTING.markdown
  26. 150
      sources_non_forked/vim-abolish/README.markdown
  27. 181
      sources_non_forked/vim-abolish/doc/abolish.txt
  28. 631
      sources_non_forked/vim-abolish/plugin/abolish.vim
  29. 2
      sources_non_forked/vim-fugitive/README.markdown
  30. 8
      sources_non_forked/vim-fugitive/doc/fugitive.txt
  31. 89
      sources_non_forked/vim-fugitive/plugin/fugitive.vim
  32. 4
      sources_non_forked/vim-gitgutter/README.mkd
  33. 70
      sources_non_forked/vim-go/CHANGELOG.md
  34. 169
      sources_non_forked/vim-go/autoload/go/cmd.vim
  35. 2
      sources_non_forked/vim-go/autoload/go/complete.vim
  36. 14
      sources_non_forked/vim-go/autoload/go/coverage.vim
  37. 4
      sources_non_forked/vim-go/autoload/go/def.vim
  38. 4
      sources_non_forked/vim-go/autoload/go/doc.vim
  39. 26
      sources_non_forked/vim-go/autoload/go/fmt.vim
  40. 16
      sources_non_forked/vim-go/autoload/go/fmt_test.vim
  41. 3
      sources_non_forked/vim-go/autoload/go/guru.vim
  42. 4
      sources_non_forked/vim-go/autoload/go/impl.vim
  43. 2
      sources_non_forked/vim-go/autoload/go/jobcontrol.vim
  44. 20
      sources_non_forked/vim-go/autoload/go/lint.vim
  45. 2
      sources_non_forked/vim-go/autoload/go/list.vim
  46. 30
      sources_non_forked/vim-go/autoload/go/package.vim
  47. 13
      sources_non_forked/vim-go/autoload/go/path.vim
  48. 2
      sources_non_forked/vim-go/autoload/go/play.vim
  49. 4
      sources_non_forked/vim-go/autoload/go/statusline.vim
  50. 11
      sources_non_forked/vim-go/autoload/go/template.vim
  51. 5
      sources_non_forked/vim-go/autoload/go/term.vim
  52. 13
      sources_non_forked/vim-go/autoload/go/test-fixtures/fmt/imports/goimports.go
  53. 15
      sources_non_forked/vim-go/autoload/go/test-fixtures/fmt/imports/goimports_golden.go
  54. 12
      sources_non_forked/vim-go/autoload/go/test-fixtures/fmt/imports/vendor/gh.com/gi/foo-logging/logger.go
  55. 1
      sources_non_forked/vim-go/autoload/go/test-fixtures/fmt/src/imports
  56. 287
      sources_non_forked/vim-go/autoload/go/test.vim
  57. 10
      sources_non_forked/vim-go/autoload/go/util.vim
  58. 112
      sources_non_forked/vim-go/doc/vim-go.txt
  59. 4
      sources_non_forked/vim-go/ftplugin/go.vim
  60. 15
      sources_non_forked/vim-go/ftplugin/go/commands.vim
  61. 6
      sources_non_forked/vim-go/ftplugin/go/mappings.vim
  62. 1
      sources_non_forked/vim-go/scripts/test.sh
  63. 2
      sources_non_forked/vim-go/syntax/go.vim
  64. 7
      sources_non_forked/vim-go/templates/hello_world_test.go
  65. 2
      sources_non_forked/vim-multiple-cursors/README.md
  66. 1
      sources_non_forked/vim-snippets/.gitignore
  67. 8
      sources_non_forked/vim-snippets/UltiSnips/blade.snippets
  68. 186
      sources_non_forked/vim-snippets/UltiSnips/javascript-jasmine-arrow.snippets
  69. 234
      sources_non_forked/vim-snippets/UltiSnips/javascript-jasmine.snippets
  70. 6
      sources_non_forked/vim-snippets/UltiSnips/sh.snippets
  71. 12
      sources_non_forked/vim-snippets/snippets/elixir.snippets
  72. 26
      sources_non_forked/vim-snippets/snippets/go.snippets
  73. 2
      sources_non_forked/vim-snippets/snippets/haml.snippets
  74. 5
      sources_non_forked/vim-snippets/snippets/javascript.es6.react.snippets
  75. 175
      sources_non_forked/vim-snippets/snippets/javascript/javascript-jasmine.snippets
  76. 5
      sources_non_forked/vim-snippets/snippets/markdown.snippets
  77. 4
      sources_non_forked/vim-snippets/snippets/python.snippets
  78. 10
      sources_non_forked/vim-snippets/snippets/rust.snippets
  79. 43
      sources_non_forked/vim-snippets/snippets/tex.snippets
  80. 184
      sources_non_forked/vim-snippets/snippets/vue.snippets
  81. 1
      update_plugins.py
  82. 2
      vimrcs/plugins_config.vim

@ -569,9 +569,14 @@ endf
fu! s:MatchedItems(items, pat, limit)
let exc = exists('s:crfilerel') ? s:crfilerel : ''
let items = s:narrowable() ? s:matched + s:mdata[3] : a:items
if s:matcher != {}
let matcher = s:getextvar('matcher')
if empty(matcher) || type(matcher) != 4 || !has_key(matcher, 'match')
unlet matcher
let matcher = s:matcher
en
if matcher != {}
let argms =
\ has_key(s:matcher, 'arg_type') && s:matcher['arg_type'] == 'dict' ? [{
\ has_key(matcher, 'arg_type') && matcher['arg_type'] == 'dict' ? [{
\ 'items': items,
\ 'str': a:pat,
\ 'limit': a:limit,
@ -580,7 +585,7 @@ fu! s:MatchedItems(items, pat, limit)
\ 'crfile': exc,
\ 'regex': s:regexp,
\ }] : [items, a:pat, a:limit, s:mmode(), s:ispath, exc, s:regexp]
let lines = call(s:matcher['match'], argms, s:matcher)
let lines = call(matcher['match'], argms, matcher)
el
let lines = s:MatchIt(items, a:pat, a:limit, exc)
en
@ -1196,7 +1201,7 @@ fu! s:AcceptSelection(action)
let type = exttype == 'dict' ? exttype : 'list'
en
en
let actargs = type == 'dict' ? [{ 'action': md, 'line': line, 'icr': icr }]
let actargs = type == 'dict' ? [{ 'action': md, 'line': line, 'icr': icr, 'input': str}]
\ : [md, line]
cal call(actfunc, actargs)
endf
@ -1873,6 +1878,11 @@ fu! s:highlight(pat, grp)
en
cal matchadd('CtrlPLinePre', '^>')
elseif !empty(a:pat) && s:regexp &&
\ exists('g:ctrlp_regex_always_higlight') &&
\ g:ctrlp_regex_always_higlight
let pat = substitute(a:pat, '\\\@<!\^', '^> \\zs', 'g')
cal matchadd(a:grp, ( s:martcs == '' ? '\c' : '\C').pat)
en
endf
@ -2494,7 +2504,9 @@ endf
fu! s:getextvar(key)
if s:itemtype >= len(s:coretypes) && len(g:ctrlp_ext_vars) > 0
let vars = g:ctrlp_ext_vars[s:itemtype - len(s:coretypes)]
retu has_key(vars, a:key) ? vars[a:key] : -1
if has_key(vars, a:key)
retu vars[a:key]
en
en
retu get(g:, 'ctrlp_' . s:matchtype . '_' . a:key, -1)
endf

@ -139,7 +139,7 @@ fu! s:exectags(cmd)
endf
fu! s:exectagsonfile(fname, ftype)
let [ags, ft] = ['-f - --sort=no --excmd=pattern --fields=nKs --extra= ', a:ftype]
let [ags, ft] = ['-f - --sort=no --excmd=pattern --fields=nKs --extra= --file-scope=yes ', a:ftype]
if type(s:types[ft]) == 1
let ags .= s:types[ft]
let bin = s:bin

@ -13,6 +13,7 @@ let g:loaded_ctrlp_line = 1
cal add(g:ctrlp_ext_vars, {
\ 'init': 'ctrlp#line#init(s:crbufnr)',
\ 'accept': 'ctrlp#line#accept',
\ 'act_farg' : 'dict',
\ 'lname': 'lines',
\ 'sname': 'lns',
\ 'type': 'tabe',
@ -50,11 +51,17 @@ fu! ctrlp#line#init(bufnr)
retu lines
endf
fu! ctrlp#line#accept(mode, str)
let info = matchlist(a:str, '\t|[^|]\+|\(\d\+\):\(\d\+\)|$')
fu! ctrlp#line#accept(dict)
let mode = a:dict['action']
let str = a:dict['line']
let input = a:dict['input']
let info = matchlist(str, '\t|[^|]\+|\(\d\+\):\(\d\+\)|$')
let bufnr = str2nr(get(info, 1))
if bufnr
cal ctrlp#acceptfile(a:mode, bufnr, get(info, 2))
cal ctrlp#acceptfile(mode, bufnr, get(info, 2))
let @/ = input
call search(input, 'c')
call histadd("search", input)
en
endf

@ -1,6 +1,6 @@
The MIT License (MIT)
Copyright (c) 2013-2016 itchyny
Copyright (c) 2013-2017 itchyny
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

@ -1,42 +1,47 @@
# lightline.vim
A light and configurable statusline/tabline for Vim
A light and configurable statusline/tabline plugin for Vim
https://github.com/itchyny/lightline.vim
### powerline theme (default)
### powerline (default)
![lightline.vim - powerline](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/powerline/0.png)
![lightline.vim - powerline](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/powerline.png)
### wombat (with the patched font)
### wombat
![lightline.vim - wombat](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/wombat/0.png)
![lightline.vim - wombat](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/wombat.png)
### jellybeans (with the patched font)
### jellybeans
![lightline.vim - jellybeans](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/jellybeans/0.png)
![lightline.vim - jellybeans](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/jellybeans.png)
### solarized theme (dark)
### solarized dark
![lightline.vim - solarized_dark](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/solarized_dark/0.png)
![lightline.vim - solarized_dark](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/solarized_dark.png)
### solarized theme (light)
### solarized light
![lightline.vim - solarized_light](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/solarized_light/0.png)
![lightline.vim - solarized_light](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/solarized_light.png)
### PaperColor theme (light)
### PaperColor light
![lightline.vim - PaperColor](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/PaperColor/0.png)
![lightline.vim - PaperColor](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/PaperColor.png)
### seoul256 theme
### seoul256
![lightline.vim - seoul256](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/seoul256/0.png)
![lightline.vim - seoul256](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/seoul256.png)
### landscape theme (with the patched font)
### Dracula
![lightline.vim - landscape](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/landscape/0.png)
![lightline.vim - Dracula](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/Dracula.png)
With branch name, read-only mark and modified mark.
![lightline.vim - landscape - fugitive](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/landscape/5.png)
### one
![lightline.vim - one](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/one.png)
### landscape
![lightline.vim - landscape](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/landscape.png)
landscape is my colorscheme, which is a high-contrast cui-supported colorscheme, available at https://github.com/itchyny/landscape.vim
@ -46,553 +51,293 @@ landscape is my colorscheme, which is a high-contrast cui-supported colorscheme,
+ [vim-airline](https://github.com/bling/vim-airline) is a nice plugin, but it uses too much functions of other plugins, which should be done by users in `.vimrc`.
## Spirit of this plugin
+ Minimalism. The core script is very small.
+ Configurability. You can create your own component and easily add to the statusline/tabline.
+ Orthogonality. Any plugin should not change the settings of another plugin. Such plugin-crossing settings should be written by users in `.vimrc`.
## Author
itchyny (https://github.com/itchyny)
## License
This software is released under the MIT License, see LICENSE.
+ Minimalism. The core script is very small to achive enough functions as a statusline plugin.
+ Configurability. You can create your own component and easily add to the statusline and the tabline.
+ Orthogonality. The plugin does not rely on the implementation of other plugins. Such plugin crossing settings should be configured by users.
## Installation
### Manually
1. Put all files under $VIM.
### Pathogen
### [Pathogen](https://github.com/tpope/vim-pathogen)
1. Install with the following command.
git clone https://github.com/itchyny/lightline.vim ~/.vim/bundle/lightline.vim
### Vundle (https://github.com/VundleVim/Vundle.vim)
### [Vundle](https://github.com/VundleVim/Vundle.vim)
1. Add the following configuration to your `.vimrc`.
Plugin 'itchyny/lightline.vim'
2. Install with `:PluginInstall`.
### NeoBundle (https://github.com/Shougo/neobundle.vim)
### [NeoBundle](https://github.com/Shougo/neobundle.vim)
1. Add the following configuration to your `.vimrc`.
NeoBundle 'itchyny/lightline.vim'
2. Install with `:NeoBundleInstall`.
### vim-plug (https://github.com/junegunn/vim-plug)
### [vim-plug](https://github.com/junegunn/vim-plug)
1. Add the following configuration to your `.vimrc`.
Plug 'itchyny/lightline.vim'
2. Install with `:PlugInstall`.
## Configuration tutorial
By default, the statusline looks like:
## Introduction
After installing this plugin, you restart the editor and will get a cool statusline.
![lightline.vim - tutorial](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/tutorial/1.png)
If you use the wombat colorscheme, add the following settings to your `.vimrc` (or \_vimrc on Windows):
```vim
let g:lightline = {
\ 'colorscheme': 'wombat',
\ }
```
to get:
![lightline.vim - tutorial](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/tutorial/2.png)
The color of the statusline changes due to the mode of Vim. Try typing something, selecting in visual mode and replacing some texts.
If your statusline looks like
If the statusline looks like
![lightline.vim - tutorial](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/tutorial/21.png)
and the cool statuslines appear only on `:vsp`, add
add the following configuration to your `.vimrc`.
```vim
set laststatus=2
```
to your `.vimrc`.
If you have problem like
If the statusline does not be coloured like
![lightline.vim - tutorial](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/tutorial/20.png)
then add
then modify `TERM` in your shell configuration (`.zshrc` for example)
```sh
export TERM=xterm-256color
```
to your `.*shrc` and add
and then add the following configure to your `.vimrc`.
```vim
if !has('gui_running')
set t_Co=256
endif
```
to your `.vimrc`.
Your statusline appears to work correctly? If yes, great, thanks for choosing lightline.vim! If no, please file a issue report to the [issue tracker](https://github.com/itchyny/lightline.vim/issues).
If the colors of the statusline do not change from the default colors, move the settings of `g:lightline` before setting the colorscheme.
If you are reloading your `.vimrc` via `autocmd` and get this problem
![lightline.vim - tutorial](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/tutorial/20.png)
when saving it you need to add the nested flag to your `autocmd` like so
By the way, `-- INSERT --` is unnecessary anymore because the mode information is displayed in the statusline.
![lightline.vim - tutorial](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/tutorial/13.png)
If you want to get rid of it, configure as follows.
```vim
augroup reload_vimrc
autocmd!
autocmd bufwritepost $MYVIMRC nested source $MYVIMRC
augroup END
set noshowmode
```
## Colorscheme configuration
The lightline.vim plugin provides multiple colorschemes to meet your editor colorscheme.
Do not be confused, editor colorscheme rules how codes look like in buffers and lightline.vim has independent colorscheme feature, which rules how the statusline looks like.
Colors appear correctly? Now let's see how to change the appearance.
You may think that the default read-only mark is not so cool:
![lightline.vim - tutorial](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/tutorial/3.png)
Then edit the read-only component.
The lightline components are stored in `g:lightline.component`.
So you add the settings of `g:lightline.component.readonly` in your `.vimrc`. (the following settings are effective with the patched font for vim-powerline):
If you are using wombat colorscheme, add the following setting to your `.vimrc`,
```vim
let g:lightline = {
\ 'colorscheme': 'wombat',
\ 'component': {
\ 'readonly': '%{&readonly?"⭤":""}',
\ }
\ }
```
![lightline.vim - tutorial](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/tutorial/4.png)
How nice!
restart Vim and the statusline looks like:
But the boundaries are quadrilateral. You may miss the powerline.
You have installed a cool font for powerlines, so you can use it.
```vim
let g:lightline = {
\ 'colorscheme': 'wombat',
\ 'component': {
\ 'readonly': '%{&readonly?"⭤":""}',
\ },
\ 'separator': { 'left': '⮀', 'right': '⮂' },
\ 'subseparator': { 'left': '⮁', 'right': '⮃' }
\ }
```
![lightline.vim - tutorial](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/tutorial/5.png)
![lightline.vim - tutorial](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/tutorial/2.png)
Hurrah! Cool!
If the colors of the statusline do not change, move the settings of `g:lightline` before setting the editor colorscheme.
There are many lightline colorschemes available as screenshots shown above. See `:h g:lightline.colorscheme` for the complete list.
If your statusline looks like:
![lightline.vim - tutorial](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/tutorial/16.png)
## Advanced configuration
The default appearance of lightline.vim is carefully designed that the tutorial is enough here for most people.
So please read this section if you really want to configure and enjoy the configurability of lightline.vim.
the patched font is not installed.
Sometimes people want to display information of other plugins.
For example git branch information, syntax check errors and some statuses of plugins.
There are two kinds of patched fonts:
The lightline.vim plugin does not provide any plugin integration by default.
This plugin considers orthogonality to be one of the important ideas, which means that the plugin does not rely on implementation of other plugins.
Once a plugin starts to integrate with some famous plugins, it should be kept updated to follow the changes of the plugins, and should accept integration requests with new plugins and it will suffer from performance regression due to plugin availability checks.
+ The patched fonts for [vim-powerline](https://github.com/Lokaltog/vim-powerline): see https://github.com/Lokaltog/vim-powerline/tree/develop/fontpatcher
+ The patched fonts for [powerline](https://github.com/Lokaltog/powerline): see https://github.com/Lokaltog/powerline-fonts
Instead, lightline.vim provides a simple API that user can easily integrate with other plugins.
Once you understand how to configure and how it will be displayed in the statusline, you can also tell how to integrate with your favorite plugins.
Create or download a font and install it.
And add the `guifont` setting to your `.vimrc` (see `:help 'guifont'` for more detail).
If you are using the vim in a terminal, the font cannot be controlled in `.vimrc`.
Open the setting of the terminal and select the patched font.
Let's start to configure the appearance.
The statusline is composed by multiple components.
It shows the current mode, filename, modified status on the left, and file format, encoding, filetype and cursor positions on the right.
So in order to add something in the statusline, you firstly create a new component and specify the place.
This tutorial is based on the former, the font for vim-powerline (Inconsolata for Powerline).
If you have installed the patched font for powerline, use the following settings instead.
This is the hello world of lightline.vim component.
```vim
let g:lightline = {
\ 'colorscheme': 'wombat',
\ 'component': {
\ 'readonly': '%{&readonly?"":""}',
\ 'active': {
\ 'left': [ [ 'mode', 'paste' ],
\ [ 'readonly', 'filename', 'modified', 'helloworld' ] ]
\ },
\ 'separator': { 'left': '', 'right': '' },
\ 'subseparator': { 'left': '', 'right': '' }
\ }
```
![lightline.vim - tutorial](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/tutorial/19.png)
If you have installed the font for powerline and your statusline looks like
![lightline.vim - tutorial](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/tutorial/18.png)
remove
```vim
set ambiwidth=double
```
from your `.vimrc`. If you want to keep this setting, use the patched font for vim-powerline.
+ https://github.com/Lokaltog/vim-powerline/tree/develop/fontpatcher
If you will not install a patched font, use ascii characters like:
```vim
let g:lightline = {
\ 'colorscheme': 'wombat',
\ 'component': {
\ 'readonly': '%{&readonly?"x":""}',
\ 'helloworld': 'Hello, world!'
\ },
\ 'separator': { 'left': '', 'right': '' },
\ 'subseparator': { 'left': '|', 'right': '|' }
\ }
```
![lightline.vim - tutorial](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/tutorial/17.png)
If the triangles do not appear (but you get some spaces or weird characters like &lt;bf&gt; or ¿), firstly try adding
```vim
set encoding=utf-8
scriptencoding utf-8
```
to the head of your `.vimrc`.
Still you have weird characters, use the unicode numbers. For powerline font
users:
```vim
\ 'separator': { 'left': "\ue0b0", 'right': "\ue0b2" },
\ 'subseparator': { 'left': "\ue0b1", 'right': "\ue0b3" }
```
For vim-powerline font users:
```vim
\ 'separator': { 'left': "\u2b80", 'right': "\u2b82" },
\ 'subseparator': { 'left': "\u2b81", 'right': "\u2b83" }
```
Almost all of things go well with the patched font but if the triangle looks weird:
![lightline.vim - tutorial](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/tutorial/22.png)
If you are using iTerm2, change the following settings of iTerm2:
+ set `Profiles>Colors>Minimum contrast` to the Lowest.
+ set `Profiles>Window>Transparency` to the Opaquest.
For other terminals, this weird-triangle problem will be resolved by disabling transparency or contrast adjustment.
If you want to get rid of the extraneous default vim mode information that is now provided by lightline:
![lightline.vim - showmode](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/showmode.png)
```vim
set noshowmode
```
The statusline will look like:
![lightline.vim - tutorial](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/tutorial/3.png)
Now, let's get back to the tutorial (with the patched font for vim-powerline).
You look into a help file to find the marks annoying.
You have succeeded in displaying `Hello, world!` in the statusline.
The `helloworld` component is added to `g:lightline.active.left` and its content is configured in `g:lightline.component`.
The component contents are simply added to `&statusline`.
Try `:echo &statusline`, it might be a little bit complicated, but you will find `Hello, world!` somewhere.
![lightline.vim - tutorial](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/tutorial/6.png)
Help files are read-only and no-modifiable? We know that!
OK, so you again edit the components.
You can use `'statusline'` syntax for lightline.vim components.
Consult `:h 'statusline'` to see what's available here.
For example, if you want to print the value of character under the cursor in hexadecimal, configure as
```vim
let g:lightline = {
\ 'colorscheme': 'wombat',
\ 'component': {
\ 'readonly': '%{&filetype=="help"?"":&readonly?"⭤":""}',
\ 'modified': '%{&filetype=="help"?"":&modified?"+":&modifiable?"":"-"}'
\ 'active': {
\ 'left': [ [ 'mode', 'paste' ],
\ [ 'readonly', 'filename', 'modified', 'charvaluehex' ] ]
\ },
\ 'separator': { 'left': '⮀', 'right': '⮂' },
\ 'subseparator': { 'left': '⮁', 'right': '⮃' }
\ }
```
![lightline.vim - tutorial](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/tutorial/7.png)
Huh? Weird!
The subseparators are visible even if the components are empty.
In order to hide the subseparators, you can set expressions to `g:lightline.component_visible_condition`, which should be 1 only when the corresponding component is not empty.
```vim
let g:lightline = {
\ 'colorscheme': 'wombat',
\ 'component': {
\ 'readonly': '%{&filetype=="help"?"":&readonly?"⭤":""}',
\ 'modified': '%{&filetype=="help"?"":&modified?"+":&modifiable?"":"-"}'
\ },
\ 'component_visible_condition': {
\ 'readonly': '(&filetype!="help"&& &readonly)',
\ 'modified': '(&filetype!="help"&&(&modified||!&modifiable))'
\ 'charvaluehex': '0x%B'
\ },
\ 'separator': { 'left': '⮀', 'right': '⮂' },
\ 'subseparator': { 'left': '⮁', 'right': '⮃' }
\ }
```
![lightline.vim - tutorial](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/tutorial/8.png)
Okay. It works nice.
The configuration `component_visible_condition` is used to control the visibility of the subseparators.
You cannot use this variable to control the visibility of the components themselves.
![lightline.vim - tutorial](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/tutorial/4.png)
How does lightline decide the components to show in the statusline?
It's very simple.
The variables to select components are `g:lightline.active.left` and `g:lightline.active.right`.
For example, you add the `g:lightline.active.left` in `.vimrc`.
You want the character value information on the right hand side? OK, configure as
```vim
let g:lightline = {
\ 'colorscheme': 'wombat',
\ 'active': {
\ 'left': [ [ 'mode', 'paste' ],
\ [ 'readonly', 'filename', 'modified' ] ]
\ 'right': [ [ 'lineinfo' ],
\ [ 'percent' ],
\ [ 'fileformat', 'fileencoding', 'filetype', 'charvaluehex' ] ]
\ },
\ 'component': {
\ 'readonly': '%{&filetype=="help"?"":&readonly?"⭤":""}',
\ 'modified': '%{&filetype=="help"?"":&modified?"+":&modifiable?"":"-"}'
\ 'charvaluehex': '0x%B'
\ },
\ 'component_visible_condition': {
\ 'readonly': '(&filetype!="help"&& &readonly)',
\ 'modified': '(&filetype!="help"&&(&modified||!&modifiable))'
\ },
\ 'separator': { 'left': '⮀', 'right': '⮂' },
\ 'subseparator': { 'left': '⮁', 'right': '⮃' }
\ }
```
If the plugin arranges all the components (in a situation you `set paste` and the file `.vimrc` is read-only, try to modify):
![lightline.vim - tutorial](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/tutorial/9.png)
Again look into `g:lightline.active.left`.
```vim
let g:lightline = {
\ 'active': {
\ 'left': [ [ 'mode', 'paste' ],
\ [ 'readonly', 'filename', 'modified' ] ] ...
```
The mode and paste component are displayed in the same group.
The read-only, filename and modified component are in the second group.
It corresponds to the structure of `g:lightline.active.left`.
You can configure the components in the statusline by the following four variables:
+ `g:lightline.active.left`
+ `g:lightline.active.right`
+ `g:lightline.inactive.left`
+ `g:lightline.inactive.right`
![lightline.vim - tutorial](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/tutorial/5.png)
Of course, your configurations in `.vimrc` have priority over the default settings in lightline.
We have learned how to add a simple component.
- See `:h 'statusline'` to check the statusline flags.
- Add a new component to `g:lightline.component`.
- Add the component name to `g:lightline.active.left` or `g:lightline.active.right`.
You can also configure the statusline of inactive buffers by adding the component to `g:lightline.inactive.left` or `g:lightline.inactive.right`.
Git branch is important for us.
And it is a default component in [powerline](https://github.com/Lokaltog/powerline) and [vim-powerline](https://github.com/Lokaltog/vim-powerline).
However, lightline does not provide the branch feature by default.
In order to show the branch in the statusline, you firstly install the [vim-fugitive](https://github.com/tpope/vim-fugitive) plugin.
Then edit the `g:lightline` in your `.vimrc`.
+ Add your fugitive component to `g:lightline.component`.
+ Add the condition when the fugitive component has information to `g:lightline.component_visible_condition`.
+ Add the component by inserting `'fugitive'` to `g:lightline.active.left`.
Now let's add some integrations with other plugin.
The name of the git branch is important these days.
But lightline.vim does not provide this information by default because it is also one of plugin crossing configurations, and not all people want the integration.
In order to show the branch name in the statusline, install some plugins which provides the branch information.
The [vim-fugitive](https://github.com/tpope/vim-fugitive) plugin is a famous plugin so let's integrate lightline.vim with it.
If you don't like to install full git integration but just want to display the branch name in the statusline, you can use the [vim-gitbranch](https://github.com/itchyny/vim-gitbranch) plugin which provides `gitbranch#name` function.
```vim
let g:lightline = {
\ 'colorscheme': 'wombat',
\ 'active': {
\ 'left': [ [ 'mode', 'paste' ],
\ [ 'fugitive', 'readonly', 'filename', 'modified' ] ]
\ },
\ 'component': {
\ 'readonly': '%{&filetype=="help"?"":&readonly?"⭤":""}',
\ 'modified': '%{&filetype=="help"?"":&modified?"+":&modifiable?"":"-"}',
\ 'fugitive': '%{exists("*fugitive#head")?fugitive#head():""}'
\ [ 'gitbranch', 'readonly', 'filename', 'modified' ] ]
\ },
\ 'component_visible_condition': {
\ 'readonly': '(&filetype!="help"&& &readonly)',
\ 'modified': '(&filetype!="help"&&(&modified||!&modifiable))',
\ 'fugitive': '(exists("*fugitive#head") && ""!=fugitive#head())'
\ 'component_function': {
\ 'gitbranch': 'fugitive#head'
\ },
\ 'separator': { 'left': '⮀', 'right': '⮂' },
\ 'subseparator': { 'left': '⮁', 'right': '⮃' }
\ }
```
![lightline.vim - tutorial](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/tutorial/12.png)
![lightline.vim - tutorial](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/tutorial/6.png)
Okay, the branch component is added!
Okay, now the statusline shows that we are coding at the master branch.
What do we learn from this example?
- Find out the function which is suitable to use in the statusline.
- Create a function component. The previous `charvaluehex` component has `'statusline'` item configuration and registered in `g:lightline.component`. In the current example, we register the name of the function in `g:lightline.component_function`. It should return the string to be displayed in the statusline.
- Add the component name `gitbranch` to `g:lightline.active.left` or `g:lightline.active.right`.
Now, you might get tired of setting both `'component'` and `'component_visible_condition'`.
Or if you want to do something more complicated?
Here we have leaned two kinds of components.
- component: it has a `%`-prefixed item which you can find the meaning at `:h 'statusline'`. All the default components of lightline.vim are components in this style. See the default components at `:h g:lightline.component`.
- function component: the name of functions are registered. The function is called again and again so be careful not to register a heavy function. See the help with `:h g:lightline.component_function`.
In fact, the components can be created using functions.
Add your function names for components to `g:lightline.component_function`.
The function component is an important design for the configurability of lightline.vim.
By providing the configuration interface via functions, you can adjust the statusline information as you wish.
For the proof, let's look into some configuration examples in Q&amp;A style.
### Can I hide the readonly component in the help buffer?
Yes, create a function component for `readonly`.
The configuration of function component has priority over the default component.
```vim
let g:lightline = {
\ 'colorscheme': 'wombat',
\ 'active': {
\ 'left': [ [ 'mode', 'paste' ],
\ [ 'fugitive', 'readonly', 'filename', 'modified' ] ]
\ },
\ 'component_function': {
\ 'fugitive': 'LightlineFugitive',
\ 'readonly': 'LightlineReadonly',
\ 'modified': 'LightlineModified'
\ },
\ 'separator': { 'left': '⮀', 'right': '⮂' },
\ 'subseparator': { 'left': '⮁', 'right': '⮃' }
\ }
function! LightlineModified()
if &filetype == "help"
return ""
elseif &modified
return "+"
elseif &modifiable
return ""
else
return ""
endif
function! LightlineReadonly()
return &readonly && &filetype !=# 'help' ? 'RO' : ''
endfunction
```
![lightline.vim - tutorial](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/tutorial/7.png)
### Can I hide the readonly component in other plugins buffer?
Yes, modify the `LightlineReadonly` function as you wish.
```vim
function! LightlineReadonly()
if &filetype == "help"
return ""
elseif &readonly
return "⭤"
else
return ""
endif
return &readonly && &filetype !~# '\v(help|vimfiler|unite)' ? 'RO' : ''
endfunction
function! LightlineFugitive()
return exists('*fugitive#head') ? fugitive#head() : ''
endfunction
let g:unite_force_overwrite_statusline = 0
let g:vimfiler_force_overwrite_statusline = 0
```
![lightline.vim - tutorial](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/tutorial/13.png)
Fine and readable!
![lightline.vim - tutorial](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/tutorial/8.png)
Finally, you come up with concatenating the three components: the read-only mark, the filename and the modified mark.
Now you may know what to do.
### Can I display the plugin information at the filename component?
Yes, overwrite the filename component.
```vim
let g:lightline = {
\ 'colorscheme': 'wombat',
\ 'active': {
\ 'left': [ [ 'mode', 'paste' ],
\ [ 'fugitive', 'filename' ] ]
\ },
\ 'component_function': {
\ 'fugitive': 'LightlineFugitive',
\ 'readonly': 'LightlineReadonly',
\ 'modified': 'LightlineModified',
\ 'filename': 'LightlineFilename'
\ 'filename': 'LightlineFilename',
\ },
\ 'separator': { 'left': '⮀', 'right': '⮂' },
\ 'subseparator': { 'left': '⮁', 'right': '⮃' }
\ }
function! LightlineModified()
if &filetype == "help"
return ""
elseif &modified
return "+"
elseif &modifiable
return ""
else
return ""
endif
endfunction
function! LightlineReadonly()
if &filetype == "help"
return ""
elseif &readonly
return "⭤"
else
return ""
endif
endfunction
function! LightlineFugitive()
return exists('*fugitive#head') ? fugitive#head() : ''
endfunction
function! LightlineFilename()
return ('' != LightlineReadonly() ? LightlineReadonly() . ' ' : '') .
\ ('' != expand('%:t') ? expand('%:t') : '[No Name]') .
\ ('' != LightlineModified() ? ' ' . LightlineModified() : '')
return &filetype ==# 'vimfiler' ? vimfiler#get_status_string() :
\ &filetype ==# 'unite' ? unite#get_status_string() :
\ &filetype ==# 'vimshell' ? vimshell#get_status_string() :
\ expand('%:t') !=# '' ? expand('%:t') : '[No Name]'
endfunction
```
![lightline.vim - tutorial](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/tutorial/14.png)
Oops! We forgot the cool mark for the branch component! (work with the patched font for vim-powerline)
```vim
function! LightlineFugitive()
if exists("*fugitive#head")
let branch = fugitive#head()
return branch !=# '' ? '⭠ '.branch : ''
endif
return ''
endfunction
let g:unite_force_overwrite_statusline = 0
let g:vimfiler_force_overwrite_statusline = 0
let g:vimshell_force_overwrite_statusline = 0
```
![lightline.vim - tutorial](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/tutorial/15.png)
How cool!!!
![lightline.vim - tutorial](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/tutorial/9.png)
Of course, you can name your component as you wish.
### Can I display the plugin name at the mode component?
Yes, overwrite the mode component.
```vim
let g:lightline = {
\ 'active': {
\ 'left': [ [ 'mode', 'paste' ],
\ [ 'my_component' ] ] },
\ 'component_function': {
\ 'my_component': 'LightlineComponent', ...
```
This is the end of the tutorial. For more information, see `:help lightline`. Good luck with your nice statuslines.
### Cool characters for the patched fonts
\ 'component_function': {
\ 'mode': 'LightlineMode',
\ },
\ }
Symbol | Default | powerline | vim-powerline
------------------ | ------- | ------------- | -------------
separator.left | '' | '' (\ue0b0) | '⮀' (\u2b80)
separator.right | '' | '' (\ue0b2) | '⮂' (\u2b82)
subseparator.left | '\|' | '' (\ue0b1) | '⮁' (\u2b81)
subseparator.right | '\|' | '' (\ue0b3) | '⮃' (\u2b83)
branch symbol | -- | '' (\ue0a0) | '⭠' (\u2b60)
readonly symbol | -- | '' (\ue0a2) | '⭤' (\u2b64)
linecolumn symbol | -- | '' (\ue0a1) | '⭡' (\u2b61)
function! LightlineMode()
return expand('%:t') ==# '__Tagbar__' ? 'Tagbar':
\ expand('%:t') ==# 'ControlP' ? 'CtrlP' :
\ &filetype ==# 'unite' ? 'Unite' :
\ &filetype ==# 'vimfiler' ? 'VimFiler' :
\ &filetype ==# 'vimshell' ? 'VimShell' :
\ lightline#mode()
endfunction
```
![lightline.vim - tutorial](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/tutorial/10.png)
### My settings
I show my settings. I use the patched font for vim-powerline.
### Can I trim the file format and encoding information on narrow windows?
Yes, check `winwidth(0)` and return empty string with some threshold.
```vim
let g:lightline = {
\ 'colorscheme': 'landscape',
\ 'mode_map': { 'c': 'NORMAL' },
\ 'active': {
\ 'left': [ [ 'mode', 'paste' ], [ 'fugitive', 'filename' ] ]
\ },
\ 'component_function': {
\ 'modified': 'LightlineModified',
\ 'readonly': 'LightlineReadonly',
\ 'fugitive': 'LightlineFugitive',
\ 'filename': 'LightlineFilename',
\ 'fileformat': 'LightlineFileformat',
\ 'filetype': 'LightlineFiletype',
\ 'fileencoding': 'LightlineFileencoding',
\ 'mode': 'LightlineMode',
\ },
\ 'separator': { 'left': '⮀', 'right': '⮂' },
\ 'subseparator': { 'left': '⮁', 'right': '⮃' }
\ }
function! LightlineModified()
return &ft =~ 'help\|vimfiler\|gundo' ? '' : &modified ? '+' : &modifiable ? '' : '-'
endfunction
function! LightlineReadonly()
return &ft !~? 'help\|vimfiler\|gundo' && &readonly ? '⭤' : ''
endfunction
function! LightlineFilename()
return ('' != LightlineReadonly() ? LightlineReadonly() . ' ' : '') .
\ (&ft == 'vimfiler' ? vimfiler#get_status_string() :
\ &ft == 'unite' ? unite#get_status_string() :
\ &ft == 'vimshell' ? vimshell#get_status_string() :
\ '' != expand('%:t') ? expand('%:t') : '[No Name]') .
\ ('' != LightlineModified() ? ' ' . LightlineModified() : '')
endfunction
function! LightlineFugitive()
if &ft !~? 'vimfiler\|gundo' && exists("*fugitive#head")
let branch = fugitive#head()
return branch !=# '' ? '⭠ '.branch : ''
endif
return ''
endfunction
function! LightlineFileformat()
return winwidth(0) > 70 ? &fileformat : ''
endfunction
@ -600,170 +345,34 @@ endfunction
function! LightlineFiletype()
return winwidth(0) > 70 ? (&filetype !=# '' ? &filetype : 'no ft') : ''
endfunction
function! LightlineFileencoding()
return winwidth(0) > 70 ? (&fenc !=# '' ? &fenc : &enc) : ''
endfunction
function! LightlineMode()
return winwidth(0) > 60 ? lightline#mode() : ''
endfunction
```
When the current window width is narrow, the mode component and the file information component collapse.
For example, the [gundo](https://github.com/sjl/gundo.vim) buffer is narrow.
Before:
![lightline.vim - gundo](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/gundo0.png)
After:
![lightline.vim - gundo](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/gundo1.png)
Nice looking, isn't it?
### For power users
For users who uses following plugins.
- [CtrlP](https://github.com/kien/ctrlp.vim)
- [Tagbar](https://github.com/majutsushi/tagbar)
- [Gundo](http://github.com/sjl/gundo.vim)
- [NERDtree](http://github.com/scrooloose/nerdtree)
- [Syntastic](https://github.com/scrooloose/syntastic)
- [unite.vim](https://github.com/Shougo/unite.vim)
- [vimfiler.vim](https://github.com/Shougo/vimfiler.vim)
- [vimshell.vim](https://github.com/Shougo/vimshell.vim)
![lightline.vim - tutorial](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/tutorial/11.png)
### Can I trim the bar between the filename and modified sign?
Yes, by joining the two components.
```vim
let g:lightline = {
\ 'colorscheme': 'wombat',
\ 'active': {
\ 'left': [ [ 'mode', 'paste' ], [ 'fugitive', 'filename' ], ['ctrlpmark'] ],
\ 'right': [ [ 'syntastic', 'lineinfo' ], ['percent'], [ 'fileformat', 'fileencoding', 'filetype' ] ]
\ 'left': [ [ 'mode', 'paste' ],
\ [ 'readonly', 'filename' ] ],
\ },
\ 'component_function': {
\ 'fugitive': 'LightlineFugitive',
\ 'filename': 'LightlineFilename',
\ 'fileformat': 'LightlineFileformat',
\ 'filetype': 'LightlineFiletype',
\ 'fileencoding': 'LightlineFileencoding',
\ 'mode': 'LightlineMode',
\ 'ctrlpmark': 'CtrlPMark',
\ },
\ 'component_expand': {
\ 'syntastic': 'SyntasticStatuslineFlag',
\ },
\ 'component_type': {
\ 'syntastic': 'error',
\ },
\ 'subseparator': { 'left': '|', 'right': '|' }
\ }
function! LightlineModified()
return &ft =~ 'help' ? '' : &modified ? '+' : &modifiable ? '' : '-'
endfunction
function! LightlineReadonly()
return &ft !~? 'help' && &readonly ? 'RO' : ''
endfunction
function! LightlineFilename()
let fname = expand('%:t')
return fname == 'ControlP' && has_key(g:lightline, 'ctrlp_item') ? g:lightline.ctrlp_item :
\ fname == '__Tagbar__' ? g:lightline.fname :
\ fname =~ '__Gundo\|NERD_tree' ? '' :
\ &ft == 'vimfiler' ? vimfiler#get_status_string() :
\ &ft == 'unite' ? unite#get_status_string() :
\ &ft == 'vimshell' ? vimshell#get_status_string() :
\ ('' != LightlineReadonly() ? LightlineReadonly() . ' ' : '') .
\ ('' != fname ? fname : '[No Name]') .
\ ('' != LightlineModified() ? ' ' . LightlineModified() : '')
endfunction
function! LightlineFugitive()
try
if expand('%:t') !~? 'Tagbar\|Gundo\|NERD' && &ft !~? 'vimfiler' && exists('*fugitive#head')
let mark = '' " edit here for cool mark
let branch = fugitive#head()
return branch !=# '' ? mark.branch : ''
endif
catch
endtry
return ''
endfunction
function! LightlineFileformat()
return winwidth(0) > 70 ? &fileformat : ''
endfunction
function! LightlineFiletype()
return winwidth(0) > 70 ? (&filetype !=# '' ? &filetype : 'no ft') : ''
endfunction
function! LightlineFileencoding()
return winwidth(0) > 70 ? (&fenc !=# '' ? &fenc : &enc) : ''
endfunction
function! LightlineMode()
let fname = expand('%:t')
return fname == '__Tagbar__' ? 'Tagbar' :
\ fname == 'ControlP' ? 'CtrlP' :
\ fname == '__Gundo__' ? 'Gundo' :
\ fname == '__Gundo_Preview__' ? 'Gundo Preview' :
\ fname =~ 'NERD_tree' ? 'NERDTree' :
\ &ft == 'unite' ? 'Unite' :
\ &ft == 'vimfiler' ? 'VimFiler' :
\ &ft == 'vimshell' ? 'VimShell' :
\ winwidth(0) > 60 ? lightline#mode() : ''
endfunction
function! CtrlPMark()
if expand('%:t') =~ 'ControlP' && has_key(g:lightline, 'ctrlp_item')
call lightline#link('iR'[g:lightline.ctrlp_regex])
return lightline#concatenate([g:lightline.ctrlp_prev, g:lightline.ctrlp_item
\ , g:lightline.ctrlp_next], 0)
else
return ''
endif
endfunction
let g:ctrlp_status_func = {
\ 'main': 'CtrlPStatusFunc_1',
\ 'prog': 'CtrlPStatusFunc_2',
\ }
function! CtrlPStatusFunc_1(focus, byfname, regex, prev, item, next, marked)
let g:lightline.ctrlp_regex = a:regex
let g:lightline.ctrlp_prev = a:prev
let g:lightline.ctrlp_item = a:item
let g:lightline.ctrlp_next = a:next
return lightline#statusline(0)
endfunction
function! CtrlPStatusFunc_2(str)
return lightline#statusline(0)
endfunction
let g:tagbar_status_func = 'TagbarStatusFunc'
function! TagbarStatusFunc(current, sort, fname, ...) abort
let g:lightline.fname = a:fname
return lightline#statusline(0)
let filename = expand('%:t') !=# '' ? expand('%:t') : '[No Name]'
let modified = &modified ? ' +' : ''
return filename . modified
endfunction
augroup AutoSyntastic
autocmd!
autocmd BufWritePost *.c,*.cpp call s:syntastic()
augroup END
function! s:syntastic()
SyntasticCheck
call lightline#update()
endfunction
let g:unite_force_overwrite_statusline = 0
let g:vimfiler_force_overwrite_statusline = 0
let g:vimshell_force_overwrite_statusline = 0
```
![lightline.vim - tutorial](https://raw.githubusercontent.com/wiki/itchyny/lightline.vim/image/tutorial/12.png)
### Note for developers of other plugins
You can control the visibility and contents by writing simple functions.
Now you notice how much function component is important for the configurability of lightline.vim.
## Note for developers of other plugins
Appearance consistency matters.
The statusline is an important space for Vim users.
@ -771,9 +380,14 @@ Overwriting the statusline forcibly in your plugin is not a good idea.
It is not hospitality, but just an annoying feature.
If your plugin has such a feature, add an option to be modest.
A good design is the following.
A good design is as follows.
Firstly, give the users a clue to judge which buffer is the one your plugin creates.
The filename is a manner and the filetype is another.
Then, export a function which is useful to be shown in the statusline.
Lastly, for advanced users, set important information in buffer variables.
So that the users can obtain the condition of the plugin easily.
Lastly, for advanced users, set important information in buffer variables so that the users can obtain the condition of the plugin easily.
## Author
itchyny (https://github.com/itchyny)
## License
This software is released under the MIT License, see LICENSE.

@ -4,7 +4,7 @@ Version: 0.1
Author: itchyny (https://github.com/itchyny)
License: MIT License
Repository: https://github.com/itchyny/lightline.vim
Last Change: 2016/10/24 08:12:28.
Last Change: 2017/05/28 01:07:02.
CONTENTS *lightline-contents*
@ -29,39 +29,40 @@ The *lightline* plugin is a light and configurable statusline/tabline for Vim.
SPIRIT *lightline-spirit*
Minimalism
The core script is very small.
The core script is very small to achive enough functions as a
statusline plugin.
Configurability
You can create your own component and easily add to the
statusline/tabline.
You can create your own component and easily add to the statusline
and the tabline.
Orthogonality
Any plugin should not change the settings of another plugin.
Such plugin-crossing settings should be written by users in
.vimrc.
You might find this plugin is not so useful by default. This plugin
does not provide the branch information, which is a very basic
component in existing plugins. The reason is that branch component is
one of plugin-crossing settings so users should write the settings
using the APIs of the both plugins. Hospitality makes a plugin messy.
Good APIs keep a plugin clean.
The plugin does not rely on the implementation of other plugins.
Such plugin crossing settings should be configured by users.
You find this plugin does not integrate with other plugins by default.
This plugin does not provide branch information, which is a basic
component in existing statusline plugins. It is a design of
lightline.vim that such plugin crossing configuration should be
written by users. Once a plugin starts to integrate with some famous
plugins, it should be kept updated to follow the changes of the
plugins and should accept integration requests with new plugins.
Instead, lightline.vim is designed very carefully so that users can
easily integrate with other plugins. Good APIs keep a plugin clean.
------------------------------------------------------------------------------
OPTIONS *lightline-option*
g:lightline *g:lightline*
All the options are stored into this global variable.
All the configurations are stored in this global variable.
g:lightline.active *g:lightline.active*
g:lightline.inactive *g:lightline.inactive*
g:lightline.tabline *g:lightline.tabline*
Dictionaries to specify the statusline/tabline components.
The components are gathered from either |g:lightline.component|,
|g:lightline.component_function| or
|g:lightline.component_expand|.
Dictionaries to store the statusline/tabline components.
Note that right groups of components are stored from right to
left. The default values are:
left.
The default values are:
>
let g:lightline.active = {
\ 'left': [ [ 'mode', 'paste' ],
@ -78,10 +79,7 @@ OPTIONS *lightline-option*
\ 'right': [ [ 'close' ] ] }
<
g:lightline.tab *g:lightline.tab*
Dictionaries to specify the components in each tabs.
The components are gathered from either
|g:lightline.tab_component| or
|g:lightline.tab_component_function|.
A dictionary to store the tab components in each tabs.
The default values are:
>
let g:lightline.tab = {
@ -89,7 +87,7 @@ OPTIONS *lightline-option*
\ 'inactive': [ 'tabnum', 'filename', 'modified' ] }
<
g:lightline.component *g:lightline.component*
Dictionary for statusline/tabline components.
A dictionary for statusline/tabline components.
The default value is:
>
let g:lightline.component = {
@ -116,11 +114,11 @@ OPTIONS *lightline-option*
<
g:lightline.component_visible_condition
*g:lightline.component_visible_condition*
Dictionary to store the visible condition of the components.
Each expression should correspond to the condition each
component is not empty. This configuration is used to control
the visibility of the subseparators. You cannot use this
configuration to control the visibility of the components.
A dictionary to store the visible condition of the components.
Note that this configuration is used to control the visibility
of the subseparators, not to control the visibility of the
components themselves. Each expression should correspond to
the condition on which each component is not empty.
The default value is:
>
let g:lightline.component_visible_condition = {
@ -129,52 +127,47 @@ OPTIONS *lightline-option*
\ 'paste': '&paste',
\ 'spell': '&spell' }
<
Users are recommended to set this option together with the
component itself.
g:lightline.component_function *g:lightline.component_function*
Another dictionary for components. This is more convenient
because the user does not have to set both component and
component_visible_condition. If a component set to both component and
component_function, the setting of component_function has priority.
A dictionary to store the function components.
This is useful to write a complex component configuration and
to integrate with other plugins. If a component set in both
component and component_function, the configuration of
component_function has priority.
The default value is:
>
let g:lightline.component_function = {}
<
For example, if you want a component for read-only mark, which
disappears in help windows:
For example, if you want to display the name of the git branch,
install |vim-fugitive| plugin and then configure as:
>
let g:lightline = {
\ 'active': {
\ 'left': [ [ 'mode', 'paste' ],
\ [ 'myreadonly', 'filename', 'modified' ] ],
\ [ 'gitbranch', 'readonly', 'filename', 'modified' ] ]
\ },
\ 'component_function': {
\ 'myreadonly': 'LightlineReadonly'
\ 'gitbranch': 'fugitive#head'
\ },
\ }
function! LightlineReadonly()
return &ft !~? 'help' && &readonly ? 'RO' : ''
endfunction
<
g:lightline.component_function_visible_condition
*g:lightline.component_function_visible_condition*
Dictionary to store the visible conditions of the function
A dictionary to store the visible conditions of the function
components. Each expression should correspond to the condition
each component is not empty. This configuration is used to
control the visibility of the subseparators. You can use this
configuration to reduce the number of function calls for
function components by setting the value 1 (to tell lightline
performance improvement by setting the value 1 (to tell lightline
that the component is always visible).
The default value is:
>
let g:lightline.component_function_visible_condition = {}
<
g:lightline.component_expand *g:lightline.component_expand*
Another dictionary for components. You can create a component
which has a special color. For example, error components or
warning components. The functions should return one of:
A dictionary to store expanding components. You can create
warning and critical components. The values should be the name
of functions should return either one of:
+ a string
+ an array of three elements:
[[ left ], [ middle ], [ right ]]
@ -281,7 +274,6 @@ OPTIONS *lightline-option*
\ 'tabline': 1
\ }
<
==============================================================================
FONT *lightline-font*
You can use the patched font you used for |vim-powerline| and |powerline|.

@ -1,4 +1,13 @@
Next
- Update doc with already existing mapping variables (asnr) #699
- Fix the broken g:NERDTreeBookmarksSort setting (lifecrisis) #696
- Correct NERDTreeIgnore pattern in doc (cntoplolicon) #648
- Remove empty segments when splitting path (sooth-sayer) #574
- Suppress autocmds less agressively (wincent) #578 #691
- Add an Issues template to ask for more info initially.
- Fix markdown headers in readme (josephfrazier) #676
- Don't touch @o and @h registers when rendering
- Fix bug with files and directories with dollar signs (alegen) #649
- Reuse/reopen existing window trees where possible #244
- Remove NERDTree.previousBuf()
- Change color of arrow (Leeiio) #630

@ -52,11 +52,6 @@ function! nerdtree#completeBookmarks(A,L,P)
return filter(g:NERDTreeBookmark.BookmarkNames(), 'v:val =~# "^' . a:A . '"')
endfunction
"FUNCTION: nerdtree#compareBookmarks(dir) {{{2
function! nerdtree#compareBookmarks(first, second)
return a:first.compareTo(a:second)
endfunction
"FUNCTION: nerdtree#compareNodes(dir) {{{2
function! nerdtree#compareNodes(n1, n2)
return a:n1.path.compareTo(a:n2.path)
@ -64,9 +59,33 @@ endfunction
"FUNCTION: nerdtree#compareNodesBySortKey(n1, n2) {{{2
function! nerdtree#compareNodesBySortKey(n1, n2)
if a:n1.path.getSortKey() <# a:n2.path.getSortKey()
let sortKey1 = a:n1.path.getSortKey()
let sortKey2 = a:n2.path.getSortKey()
let i = 0
while i < min([len(sortKey1), len(sortKey2)])
" Compare chunks upto common length.
" If chunks have different type, the one which has
" integer type is the lesser.
if type(sortKey1[i]) == type(sortKey2[i])
if sortKey1[i] <# sortKey2[i]
return - 1
elseif sortKey1[i] ># sortKey2[i]
return 1
endif
elseif sortKey1[i] == type(0)
return -1
elseif sortKey2[i] == type(0)
return 1
endif
let i = i + 1
endwhile
" Keys are identical upto common length.
" The key which has smaller chunks is the lesser one.
if len(sortKey1) < len(sortKey2)
return -1
elseif a:n1.path.getSortKey() ># a:n2.path.getSortKey()
elseif len(sortKey1) > len(sortKey2)
return 1
else
return 0

@ -7,7 +7,7 @@ let g:loaded_nerdtree_ui_glue_autoload = 1
function! nerdtree#ui_glue#createDefaultBindings()
let s = '<SNR>' . s:SID() . '_'
call NERDTreeAddKeyMap({ 'key': '<MiddleRelease>', 'scope': "all", 'callback': s."handleMiddleMouse" })
call NERDTreeAddKeyMap({ 'key': '<MiddleMouse>', 'scope': 'all', 'callback': s . 'handleMiddleMouse' })
call NERDTreeAddKeyMap({ 'key': '<LeftRelease>', 'scope': "all", 'callback': s."handleLeftClick" })
call NERDTreeAddKeyMap({ 'key': '<2-LeftMouse>', 'scope': "DirNode", 'callback': s."activateDirNode" })
call NERDTreeAddKeyMap({ 'key': '<2-LeftMouse>', 'scope': "FileNode", 'callback': s."activateFileNode" })
@ -336,16 +336,22 @@ endfunction
" FUNCTION: s:handleMiddleMouse() {{{1
function! s:handleMiddleMouse()
let curNode = g:NERDTreeFileNode.GetSelected()
if curNode ==# {}
call nerdtree#echo("Put the cursor on a node first" )
" A middle mouse click does not automatically position the cursor as one
" would expect. Forcing the execution of a regular left mouse click here
" fixes this problem.
execute "normal! \<LeftMouse>"
let l:currentNode = g:NERDTreeFileNode.GetSelected()
if empty(l:currentNode)
call nerdtree#echoError('use the pointer to select a node')
return
endif
if curNode.path.isDirectory
call nerdtree#openExplorer(curNode)
if l:currentNode.path.isDirectory
call l:currentNode.openExplorer()
else
call curNode.open({'where': 'h'})
call l:currentNode.open({'where': 'h'})
endif
endfunction
@ -441,21 +447,19 @@ function! s:jumpToSibling(currentNode, forward)
endfunction
" FUNCTION: nerdtree#ui_glue#openBookmark(name) {{{1
" put the cursor on the given bookmark and, if its a file, open it
" Open the Bookmark that has the specified name. This function provides the
" implementation for the ":OpenBookmark" command.
function! nerdtree#ui_glue#openBookmark(name)
try
let targetNode = g:NERDTreeBookmark.GetNodeForName(a:name, 0, b:NERDTree)
call targetNode.putCursorHere(0, 1)
redraw!
catch /^NERDTree.BookmarkedNodeNotFoundError/
call nerdtree#echo("note - target node is not cached")
let bookmark = g:NERDTreeBookmark.BookmarkFor(a:name)
let targetNode = g:NERDTreeFileNode.New(bookmark.path, b:NERDTree)
let l:bookmark = g:NERDTreeBookmark.BookmarkFor(a:name)
catch /^NERDTree.BookmarkNotFoundError/
call nerdtree#echoError('bookmark "' . a:name . '" not found')
return
endtry
if targetNode.path.isDirectory
call targetNode.openExplorer()
if l:bookmark.path.isDirectory
call l:bookmark.open(b:NERDTree)
else
call targetNode.open({'where': 'p'})
call l:bookmark.open(b:NERDTree, {'where': 'p'})
endif
endfunction

@ -117,6 +117,10 @@ The following features and functionality are provided by the NERD tree:
again. If no NERD tree exists for this tab then this command acts the
same as the |:NERDTree| command.
:NERDTreeFocus *:NERDTreeFocus*
Opens (or reopens) the NERD Tree if it is not currently visible;
otherwise, the cursor is moved to the already-open NERD Tree.
:NERDTreeMirror *:NERDTreeMirror*
Shares an existing NERD tree, from another tab, in the current tab.
Changes made to one tree are reflected in both as they are actually the
@ -158,7 +162,7 @@ click bookmarks or use the |NERDTree-o| mapping to activate them. See also,
------------------------------------------------------------------------------
2.2.2. Bookmark commands *NERDTreeBookmarkCommands*
Note that the following commands are only available in the NERD tree buffer.
Note: The following commands are only available within the NERDTree buffer.
:Bookmark [<name>]
Bookmark the current node as <name>. If there is already a <name>
@ -178,10 +182,11 @@ Note that the following commands are only available in the NERD tree buffer.
(i.e. directory nodes above it will be opened) and the cursor will be
placed on it.
:OpenBookmark <bookmark>
<bookmark> must point to a file. The file is opened as though |NERDTree-o|
was applied. If the node is cached under the current root then it will be
revealed and the cursor will be placed on it.
:OpenBookmark <name>