Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove a segment in vim Powerline?

Tags:

vim

vim-plugin

I'm using vim Powerline, it comes by default with quite a few segments in the powerline. More than I want.

I'd like to remove several of the default ones. Specifically, the one that tells me my git branch, the file encoding, the source language, the line/col number, the one that says unix (probably line ends).

In the docs, they say you should be able to use Pl#Theme#RemoveSegment.

So I added call Pl#Theme#RemoveSegment('fugitive') to my ~/.vimrc, and then ran :PowerlineClearCache and reloaded the file, but the git branch is still there. Perhaps I'm getting the name wrong, I guessed that this is the one that enters my git branch based on the naming from here.

If there's a way to reflect on some variable and see what segments are registered, that would be useful, but I can't tell if I'm getting the name wrong, or invoking the method incorrectly, or what.

like image 420
Joshua Cheek Avatar asked Dec 03 '25 15:12

Joshua Cheek


2 Answers

The theme list suggests maybe the segment name should be fugitive:branch instead of fugitive. Kind of guessing, though.

like image 57
trptcolin Avatar answered Dec 06 '25 04:12

trptcolin


There may be more segments being added. I personally would suggest instead of using Pl#Theme#RemoveSegment do the following:

  1. Copy {path/to/powerline}/autoload/Powerline/Themes/default.vim to ~/.vim/autoload/Powerline/Themes/my.vim.
  2. Replace in the first line of a new file default with my: it should look like

    let g:Powerline#Themes#my#theme = Pl#Theme#Create(
    
  3. Add

    let g:Powerline_theme='my'
    
  4. Remove all the stuff you don’t need, you will find plenty of it.
like image 20
ZyX Avatar answered Dec 06 '25 06:12

ZyX



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!