Git Product home page Git Product logo

lightline.vim's Introduction

lightline.vim

A light and configurable statusline/tabline plugin for Vim

https://github.com/itchyny/lightline.vim

powerline (default)

lightline.vim - powerline

wombat

lightline.vim - wombat

solarized (background=dark)

lightline.vim - solarized_dark

solarized (background=light)

lightline.vim - solarized_light

PaperColor (background=dark)

lightline.vim - PaperColor_dark

PaperColor (background=light)

lightline.vim - PaperColor_light

one (background=dark)

lightline.vim - one_dark

one (background=light)

lightline.vim - one_light

For screenshots of all available colorshemes, see this file.

Why yet another clone of powerline?

  • vim-powerline is a nice plugin, but deprecated.
  • powerline is a nice plugin, but difficult to configure.
  • vim-airline is a nice plugin, but it uses too many functions of other plugins, which should be done by users in .vimrc.

Spirit of this plugin

  • Minimalism. The core script is very small to achieve 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

Vim packages (since Vim 7.4.1528)

  1. Clone the plugin with the following command.

     git clone https://github.com/itchyny/lightline.vim ~/.vim/pack/plugins/start/lightline
    
  1. Install with the following command.

     git clone https://github.com/itchyny/lightline.vim ~/.vim/bundle/lightline.vim
    
  2. Generate help tags with :Helptags.

  1. Add the following configuration to your .vimrc.

     Plugin 'itchyny/lightline.vim'
    
  2. Install with :PluginInstall.

  1. Add the following configuration to your .vimrc.

     NeoBundle 'itchyny/lightline.vim'
    
  2. Install with :NeoBundleInstall.

  1. Add the following configuration to your .vimrc.

     Plug 'itchyny/lightline.vim'
    
  2. Install with :PlugInstall.

  1. Add the following configuration to your .vimrc.

     call dein#add('itchyny/lightline.vim')
    
  2. Install with :call dein#install()

Introduction

After installing this plugin, you restart the editor and will get a cool statusline. lightline.vim - tutorial

The color of the statusline changes due to the mode of Vim. Try typing something, selecting in visual mode and replacing some texts.

If the statusline looks like lightline.vim - tutorial

add the following configuration to your .vimrc.

set laststatus=2

If the statusline is not coloured like lightline.vim - tutorial

then modify TERM in your shell configuration (.zshrc for example)

export TERM=xterm-256color

and then add the following configuration to your .vimrc.

if !has('gui_running')
  set t_Co=256
endif

Your statusline appears to work correctly? If yes, great, thanks for choosing lightline.vim! If no, please file an issue report to the issue tracker.

By the way, -- INSERT -- is unnecessary anymore because the mode information is displayed in the statusline. lightline.vim - tutorial If you want to get rid of it, configure as follows.

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.

If you are using wombat colorscheme, add the following setting to your .vimrc,

let g:lightline = {
      \ 'colorscheme': 'wombat',
      \ }

restart Vim and the statusline looks like:

lightline.vim - tutorial

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.

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.

Sometimes people want to display information of other plugins. For example git branch information, syntax check errors and some statuses of plugins.

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.

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.

Let's start to configure the appearance. The statusline is composed of 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 is the hello world of lightline.vim component.

let g:lightline = {
      \ 'colorscheme': 'wombat',
      \ 'active': {
      \   'left': [ [ 'mode', 'paste' ],
      \             [ 'readonly', 'filename', 'modified', 'helloworld' ] ]
      \ },
      \ 'component': {
      \   'helloworld': 'Hello, world!'
      \ },
      \ }

The statusline will look like: lightline.vim - tutorial

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.

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

let g:lightline = {
      \ 'colorscheme': 'wombat',
      \ 'active': {
      \   'left': [ [ 'mode', 'paste' ],
      \             [ 'readonly', 'filename', 'modified', 'charvaluehex' ] ]
      \ },
      \ 'component': {
      \   'charvaluehex': '0x%B'
      \ },
      \ }

lightline.vim - tutorial

You want the character value information on the right hand side? OK, configure as

let g:lightline = {
      \ 'colorscheme': 'wombat',
      \ 'active': {
      \   'right': [ [ 'lineinfo' ],
      \              [ 'percent' ],
      \              [ 'fileformat', 'fileencoding', 'filetype', 'charvaluehex' ] ]
      \ },
      \ 'component': {
      \   'charvaluehex': '0x%B'
      \ },
      \ }

