VIM: The (un)official thread
I noticed in this other thread a lot of people of people mentioned vim, and usage problems with vim. I'm not going to do a complete review, but I will say I really believe it is the greatest piece of software of all time.
It's also the most poorly documented, so what I did want to do was start a new thread here in the "Product Review" board where people could ask stuff like "How can I see the value of a defined variable?" (the answer is here; "[i" works in escape mode)
I'm sure there are some other programming software products around that could have an even more popular thread, but I'm not going to start any of them ;)
Here's the wikipedia entry for the curious:
And the actual homepage is welcome home : vim online.
I recommend against the use of the GUI. There is nothing wrong with it, but it is unnecessary and the functionality cannot be improved upon with tradition pull down menus and tabs (learn to use a keyboard, you are a computer programmer!). Plus, there is nothing like being able to use your absolute favourite tool even when you don't have a graphical desktop, and not have to remember how to get things done without a mouse to click and point things at. If you are new to the whole concept, two commands which work in escape mode that you might want to get to know are
This splits the window in half horizontally, and if you include a filename loads it. You can also split the window unevenly (try ":help split"). To move back and forth, use ctrl-ww.
This will reload the last file, handy for flipping back and forth.
Vim is standard on almost all unix derived operating systems including linux, and available for all of them (including MAC OS). There is even a windows and DOS version. However, the package included with your linux distro probably leaves a lot to be desired. It is easy to compile from source, however (choose the "huge" option to get the most functionality). A quick test of your installation is to try "vim --remote": you should be able to type:
vim --remote mycode.c
to send a file to the currently running (or first) instance of vim in any terminal anywhere on your desktop. This is very handy since you can add this command to your filebrowser, and just have one fullscreen, non-GUI vim in a terminal somewhere. If it doesn't work, your install doesn't have all the vim features and you should uninstall it and build from the source.
Here's a simple ~/.vimrc that demonstrates some basic and essential configuration (the double quote " starts a comment):
If you have any questions about using vim, or some reason why it is not the greatest piece of software of all time, post those here :)
" syntax highlighting, line numbering, etc on by default
set bs=indent,eol,start " allow backspacing over everything in insert mode
" you probably want all the syntax colors to work in your terminal
" here's how to set them for contrast
" numbers and color names are interchangable
hi Statement ctermfg=7
hi LineNr ctermbg=0 ctermfg=4
hi Comment ctermbg=7 ctermfg=darkblue
hi PreProc cterm=bold
hi Type ctermfg=6
hi Identifier ctermfg=2
hi Number cterm=underline ctermfg=6
hi Conditional cterm=bold ctermfg=3
hi Repeat cterm=bold ctermfg=1
hi Constant ctermfg=3
hi StatusLine cterm=bold ctermfg=green ctermbg=darkmagenta
hi StatusLineNC ctermfg=darkgray ctermbg=white
" key bindings (these just print things in appropriate places to save typing)
" cmap works in escape (aka command) mode, eg, for when loading a file
:cmap <F2> /root/code/
" imap works in insert (aka editing) mode
:imap <F2> printf("\n"); fflush(stdout);
:imap <F3> 12345678901234567890
" that last one is for counting string lengths...