itchyny / lightline.vim Goto Github PK
View Code? Open in Web Editor NEWA light and configurable statusline/tabline plugin for Vim
License: MIT License
A light and configurable statusline/tabline plugin for Vim
License: MIT License
let g:lightline = { 'colorscheme': 'wombat' }
, unlet g:lightline
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.
Vim 7.3.547 on Debian (wheezy)
Error detected while processing function lightline#onetab..lightline#tab#modified:
line 2:
E118: Too many arguments for function: gettabwinvar
Number of lines
Loading time (with my MBA)
I have been using lightline for a few days and observed the following quirks in the latest version:
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:
I would appreciate any help!
Hi,
Thanks for writing Lightline.
Noticed one issue. If Lightline is installed, the gVim intro splash screen that shows up the version name etc does not show.
If Lightline is removed, it comes back.
I am on gVim Version 7.4 (32 bit) on 64 bit Windows.
Error detected while processing function lightline#update..lightline#statusline..51_line..51_subseparator:
line 2:
E121: Undefined variable: v:key
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>
If using iTerm2 and have solarized terminal colors set up properly, many of the intended dark-green shades show as grey.
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?
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.
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?
Hi!
It would be great to have an option for disable powerline in preview windows. And perhaps in certain user defined ones too. I'd love to have at least sth like here in vim-airline:
https://github.com/bling/vim-airline/blob/master/doc/airline.txt#L106
What do you think?
Regards
szw
Looking for a way to turn off the new tabline styling while still keeping the statusline styling.
Something like
'component_type': {
'syntastic': 'error'
},
'component_function': {
'syntastic': 'SyntasticStatuslineFlag'
},
palette.normal.error = ...
palette.inactive.error = ...
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...
:so $MYVIMRC
It would be really cool if I could see in what method and class I'm in. It could use Ctags.
What do you think? :)
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.
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?
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
英語ドキュメントには :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': {
It's me. http://www.reddit.com/user/itchyny
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!
Hello,
I'm trying to add in the statusline of an undotree window the specific statusline generated by the plugin "undotree"
Below what I currently tried in a function :
\ &ft == 'undotree' ? (exists('*t:undotree.GetStatusLine') ? '%{t:undotree.GetStatusLine()}' : fname) :
For reference is it's how airline has done it (https://github.com/bling/vim-airline/blob/master/autoload/airline/extensions/undotree.vim)
let g:lightline = {
\ 'active': {
\ 'right': [ [ 'lineinfo', 'syntastic' ], ['percent'], [ 'fileformat', 'fileencoding', 'filetype'] ],
\ },
\ 'component_function': {
\ 'syntastic': 'SyntasticStatuslineFlag',
\ },
\ 'component_type': {
\ 'syntastic': 'error'
\ }
\ }
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.
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.
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?
How do I make lightline display buffer number together with filename e.g. 3:filename.txt in both active and inactive windows?
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.
Normal vim window:
http://cl.ly/image/1n0w2u3t0F0R
With :vsp lightline appear:
http://cl.ly/image/2t2A0U0b373U
Someone has an idea about this problem?
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': '' }
\ }
Just opened my Vim and saw them. You are the best in the world and I can't thank you enough.
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.
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() |
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() |
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)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.