On Solaris UNIX, pressing Ctrl-g displays the line number for the cursor position.
i.e. line 1 0f n* --0%–
But, on suse Ctrl-g on displays the percentage only, not the hard line number
i.e. n* lines --8%–
Anyway I can make vi display hard line just like Solaris?
I found a VI tutorial at:
VI and VIM editor: Tutorial and advanced features
When in the command mode, using a . refers to the line where the cursor is located. I have not used the command to which you refer and don’t see it in the tutorial.
The current line number is displayed all the the time for me. It looks like this in my window:
"/etc/passwd" [readonly] 33L, 1837C 15,1 All
I’m on line 15 in this file. The number after the comma is the column I’m at. If you don’t see this status line you may have :set compatible which turns off the ruler feature. Or maybe you changed rulerformat. See here:
Vim documentation: options’
The vi in Linux is actually vim, which is a superset of vi, but you have to be aware of any .vimrc settings that may affect operation.
Thanks for the help, compatible did the trick.
- edit /etc/vimrc
- Changed set nocompatible —> set compatible
- Ctrl-g now displays cursor line number
Wow - nobody afflicted with the Emacs religion piped up here. I guess that battle was lost to vi finally.
> Wow - nobody afflicted with the Emacs religion piped up here. I guess
> that battle was lost to vi finally.
> Just kidding.
The fact that no emacs user commented here does not mean that we do not
exist or that we gave up.
We are watching you vi people, take care.
(Also just kidding)
a big to both funny comments.
I actually use emacs as well; but, for my programming aspect of things vi seems to fit better. Just makes it a bit faster for me.