lightline.vim - tutorial

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.

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 provide the branch information. The 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 plugin which provides gitbranch#name function.

let g:lightline = {
      \ 'colorscheme': 'wombat',
      \ 'active': {
      \   'left': [ [ 'mode', 'paste' ],
      \             [ 'gitbranch', 'readonly', 'filename', 'modified' ] ]
      \ },
      \ 'component_function': {
      \   'gitbranch': 'FugitiveHead'
      \ },
      \ }

lightline.vim - tutorial

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.

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.

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&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.

let g:lightline = {
      \ 'component_function': {
      \   'readonly': 'LightlineReadonly',
      \ },
      \ }

function! LightlineReadonly()
  return &readonly && &filetype !=# 'help' ? 'RO' : ''
endfunction

lightline.vim - tutorial

Can I hide the readonly component in other plugins buffer?

Yes, modify the LightlineReadonly function as you wish.

function! LightlineReadonly()
  return &readonly && &filetype !~# '\v(help|vimfiler|unite)' ? 'RO' : ''
endfunction

let g:unite_force_overwrite_statusline = 0
let g:vimfiler_force_overwrite_statusline = 0

lightline.vim - tutorial

Can I display the plugin information at the filename component?

Yes, overwrite the filename component.

let g:lightline = {
      \ 'component_function': {
      \   'filename': 'LightlineFilename',
      \ },
      \ }

function! LightlineFilename()
  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

let g:unite_force_overwrite_statusline = 0
let g:vimfiler_force_overwrite_statusline = 0
let g:vimshell_force_overwrite_statusline = 0

lightline.vim - tutorial

Can I display the plugin name at the mode component?

Yes, overwrite the mode component.

let g:lightline = {
      \ 'component_function': {
      \   'mode': 'LightlineMode',
      \ },
      \ }

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

Can I trim the file format and encoding information on narrow windows?

Yes, check winwidth(0) and return empty string with some threshold.

let g:lightline = {
      \ 'component_function': {
      \   'fileformat': 'LightlineFileformat',
      \   'filetype': 'LightlineFiletype',
      \ },
      \ }

function! LightlineFileformat()
  return winwidth(0) > 70 ? &fileformat : ''
endfunction

