Empowering Vim Editor
(based on version 7.1)
by
Joydeep Bakshi
14-SEP-2007

Copyright and License

Copyright©2007 by Joydeep Bakshi. This material may be distributed only subject to the terms and conditions set forth in the Open Content License, v1.0 or later (the latest version is presently available at opencontent.org ).


Credits

Most of Vim was made by Bram Moolenaar, with a lot of help from others.

See ":help credits" in Vim.

Vim is based on Stevie, worked on by: Tim Thompson, Tony Andrews and G.R. (Fred) Waer. Although hardly any of the original code remains. .

What This Document Is ?

Vim is the most advanced editor in linux/unix world. But its default settings are according to the vi editor hence hides its tremendous capabilities. Some times Vim is the only editor which we can use, like in remote header less system or in system which intentionally avoid graphics to provide its full strength to the servers daemons. What ever may be the situation; vim can be configured in such a way that specifically addresses all the features just we need. Vim reads the .vimrc from the home directory. Once we configure the .vimrc according to our requirements; editing by Vim will simply be a great joy. I have written this document to show you amazingly useful features of the vim editor in console mode and how a properly configured .vimrc makes text editing with Vim a peace of mind.


What This Document Is Not ?

This is not a tutorial to make you familiar with Vim or teach you how to use Vim. If you are not a regular Vim user then this document is not for you. More over I have written this guide specially for console mode operation of Vim.


What is New ?

Nothing !!! All the features focused here are inbuilt in the Vim. Though it is not impossible but memorising all the keyboard operation of console-mode is difficult. Hence Vim provides keymap facility so that user can define its own keymap according to its own choice. I have exploited this feature and made easily memorable keymap to some frequent as well as important Vim commands. More over bypassing the default console-mode menu I have written a modified console-mode menu; called .vim_menu adding only those commands which I fell must be there. This way user don't need to remember those commands and need to access the menu only. To achieve all these I have written some easily understood functions in the .vimrc and .vim_menu

To beautify the look I have made some Vim options as default like highlighting the current line etc..


Required Packages

Vim 7.1 You can download source from http://www.vim.org/sources.php
pdftotext to read PDF files within Vim
Python to support scientific calculator within Vim


Two configuration Files

Vim sets its behavior according to the .vimrc. It first checks home directory for .vimrc and failing to get one it reads the global .vimrc file. Vim needs menu.vim to support the console-mode menu. I have created a .vimrc to place in the home directory and .vim_menu to support the console-mode menu.


How to Install the Configuration Files ?


User Manual

		Ctrl+U		(insert, command-line and normal mode)	(U)ndo changes 
		Ctrl+R		(insert, command-line and normal mode)	(R)edo changes
		Ctrl+G		(insert, command-line and normal mode)	up(G)rade or save changes
		Ctrl+E		(insert, command-line and normal mode)	(E)xit after save
		Ctrl+A		(insert, command-line and normal mode)	Save (A)ll and exit
		Ctrl+N		(insert, command-line and normal mode)	(N)o save and exit
		Ctrl+L		(insert, command-line and normal mode)	(L)ine number display (Toggle mode) 
		Ctrl+B 		(insert, command-line and normal mode)	visual(B)ell support (Toggle mode) 
		Ctrl+H 		(insert, command-line and normal mode)	(H)idden character (Toggle mode) 
		Ctrl+D		(insert, command-line and normal mode)	(D)elete line under cursor
		Ctrl+F		(insert, command-line and normal mode)	(F)ile explorer in new tab
 
		<leader>+t	(insert, command-line and normal mode)	(T)ab open
		<leader>+<left> (insert, command-line and normal mode)	Previous Tab 
		<leader>+<right>(insert, command-line and normal mode)	Next Tab
		<leader>+<up>	(insert, command-line and normal mode)	First Tab
		<leader>+<down>	(insert, command-line and normal mode)	Last Tab 
		<leader>+a	(insert, command-line and normal mode)	Show (A)ll Tabs
		<leader>+g	(insert, command-line and normal mode)	(G)o to Tab page
		(Just enter the tab page number after the tabn command)
		<leader>+e	(insert, command-line and normal mode)	Save and (E)xist current Tab

	Example : I have set lowercase z as leader. So pressing zt will open a tab

		<leader>+f	(visual mode)				(F)old visually selected text 
		<leader>+o	(insert,command-line and normal mode)	(O)pen the fold under cursor
		<leader>+d	(insert,command-line and normal mode)	(D)elete the fold under cursor
		Ctrl+V		(insert and command-line mode)		start (V)isual mode (Toggle)
		Ctrl+C 							(C)opy selected words/lines in visual mode
		Ctrl+P							(P)aste copied information in visual mode 
		Ctrl+X							Cut selected words/lines in visual mode 
		press Delete to delete selected words/lines in visual mode
		


Compatability

Vim 7.1 has some extra features and variables which are not available in Vim prior to version 7.1 I don't know if my .vimrc works with prior Vim 7.1 Please let me know if you test.


Scope of modification

You can modify the .vimrc and .vim_menu as per your choice. You can add more keymap and leader switches but they should not conflict with the existing keymap and leader keys of .vimrc. Some of keymaps already having some purpose in Vim. Like F1 by-default calls the help page in Vim but I am using F1 to comment/uncomment current line. So you should be aware about the side effect of remapping any key.


Troubleshooting

To check a misconfigured .vimrc use "vim -Nu NONE .vimrc" to bypass the loading of .vimrc from the home directory


How to edit remote file with SSH support ?

If the remote server has running SSH daemon and your machine also has SSH client then you can open remote file by the command

		vim scp://hostname/path/to/file 
				or 
		vim scp://hostname#<ssh-port>/path/to/file 
This wiil open the remote file in the local buffer

If you have ssh-agent then you can enjoy remote editing without typing password of the remote machine

If you like to save the modified file at the remote location then execute :Nwrite from command-line mode. Otherwise simple :x will save the file in the local machine


Screenshots (added on 1-Oct-2007)

Highlight
Line Highlight


Linenumber
Line Number


Tab
Multiple Tab


Tab1
Working with Tab


Visualmode
Visual selection


Spelling
Highlihting mis-spelled words


Spell
Spelling correction


explorer
File Explorer


fold
We are going to create a fold


Folding
Folding


Hidden
Showing non-printable


consolemenu
Console-mode menu


ruler
Ruler


completion
Command line completion with tab

INDEX | HOME
Copyright© 2007, Joydeep Bakshi