Penguin

Differences between version 10 and predecessor to the previous major change of VimNotes.

Other diffs: Previous Revision, Previous Author, or view the Annotated Edit History

Newer page: version 10 Last edited on Thursday, April 19, 2007 1:19:49 pm by BenStaz Revert
Older page: version 9 Last edited on Friday, December 22, 2006 12:23:35 pm by BenStaz Revert
@@ -1,7 +1,31 @@
 See also ViNotes 
  
 vim(1) -- potentially the most powerful editor unix users have access to, and one of the best things about it is in actual fact it's not restricted to unix users at all. Anybody can use vim, anywhere (more or less). Its only real drawback is that it's a little difficult to get to grips with at first. This page is not designed to cover basic editing. Rather, this page is a list of tips which will make your vim editing experience more enjoyable, particularly if vim is used as a programming editor. 
+  
+!!Indentation  
+  
+[BenStaz] finds these settings very useful when using vim for coding (any language).  
+  
+<verbatim>  
+set tabstop=4  
+set shiftwidth=4  
+set expandtab  
+set softtabstop=4  
+set autoindent  
+</verbatim>  
+  
+Just add the above to ''~~/.vimrc''. (Create it if it does not already exist)  
+  
+*tabstop=4 - A four-space tab indent width  
+  
+*shiftwidth=4 - This allows you to use the < and > keys from VIM's visual (marking) mode to block indent/unindent regions  
+  
+*expandtab - Insert spaces instead of <TAB> character when the <TAB> key is pressed. (Used to avoid indenting problems with python)  
+  
+*softtabstop=4 - This makes it easier when pressing BACKSPACE or DELETE, since if the indent is using spaces it will take 4 keystrokes to delete the indent. Using this setting, however, makes VIM see multiple space characters as tabstops, and so <BS> does the right thing and will delete four spaces.  
+  
+*autoindent - Means that when you press RETURN and a new line is created, the indent of the new line will match that of the previous line.  
  
 !!Syntax Highlighting 
  
 vim, of course, supports syntax highlighting. Often this isn't on by default. The easiest way to turn this on is to type ":syntax on". Viola. What's that? You're using a dark background and the highlighting looks terrible? No real problem. Try ":set background=dark". Adjust as appropriate for 'it looks horrible and I have a white background'. If you just think it looks horrible fullstop, you can get a new syntax highlighting file for it... download one from vim.org, throw it into your ~/.vim/colors directory (you may have to create this) and explore the colorscheme command (hint, ":help colorscheme" or just ":colorscheme x", where your scheme file is x.vim). I recommend borland.vim, the colorscheme for the borland "Turbo" IDEs.