You are not logged in.
Dear Archers,
I'm trying to modify my vim statusline. At this stage, my goal is to get vim to recognise any kind of statusline modification made in the vimrc, because at the moment no such modification appears to be recognised whatsoever.
I tried both a sample vimrc from the wiki and a blank vimrc containing nothing but the line,
set statusline=%t
For both vimrcs, the statusline setting was ignored. When I'm in vim, I can manually run the command,
:set statusline=%t
and the effect is apparent and immediate. All my other vimrc settings appear to be parsed in the correct manner; only this one specific setting seems to be ignored (but without warnings/errors).
I also did general googling on such topics as
"vimrc" "ignores" "statusline"
and found this Stack Overflow thread which suggests using ruler instead of statusline, but still I couldn't get it to work.
If anyone can point out what I'm doing wrong, I would really appreciate it.
Last edited by /dev/zero (2012-05-31 22:15:49)
Offline
Didi you
set noruler
set laststatus=2
to remove the ruler and permanently display the stausline?
Last edited by JackH79 (2012-05-31 08:00:44)
Offline
Didi you
set laststatus=2
to permanently display the stausline?
I did try various combinations with that setting.
I tried again just now with a vimrc containing nothing but,
set laststatus=2
set statusline=%t
but still when I afterwards type, vim .vimrc, it's clear that the statusline hasn't changed; running
set statusline?
show it's instead (still) on
statusline=%-f%r %2*%m%* %1*%{TagInStatusLine()}%*%=[%l:%c] [buf %n
]
Offline
Sorry, I was too slow with the edit.
I think you have to remove the ruler as well (see first post).
Offline
Sorry, I was too slow with the edit.
I think you have to remove the ruler as well (see first post).
No worries. I've added noruler:
set noruler
set laststatus=2
set statusline=%t
Still no love. (But when I run those commands manually from within vim, yes, they work.)
Offline
Strange. Is vim at least using any other modifications in your vimrc?
If no, then I'd say that maybe it doesn't use the same vimrc you're working with.
If it does, then I'm out of ideas for the moment.
Edit: Maybe check this.
Last edited by JackH79 (2012-05-31 08:16:42)
Offline
Strange. Is vim at least using any other modifications in your vimrc?
If no, then I'd say that maybe it doesn't use the same vimrc you're working with.
If it does, then I'm out of ideas for the moment.Edit: Maybe check this.
Thanks for your help. I noticed this problem while trying to modify my existing vimrc, which is much larger. That pre-existing vimrc works quite well, with or without these changes to the statusline settings. The changes just get ignored. This leads me to think that $HOME/.vimrc isn't being ignored entirely. For some reason, only the statusline part seems to be ignored.
The output of
:version
within vim appears identical to
vim --version
within bash, and so:
$ vim --version | grep vimrc
system vimrc file: "/etc/vimrc"
user vimrc file: "$HOME/.vimrc"
system gvimrc file: "/etc/gvimrc"
user gvimrc file: "$HOME/.gvimrc"
I could suppose that some error is making vim fall back on /etc/vimrc - but wouldn't this also make an error message appear, and make the colorscheme fall back to default as well? If there's a problem, then shouldn't the commands fail to work when I run them manually, and shouldn't a warning or error be issued?
I could post my normal vimrc, but I think at this stage it would just muddy the waters. I'd like to focus on getting the given minimal vimrc to work first. After that, I will see whether the solution works in a more realistic vimrc.
Offline
Why don't you post your minimal vimrc. Maybe someone picks up a vital part that is needed but not present.
Edit: just came home to sit in front of an actual vim. I tried to edit my statusline and it works perfectly.
Also tested it with this minmal .vimrc:
set nocompatible
set noruler
set statusline=%t
set laststatus=2
Last edited by JackH79 (2012-05-31 09:46:19)
Offline
Offline
Just to make sure, is that vim or gvim? Just because of the titlebar.
Apart from that, I'm a bit out of ideas. Sorry.
Last edited by JackH79 (2012-05-31 10:22:51)
Offline
Just to make sure, is that vim or gvim? Just because of the titlebar.
Just plain vim. I don't like gvim. My window manager (wmii) puts titlebars on windows; when I exit out of vim, that titlebar reverts to '~' to show the console's current directory.
Apart from that, I'm a bit out of ideas. Sorry.
Haha, okay, thanks for your efforts anyway .
Offline
Can't think of anything to fix the statusline, except trying a forced reinstall, and to check you don't have any vim packages installed that may affect it.
But you could try, as a workaround, to set rulerformat and set ruler.
I nicked this example from the vim site, as I think the format's different to statusline.
set ruler
set rulerformat=%55(%{strftime('%a\ %b\ %e\ %I:%M\ %p')}\ %5l,%-6(%c%V%)\ %P%)
"...one cannot be angry when one looks at a penguin." - John Ruskin
"Life in general is a bit shit, and so too is the internet. And that's all there is." - scepticisle
Offline
Well, the thing is that it clearly ignores your .vimrc, as it still displays the ruler, even though you explicitly set noruler.
Could you try and force vim to use your minimal vimrc?
vim -u /home/devzero/minimalvimrc
Does that make it work?
Offline
Can't think of anything to fix the statusline, except trying a forced reinstall, and to check you don't have any vim packages installed that may affect it.
But you could try, as a workaround, to set rulerformat and set ruler.
I nicked this example from the vim site, as I think the format's different to statusline.set ruler set rulerformat=%55(%{strftime('%a\ %b\ %e\ %I:%M\ %p')}\ %5l,%-6(%c%V%)\ %P%)
Okay, I try
set nocompatible
set statusline=%t
set laststatus=2
set ruler
set rulerformat=%55(%{strftime('%a\ %b\ %e\ %I:%M\ %p')}\ %5l,%-6(%c%V%)\ %P%)
... yep, still the same.
I'm going to bed. Hopefully as different parts of the planet rotate into sunlight, people will awaken and offer more ideas .
Offline
Damn, we should've done that in a chat room. Simultaneous editing of forum threads is confusing.
If you're awake and had your coffe, maybe try my suggestion in post #13 to see if it's actually using your vimrc.
Anyway, hope you had a good night. :-)
Offline
Damn, we should've done that in a chat room. Simultaneous editing of forum threads is confusing.
If you're awake and had your coffe, maybe try my suggestion in post #13 to see if it's actually using your vimrc.Anyway, hope you had a good night. :-)
Yeah, that's the next thing to try.
Edit: could also try putting the commands in the /etc file as well.
Last edited by skanky (2012-05-31 11:49:10)
"...one cannot be angry when one looks at a penguin." - John Ruskin
"Life in general is a bit shit, and so too is the internet. And that's all there is." - scepticisle
Offline
maybe try my suggestion in post #13 to see if it's actually using your vimrc.
Sorry, I missed that post last night. I tried your suggestion about forcing which vimrc to use. Vim quite clearly appears to be using the minimal vimrc because it respects commands about syntax highlighting:
I also tried looking in /etc/vimrc; it has a single line
runtime! archlinux.vim
I then run locate archlinux.vim, which gives a result /usr/share/vim/vimfiles/archlinux.vim
Offline
Okay, solved it.
First I ran vim in debug mode: vim -D. This showed me that my vimrc was being processed correctly. This suggested that something was undoing the vimrc settings later, i.e. plugins, so I grepped my plugins directory for "status\|ruler" and found the culprit: a plugin I never even use, called pythonhandler.vim. Removing that plugin solves the problem!
Thanks for your help .
Offline