nvimdev / spaceline.vim

vim statusline like spacemacs
MIT License
281 stars 23 forks source link

Custom section #17

Closed ubmarco closed 4 years ago

ubmarco commented 4 years ago

Hi, is it possible to add a custom section to the spaceline? I want to use either of the following plugins: https://github.com/gcavallanti/vim-noscrollbar https://github.com/drzel/vim-line-no-indicator

Btw, I'm also using hardcoreplayers/ThinkVim .

Thanks for the support!

glepnir commented 4 years ago

@ubmarco Thanks for issue. i will look at it. By the way I have not used them. It looks good, but have you tested the performance of these two plugins in large files, will it cause any lag?

ubmarco commented 4 years ago

The performance is a good point. I did not try the plugins yet.

I'm just tired of pressing <C-g> to see where I am. The lower right corner has the percentage, but it's not easy to identify quickly for my human eyes/brain.

A rough graphical indicator would be cool. An option would maybe to exchange the 3 horizontal lines: image with the drzel/vim-line-no-indicator. I actually don't know what they mean, is that just a separator?

glepnir commented 4 years ago

It is just an identifier. There is always such a prompt on emacs modeline, with these 2 vim plugins I will try to achieve a similar effect on spaceline.vim image

glepnir commented 4 years ago

However, I am very worried about the performance of these two plugins in large files, so I will add an option to control whether it is enabled.

glepnir commented 4 years ago

@ubmarco I would like to add this https://github.com/drzel/vim-line-no-indicator support. what do you think?

glepnir commented 4 years ago

@ubmarco Now it look like this. test2 ![Uploading test3.gif…]()

ubmarco commented 4 years ago

Wow, thanks a lot for your fast-as-lightning response. That's a cool addition. Having an option to disable the indicator is a good idea. I will try it on larger files and come back to you. First experiments look good. How often does the statusline upate? Maybe the feature can be disabled automatically when files grow over a certain line count based on practical experience. However, I think there is still a bug in autoload/spaceline/spaceline.vim that I had to fix locally. The variable spaceline_no_indicator_chars is referred to as line_no_indicator_chars which leads to errors when displaying the statusline. I sent a PR https://github.com/hardcoreplayers/spaceline.vim/pull/18

ubmarco commented 4 years ago

Btw, what do you think about options to let users configure the location of elements in the statusline?

The code always starts on the left side, so the indicator is easier to spot if it were on the left. I also would not need the percentage indicator anymore (can press <C-g> for this). However I know opinions might differ from user to user, so a configuration would be awesome for changing positions and deactivating elements.

ubmarco commented 4 years ago

Oh I see, my PR is already outdated :)

glepnir commented 4 years ago

@ubmarco Sorry. I update a wrong version. please update now.

glepnir commented 4 years ago

@ubmarco This is option spaceline_scroll_bar is a list

" default
let g:spaceline_scroll_bar_chars= [
  \  ' ', '▁', '▂', '▃', '▄', '▅', '▆', '▇', '█'
  \  ]

let g:spaceline_scroll_bar_chars= [
  \ '   ', '▏  ', '▎  ', '▍  ', '▌  ',
  \ '▋  ', '▊  ', '▉  ', '█  ', '█▏ ',
  \ '█▎ ', '█▍ ', '█▌ ', '█▋ ', '█▊ ',
  \ '█▉ ', '██ ', '██▏', '██▎', '██▍',
  \ '██▌', '██▋', '██▊', '██▉', '███'
  \ ]
glepnir commented 4 years ago

you can custom it like this. test3

ubmarco commented 4 years ago

Thanks for the update. I tried to set

let g:spaceline_scroll_bar_chars= [
  \ '   ', '▏  ', '▎  ', '▍  ', '▌  ',
  \ '▋  ', '▊  ', '▉  ', '█  ', '█▏ ',
  \ '█▎ ', '█▍ ', '█▌ ', '█▋ ', '█▊ ',
  \ '█▉ ', '██ ', '██▏', '██▎', '██▍',
  \ '██▌', '██▋', '██▊', '██▉', '███'
  \ ]

in my ~/.thinkvim.d/init.vim but it don't work, it's still at default. When echoing the variable it shows the default value. What am I doing wrong?

glepnir commented 4 years ago

@ubmarco Please update i had fixed.

ubmarco commented 4 years ago

Thanks a lot for your support and time, it works now.

glepnir commented 4 years ago

@ubmarco No thanks. When i have time. i will rewrite this plugin . its hard to custom function and the code of now looks like shit..