Coder Social home page Coder Social logo

lightline.vim's Introduction

Hey there, I'm itchyny

I love open-source software. I love Vim, Go, Rust, and jq.

I'm looking for GitHub sponsors.

Most used languages GitHub stats

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

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

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?

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!

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': {

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

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.

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.

component with error highlight

Something like

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

Tabs

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

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

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.

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?

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.

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.

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>

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.

Corner cases

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

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

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?

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!

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

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?

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

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.

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 type

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

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.

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)

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.