function! LightlineFiletype()
  return winwidth(0) > 70 ? (&filetype !=# '' ? &filetype : 'no ft') : ''
endfunction

lightline.vim - tutorial

Can I trim the bar between the filename and modified sign?

Yes, by joining the two components.

let g:lightline = {
      \ 'active': {
      \   'left': [ [ 'mode', 'paste' ],
      \             [ 'readonly', 'filename' ] ],
      \ },
      \ 'component_function': {
      \   'filename': 'LightlineFilename',
      \ },
      \ }

function! LightlineFilename()
  let filename = expand('%:t') !=# '' ? expand('%:t') : '[No Name]'
  let modified = &modified ? ' +' : ''
  return filename . modified
endfunction

lightline.vim - tutorial

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.

more tips

Mode names are too long. Can I use shorter mode names?

Yes, configure g:lightline.mode_map.

let g:lightline = {
      \ 'mode_map': {
        \ 'n' : 'N',
        \ 'i' : 'I',
        \ 'R' : 'R',
        \ 'v' : 'V',
        \ 'V' : 'VL',
        \ "\<C-v>": 'VB',
        \ 'c' : 'C',
        \ 's' : 'S',
        \ 'S' : 'SL',
        \ "\<C-s>": 'SB',
        \ 't': 'T',
        \ },
      \ }

How can I truncate the components from the right in narrow windows?

Please include %< to one of the right components.

let g:lightline = {
      \ 'component': {
      \   'lineinfo': '%3l:%-2v%<',
      \ },
      \ }

Where can I find the default components?

See :h g:lightline.component.

Note for developers of other plugins

Appearance consistency matters.

The statusline is an important space for Vim users. 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 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.

Author

itchyny (https://github.com/itchyny)

License

This software is released under the MIT License, see LICENSE.

lightline.vim's People

Contributors

4513echo avatar alexeyzab avatar antoinemadec avatar arcticicestudio avatar bryanforbes avatar challsted avatar chibicode avatar chrisvittal avatar danielpeng2 avatar ecklf avatar elig0n avatar ericbn avatar finch185277 avatar get-me-power avatar gregdel avatar harupong avatar itchyny avatar kkopec avatar lucasprag avatar mattn avatar nhooyr avatar rahulg avatar roylee avatar rsify avatar sheruost avatar srstevenson avatar ssayols avatar takegue avatar ulrikdem avatar zoltandalmadi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

lightline.vim's Issues

Unable to display special characters in patch font

Having downloaded and installed the patched inconsolata font for powerline and updated the lightline settings to use the special characters, I cannot get them to display in the statusline. The characters do display correctly in the separator settings, they do display correctly in Word and the Special Character app but just not in the status line. There they are display as inverted question marks (see image below). I am working on Win7 with gvim (portable; but that should be irrelevant I think).

My .vimrc section that covers lightline and color schemes:

let g:lightline = {
    \ 'colorscheme': 'solarized',
        \ 'active': {
        \   'left': [ [ 'mode', 'paste' ],
        \             [ 'readonly', 'filename', 'modified' ] ]
        \ },
    \ 'component': {
        \   'readonly': '%{&filetype=="help"?"":&readonly?"":""}',
        \   'modified': '%{&filetype=="help"?"":&modified?"+":&modifiable?"":"-"}'
    \ },
    \ 'component_visible_condition': {
        \   'readonly': '(&filetype!="help"&& &readonly)',
        \   'modified': '(&filetype!="help"&&(&modified||!&modifiable))'
        \ },
    \ 'separator': { 'left': '', 'right': '' },
    \ 'subseparator': { 'left': '', 'right': '' }
    \ }

set background=dark
"color ps_color
colorscheme solarized
let g:solarized_italic=0
let g:solarized_bold=0

Screenshot:

image

I would appreciate any help!

MacVim not displaying

The following is a screenshot of 2 vims. one in front is MacVim and terminal vim in back. Lightline shows well in terminal vim but it doesn't show in MacVim.

Is there anything I can do about it?

Thanks in advance.

In my .vimrc

"""""""""" for itchyne/lightline"""""""""
if !has('gui_running')
set t_Co=256
endif
set laststatus=2

let g:Powerline_symbols = 'fancy'
let g:lightline = {
\ 'colorscheme': 'wombat',
\ 'component': {
\ 'readonly': '%{&readonly?"":""}',
\ },
\ 'separator': { 'left': '', 'right': '' },
\ 'subseparator': { 'left': '', 'right': '' }
\ }

screen shot 2014-01-16 at 9 12 03

component type

let g:lightline = {
  \ 'active': {
  \   'right':  [ [ 'lineinfo', 'syntastic' ], ['percent'], [ 'fileformat', 'fileencoding', 'filetype'] ],
  \ },
  \ 'component_function': {
  \   'syntastic': 'SyntasticStatuslineFlag',
  \ },
  \ 'component_type': {
  \   'syntastic': 'error'
  \ }
  \ }

API to get lightline theme

I'm interested in an API for getting the current color palette of lightline. I'd like to use it for my tmuxline extension (and maybe prompt extension), so tmux can use lightline's colors (screenshot below).

I did a quick prototype of function lightline#palette() here https://github.com/edkolev/lightline.vim/commit/7b1c53a98736ad364e15138638fcc7c8f3489d62 which is used in tmuxline here edkolev/tmuxline.vim@1ec997f

BTW alternatively lightline's palette could be kept in a global g: variable

Would you be interested in adding such functionality to lightline?

tomorrow:
screen shot 2014-01-26 at 12 24 07 pm
landscape:
screen shot 2014-01-26 at 12 21 28 pm

Option to disabled automatic color conversion

I’m creating a custom colorscheme for Lightline in my vim colorscheme file

Thereby, I fill in hex numbers when I’m in (m|g)vim and cterm color numbers when I’m on the terminal. Lightline seems to convert the tuples [hexfg, hexbg] to [hexfg, hexbg, ctermfg, ctermbg] which breaks when the #hexfg|bg colors are already cterm color numbers.

It would be nice If I could disable that automatic conversion so that Lightline just uses the color values that I fill into the colorscheme.

tabline is disabled while using vimshell

Using C-c in vimshell disables the tabline of lightline.
Probably lightline#tabline and lightline#onetab are called too often.

To reproduce:

tabnew
:VimShell
sleep 10<CR>
<C-c>

Support for CtrlP

Do you have a solution for plugins like CtrlP or Tagbar that seem to overwrite the statusline when activated? I'm sure there is a way, can you point me in the right direction?

lightline covers :commands on vertical splits

When I perform a vertical split, lightline covers the line where I wrote the commands, so I can't see them, in the picture you can see some white pixels below lightline, those are some letters from the command I want to run.

lightvim_error

This picture was taken from gvim.

How to better highlight selected filter in CtrlP?

The filters in the CtrlP status line (with the "Power users" configuration) aren't highlighted; the middle filter is the active one, but I think it would be nice if, like the native CtrlP appearance, the middle filter were also highlighted.

How would I do this with lightline? The configuration options are a bit cryptic to me I have to admit.

Thanks.

solarized colorscheme partially not working

Hi,
I try to use lightline with solarized in vim. vim also uses solarized and runs in urxvt with solarized colors set in .Xresources (as recommended).
the colors for the current mode seem to be correct but the rest looks more like the wombat colorscheme.
sol

question about readme

hey, i see you're having fun writing a statusline plugin :-)

i just had a question about a particular line in your readme:

vim-airline is a nice plugin, but not configurable.

i'd like to know why you think that vim-airline is not configurable, because i don't think this is true.

thanks.

vim-bufferline integration

How would I go about integrating vim-bufferline to my statusline, somewhat similar to what is done in vim-airline?

I found a part about statusline integration, but not really sure how to do this for lightline so it updates when needed etc.

It doesn't have to change the background if selected and all that jazz, but being able to change the frontground and/or background color of the chosen buffer would definitely be a bonus.

I'd like to note that I like idea with lightline where usage of other plugins should be defined by the user instead letting the plugin do the "magic" or "hiding" it all in the plugin as is done in (vim-)powerline and airline. However adding things like the bufferline seems to be a bit tricky unless you're quite comfortable in vimscript.

Performance promise

Number of lines

  • plugin/lightline.vim under 100 lines
  • autoload/lightline.vim under 300 lines

Loading time (with my MBA)

  • sourcing plugin/lightline.vim under 0.3ms
  • sourcing autoload/lightline.vim under 1ms

Solarized colorscheme incorrectly set up depending on terminal

If using iTerm2 and have solarized terminal colors set up properly, many of the intended dark-green shades show as grey.

screen shot 2013-12-28 at 10 35 56 am

A quickfix is to use the 16color palette instead of the 256color one.

i.e.

let s:base03 = [ '#002b36', 8 ]
let s:base02 = [ '#073642', 0 ]
let s:base01 = [ '#586e75', 10 ]
let s:base00 = [ '#657b83', 11  ]

I really like that the colorscheme system is extensible, would you support having colorschemes linked in a wiki page or something?

Can't configure lightline.vim

I use Janus and I've just copied your config from README to my vimrc.after. However, my statusline looks the same, as if the config wasn't loaded.

E121: Undefined variable: v:key

Error detected while processing function lightline#update..lightline#statusline..51_line..51_subseparator:
line 2:
E121: Undefined variable: v:key

Corner cases

  1. colorscheme wombat
  2. so $MYVIMRC
  3. Gdiff, wincmd h, quit
  4. let g:lightline = { 'colorscheme': 'wombat' }, unlet g:lightline

Plus color in powerline coloroscheme

Hi,

I've found a small annoyance in the default (powerline) colorscheme. When you edit the current buffer the '+' sign is gray, while in the original vim-powerline is red, and much more visible.

powerline

lightline

Can you please make it red like in the original theme?

Is it possible to change the "PASTE" color in the colorscheme?

I was using the jellybeans colorscheme for a while and looks awesome, but when I toggle "paste", it blends with the "mode". It surely would be better if it could be another color.

Reading the docs, it seems that the closer thing is to do what the "Problem 12" states, but I don't know... maybe since "paste" it's some sort of "mode", maybe it could be manage from the colorscheme?

lightline changed NERDTree setting

when I open NERDTree in left side, the statusline is replaced by lightline, but I want just a buffer name, how can I set fir this.
And the width of my NERDTree buffer is changed by lightline, which makes it more wider.
I don't know it's an issue or just my setting(BUT I only use your lightline-powerful for setting lightline)

Tabs

Just opened my Vim and saw them. You are the best in the world and I can't thank you enough.

Performance issues, functions are called too often

After installing lightline.vim and adding some configuration, my vim started lagging. Using profiling I got two logs. During the time the profiler was on, I only typed one sentence and then I undid it. As you can see below, some lightline functions were called 25 or 50 times.


Without lightline.vim

FUNCTIONS SORTED ON TOTAL TIME

count total (s) self (s) function
30 0.007931 127_Highlight_Matching_Pair()
28 0.003997 176_PreviewCSSColorInLine()
2 0.000672 0.000262 eclim#util#ShowCurrentError()
2 0.000410 eclim#util#GetLineError()
1 0.000043 89_SetDefaultCompletionType()

FUNCTIONS SORTED ON SELF TIME

count total (s) self (s) function
30 0.007931 127_Highlight_Matching_Pair()
28 0.003997 176_PreviewCSSColorInLine()
2 0.000410 eclim#util#GetLineError()
2 0.000672 0.000262 eclim#util#ShowCurrentError()
1 0.000043 89_SetDefaultCompletionType()

With lightline.vim

FUNCTIONS SORTED ON TOTAL TIME

count total (s) self (s) function
50 0.029874 0.001043 MyFugitive()
50 0.028831 0.002655 fugitive#head()
50 0.021346 0.005445 64_repo_head()
25 0.018098 lightline#link()
50 0.009825 0.008881 64_repo_head_ref()
100 0.008955 64_repo()
50 0.005292 0.002083 MyFilename()
17 0.004239 128_Highlight_Matching_Pair()
4 0.002694 fugitive#reload_status()
50 0.001951 64_sub()
15 0.001934 181_PreviewCSSColorInLine()
78 0.001799 MyModified()
50 0.001410 MyReadonly()
50 0.000944 64_repo_dir()
2 0.000694 0.000262 eclim#util#ShowCurrentError()
25 0.000483 lightline#mode()
2 0.000432 eclim#util#GetLineError()
4 0.000296 144_UpdateNERDTree()
2 0.000055 lightline#update_once()
1 0.000043 89_SetDefaultCompletionType()

FUNCTIONS SORTED ON SELF TIME

count total (s) self (s) function
25 0.018098 lightline#link()
100 0.008955 64_repo()
50 0.009825 0.008881 64_repo_head_ref()
50 0.021346 0.005445 64_repo_head()
17 0.004239 128_Highlight_Matching_Pair()
4 0.002694 fugitive#reload_status()
50 0.028831 0.002655 fugitive#head()
50 0.005292 0.002083 MyFilename()
50 0.001951 64_sub()
15 0.001934 181_PreviewCSSColorInLine()
78 0.001799 MyModified()
50 0.001410 MyReadonly()
50 0.029874 0.001043 MyFugitive()
50 0.000944 64_repo_dir()
25 0.000483 lightline#mode()
2 0.000432 eclim#util#GetLineError()
4 0.000296 144_UpdateNERDTree()
2 0.000694 0.000262 eclim#util#ShowCurrentError()
2 0.000055 lightline#update_once()
1 0.000043 89_SetDefaultCompletionType()

Add a disable variable or 8 color compatible scheme?

Hello,
I think this status bar is very good. However, I am on archlinux and the colorschemes do not work well on the TTY console. Would it be possible to add a variable that allows me to disable lightline when using vim in the TTY console or, perhaps, add an 8 color compatible colorscheme?

Thanks!

Full path to a file if there's another tab with the same filename

For example I have two tabs opened: a/models.py and b/models.py. My conf currently shows only filename of the file opened in that tab. I would like to see path in this case because filenames are the same and otherwise I can't know in which file I am. Maybe a full path is an overkill, but 1st directory that differs would be just awesome! Any thoughts on this, on implementation?

Here's my current conf:

"
" Lightline next.
"

let g:lightline = {
      \ 'colorscheme': 'wombat',
      \ 'active': {
      \   'left': [ [ 'mode', 'paste' ], [ 'fugitive', 'filename' ], ['ctrlpmark', 'tagbar'] ],
      \   'right': [ [ 'syntastic', 'lineinfo' ], ['percent'], [ 'fileformat', 'fileencoding', 'filetype' ] ]
      \ },
      \ 'component_function': {
      \   'fugitive': 'MyFugitive',
      \   'filename': 'MyFilename',
      \   'fileformat': 'MyFileformat',
      \   'filetype': 'MyFiletype',
      \   'fileencoding': 'MyFileencoding',
      \   'mode': 'MyMode',
      \   'ctrlpmark': 'CtrlPMark',
      \ },
      \ 'component_expand': {
      \   'syntastic': 'SyntasticStatuslineFlag',
      \ },
      \ 'component_type': {
      \   'syntastic': 'error',
      \ },
      \ 'separator': { 'left': '⮀', 'right': '⮂' },
      \ 'subseparator': { 'left': '⮁', 'right': '⮃' },
      \ 'component': {
      \   'tagbar': '%{tagbar#currenttag("[%s]", "", "f")}',
      \ },
      \ }

function! MyModified()
  return &ft =~ 'help\|vimfiler\|gundo' ? '' : &modified ? '+' : &modifiable
         \ ? '' : '-'
endfunction

function! MyReadonly()
  return &ft !~? 'help\|vimfiler\|gundo' && &ro ? '<U+2B64>' : ''
endfunction

function! MyFilename()
  let fname = expand('%:t')
  return fname == 'ControlP' ? 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() :
        \ ('' != MyReadonly() ? MyReadonly() . ' ' : '') .
        \ ('' != fname ? fname : '[No Name]') .
        \ ('' != MyModified() ? ' ' . MyModified() : '')
endfunction

function! MyFugitive()
  try
    if expand('%:t') !~? 'Tagbar\|Gundo\|NERD' && &ft !~? 'vimfiler' && exists('*fugitive#head')
      let mark = '⭠ '
      let _ = fugitive#head()
      return strlen(_) ? mark._ : ''
    endif
  catch
  endtry
  return ''
endfunction

function! MyFileformat()
  return winwidth(0) > 70 ? &fileformat : ''
endfunction

function! MyFiletype()
  return winwidth(0) > 70 ? (strlen(&filetype) ? &filetype : 'no ft') : ''
endfunction

function! MyFileencoding()
  return winwidth(0) > 70 ? (strlen(&fenc) ? &fenc : &enc) : ''
endfunction

function! MyMode()
  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'
    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)
endfunction

augroup AutoSyntastic
  autocmd!
  autocmd BufWritePost * 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

Issues caused when a more than tab is open

I have been using lightline for a few days and observed the following quirks in the latest version:

  • When multiple tabs are open visual mode is disabled. I cannot or -v to select lines in any of the windows.
  • When multiple tabs are open the screen blinks a lot while scrolling. It's very hard on the eyes and makes it difficult to work with splits.

fix typos

英語ドキュメントには :set spell がオススメです。

diff --git a/README.md b/README.md
index 94cf3be..869fe78 100644
--- a/README.md
+++ b/README.md
@@ -77,7 +77,7 @@ MIT License
 ## Configuration tutorial
 In default, the statusline looks like:
 ![lightline.vim - tutorial](https://raw.github.com/itchyny/lightline.vim/master/image/tutorial/1.png)
-If you want a wombat colorscheme, add the folowing setting to your .vimrc (or \_vimrc in Windows):
+If you want a wombat colorscheme, add the following setting to your .vimrc (or \_vimrc in Windows):
 ```vim
   let g:lightline = {
         \ 'colorscheme': 'wombat',
@@ -138,7 +138,7 @@ Hurrah! Cool!


 Now, you look into a help file to find the marks annoying.
-Help files are read-only and no-modifiable? We know, of cource!
+Help files are read-only and no-modifiable? We know, of course!
 ![lightline.vim - tutorial](https://raw.github.com/itchyny/lightline.vim/master/image/tutorial/8.png)
 OK, so you again edit your .vimrc.
 ```vim
@@ -271,7 +271,7 @@ Define your own filename component. It has priority over the component lightline
 ![lightline.vim - tutorial](https://raw.github.com/itchyny/lightline.vim/master/image/tutorial/13.png)
 Looks nice.

-Of cource, you can name your component as you wish.
+Of course, you can name your component as you wish.
 ```vim
   let g:lightline = {
         \ 'active': {

Colors don't work with sessions

I have a simple configuration in my vimrc to work with sessions:

function! LoadSession()
    if argc() == 0
        silent source Session.vim
    end
endfunction

au VimLeave * mksession!
au VimEnter * call LoadSession()

When a session is loaded, the colors of lightline just dissapear.

Changing colorscheme on the fly

I have a shortcut for toggling Tomorrow and Tomorrow Night for my vim colorschemes. Wondering if there is any way to switch lightline color schemes in the middle of running vim.

I tried: let g:lightline.colorscheme = 'Tomorrow'

But it didn't work as 'Tomorrow Night' had been set when vim started...

component with error highlight

Something like

'component_type': {
  'syntastic': 'error'
},
'component_function': {
  'syntastic': 'SyntasticStatuslineFlag'
},
palette.normal.error = ...
palette.inactive.error = ...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.