Line Numbers in VI and/or Visual C++ :: C++

kuphryn

Senior member
Jan 7, 2001
400
0
0
Hi.

I always find myself counting the number of lines in my code when GNU C++ gives me errors with line numbers. However, counting is a slow and tedious in Linux C++ editors such as VI. I saw someone use a Linux C++ editor with line numbers on the left. I am not sure what editor he was using, but I believe it was VI.

How do you enable line numbers inside VI C++ editor? Is it possible to view line numbers in Visual C++ as well? Microsoft makes Visual C++ extremely user friend as it directly focuses to the error line when the user double-click on the error. Nonetheless, since Linux C++ editors such as VI do not have that feature, I would like to try and practice debugging using line numbers.

Thanks,
Kuphryn
 

CSoup

Senior member
Jan 9, 2002
565
0
0
vi normally has the line you are currently on indicated in the lower corner (not sure which side). Same with Emacs. In Emacs I think you can jump to a like by doing ctrl-\ then g then the line number. In visual C++ you can press ctrl-g then enter the line number. Line number also shows up at the bottom in VC++.
 

DaHitman

Golden Member
Apr 6, 2001
1,158
0
0
In VI/VIM just type..

:set nu

or

:set number


to turn it of...

:set nonu

or

:set nonumber



You can also get the current line number at any time in vi by hitting CONTROL-G
 

stndn

Golden Member
Mar 10, 2001
1,886
0
0
also in vi, you can use
:n (where n is the line number) to go straight to line n
or you can also do n + shift-G to go to line n as well (press the line number, then shift-g)

to go to the end of file
: and enter, or just plain shift-G

:)
-931-