banner
Dave Horner's Website - Yet another perspective on things...
Home Tech Talk Unix/Linux/BSD/OSX/ETC ViM - IMproved "visual editor"
If you appreciate the information found on this website, please drop me a line!

Who's Online

We have 29 guests online
Content View Hits : 1157228
moon and stars
How did you find my site?
 
How often do you answer random online questions?
 

Random Quote

The less confident you are, the more serious you have to act. --Tara Ploughman
P1010058
DCP00566
Gatlinburg_068
P1010057

ViM - IMproved "visual editor"

Monday, 09 May 2005 19:10
There are many kinds of text editors out there. Few are as good as vi. I know, I know, it isn't like your normal editor. There is this concept of command mode vs. insert mode....a lot more work than most other editors to master, and many times not so user friendly. However, learn to love it, and you'll be rewarded. :)

One reason I love VIM is because it is available on most every OS. You can also gaurantee that it is going to be on every UNIX/Linux/Mac/Cygwin/etc system you touch.

Here are some cool things I love about VIM.

Column mode:

Still researching on how to accomplish this.

Type ":help" in Vim to get started. Type ":help subject" to get help on a specific subject.

Some useful vim commands follow:

:set paste              - Turn on pasting mode.
:set nopaste            - Turn off pasting mode.
:set ai                 - Turn on autoindenting.
:set noai               - Turn off autoindenting.
:set textwidth=0        - Disable maximum text width.
:set textwidth=78       - Set max width that text can be insterted to 78.
:set list               - Show tabs as '^I' and end of line characters as '$'.
:set nolist             - Turn off list mode.
:syntax on              - Turn on syntax highlighting.
:set ruler              - should show a column ruler in vim..if you have a new enough version.
:set number             - shows line numbers, set nonumber to turn line numbers off.
:syntax off             - Turn off syntax highlighting.

Web Resources

The VIM (Vi IMproved) Home Page
The Vi Lovers Home Page
Extending Vim with Python - Program - Python - Builder AU
Vi Cheat Sheet
How I boosted my Vim ยป nvie.com
macvim - Project Hosting on Google Code - MacVim is a port of the text editor Vim to Mac OS X.
VimGolf - real Vim ninjas count every keystroke!


su write vim

There are times when you vi a file that you don't have perms to write to.... instead of saving it to an alternate file and moving it over top of the orginal, you can simply do the following...
:w !sudo tee % > /dev/null


search and replace in vi

If you want to search an entire file, you can use % to indicate whole document as the range:
:%s/search/replace/g
The range is optional; if you just run :s/search/replace/, it will search only the current line and match only the first occurrence of a term.
Linux.com :: Vim tips: The basics of search and replace


Insert command output into document within vim

In the normal mode
!! date
(!! will replace the current line with the output of the command).


VIM CASTS Episodes
Vim: revisited
Vim: Seven habits of effective text editing
Lokaltog/vim-powerline - GitHub - Powerline is a utility plugin which allows you to create better-looking, more functional vim statuslines.
Last Updated on Wednesday, 18 January 2012 11:46