Actions

Difference between revisions of "Vim"

From RonWareWiki

 
(21 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
[[category: programming]]
 
[[category: programming]]
 
[[category: tools]]
 
[[category: tools]]
 +
<center><big>'''VIM''' - the programmer's editor</big></center>
  
I use the [http://www.vim.org/ vim editor] for most every kind of editing task I have.  It is very powerful.
+
[http://www.vim.org/ VIM] is an extremely powerful programmer's editor based on [http://en.wikipedia.org/wiki/Vi the ''vi'' editor] from Unix.  It takes a bit of getting used-to, but once one has a working knowledge of it, skill and speed come quickly.
  
The "vim" editor is a "vi" clone, but much better than the original and with many very helpful featuresI've contributed heavily to the project in the past, writing much of the unicode and Hebrew language support.
+
VIM is an "improved vi", which has essentially all the features a programmer
 +
could want in a relatively small and fast packageRon's install (link below)
 +
has all sorts of useful enhancements.  It is packaged in an NSIS installer
 +
package, just click the exe file to install.  Updates to his package are
 +
made from time to time; it's worthwhile checking back every so often.
  
* My private build, in a Windows install format: [[ron:gvim71-264.exe|download it here (7.1.264, updated 2008-02-26)]].
+
==Why use VIM?==
 +
# Why should I use VIM, when Notepad is right there on every Windows machine?
 +
# I like MultiEdit/VisualStudio/Eclipse/...!
 +
# Isn't VIM just for dinosaurs who don't like CRT screens?
 +
# But it doesn't have a nice GUI!
 +
 
 +
As for #1 - if we only ever had to use Windows machines, that would almost be a reasonable statement.  Since we need to also work on Linux machines occasionally, and since '''vim''' is always installed on every Linux machine (it's the default editor), learning how to use VIM is a good idea even if you prefer to use another editor (as in objection #2).
 +
 
 +
Concerning #3 and #4  - suffice it to say that VIM is not VI.  It is "improved" in the same manner that a [http://en.wikipedia.org/wiki/Mercedes-Benz_S-Class Mercedes S-class] is an "improved" [http://en.wikipedia.org/wiki/Ford_Model_T Model-T].  Among the standard features in VIM:
 +
* ''exhaustive'' and excellent online help (accessible via F1 or the ":help" command)
 +
* GUI (both native Windows, and GTK on Linux); color schemes
 +
* syntax highlighting for over 400 languages
 +
* multi-lingual support (UTF-8, custom keyboard input, custom spelling dictionaries)
 +
* character, line and block selections; mouse selection
 +
* [http://ctags.sourceforge.net/ ctags] and [http://cscope.sourceforge.net/ cscope] support
 +
* comprehensive scripting language
 +
* extensive regular expression support
 +
 
 +
There are tons of other features which I won't enumerate.  Now if the objection was "I like EMACS", I would say - fine, use EMACS.  They are functionally equivalent in terms of power, though VIM is smaller and faster (and easier to use IMO, but that's opinion).
 +
 
 +
==How do I learn VIM?==
 +
The editor already contains its own tutorials; but there are excellent resources online, many of which are not specific to VIM:
 +
* '''New''' free eBook: [http://www.swaroopch.com/notes/Vim A Byte of Vim]
 +
* [http://www.viemu.com/a_vi_vim_graphical_cheat_sheet_tutorial.html Graphical VIM cheat-sheet]
 +
* [http://thomer.com/vi/vi.html VI Lover's page]
 +
* [http://www.eng.hawaii.edu/Tutor/vi.html Mastering the VI editor]
 +
* [http://www.biochem.ucl.ac.uk/~mckenzie/vim/tutorial.html VIM tutorial]
 +
 
 +
You can find more by [http://www.google.co.il/search?hl=en&q=vim+tutorial&btnG=Google+Search&meta= asking Google] for vim tutorials.
 +
 
 +
NOTE: '''vim''' starts a text-mode console version of VIM, whereas '''gvim''' starts a GUI version of VIM.  On Windows they are different programs while on Linux they are just symlinks to the same executable.  I ''always'' use '''gvim''' on Windows, because console support is ... not good ... on Windows since Microsoft thinks it unimportant.
 +
 
 +
==How do I get VIM?==
 +
You can get it from the [http://www.vim.org/ vim website]. But if you use
 +
Windows, you might prefer to get [[User:Ron|Ron]]'s  build which is linked
 +
below.  Linux users of Ron's build should get 'wmctrl', 'exuberant ctags' and 'idutils'
 +
 
 +
Once you become a hard-core vimmer, you'll want to [http://www.cafepress.com/vimrefmug.25635024 drink your coffee from a VIM mug].
 +
 
 +
==Links==
 +
 
 +
* My private build: [http://dev.ronware.org/vim.cgi/home is here].
 
* [[vim/mmp|Symbian MMP syntax file]]
 
* [[vim/mmp|Symbian MMP syntax file]]
 +
* [[vim/sqlite|SQLite interface patch]]
 +
* [[vim/makevim|build script (bash)]]

Latest revision as of 17:02, 12 January 2010

VIM - the programmer's editor

VIM is an extremely powerful programmer's editor based on the vi editor from Unix. It takes a bit of getting used-to, but once one has a working knowledge of it, skill and speed come quickly.

VIM is an "improved vi", which has essentially all the features a programmer could want in a relatively small and fast package. Ron's install (link below) has all sorts of useful enhancements. It is packaged in an NSIS installer package, just click the exe file to install. Updates to his package are made from time to time; it's worthwhile checking back every so often.

Why use VIM?

  1. Why should I use VIM, when Notepad is right there on every Windows machine?
  2. I like MultiEdit/VisualStudio/Eclipse/...!
  3. Isn't VIM just for dinosaurs who don't like CRT screens?
  4. But it doesn't have a nice GUI!

As for #1 - if we only ever had to use Windows machines, that would almost be a reasonable statement. Since we need to also work on Linux machines occasionally, and since vim is always installed on every Linux machine (it's the default editor), learning how to use VIM is a good idea even if you prefer to use another editor (as in objection #2).

Concerning #3 and #4 - suffice it to say that VIM is not VI. It is "improved" in the same manner that a Mercedes S-class is an "improved" Model-T. Among the standard features in VIM:

  • exhaustive and excellent online help (accessible via F1 or the ":help" command)
  • GUI (both native Windows, and GTK on Linux); color schemes
  • syntax highlighting for over 400 languages
  • multi-lingual support (UTF-8, custom keyboard input, custom spelling dictionaries)
  • character, line and block selections; mouse selection
  • ctags and cscope support
  • comprehensive scripting language
  • extensive regular expression support

There are tons of other features which I won't enumerate. Now if the objection was "I like EMACS", I would say - fine, use EMACS. They are functionally equivalent in terms of power, though VIM is smaller and faster (and easier to use IMO, but that's opinion).

How do I learn VIM?

The editor already contains its own tutorials; but there are excellent resources online, many of which are not specific to VIM:

You can find more by asking Google for vim tutorials.

NOTE: vim starts a text-mode console version of VIM, whereas gvim starts a GUI version of VIM. On Windows they are different programs while on Linux they are just symlinks to the same executable. I always use gvim on Windows, because console support is ... not good ... on Windows since Microsoft thinks it unimportant.

How do I get VIM?

You can get it from the vim website. But if you use Windows, you might prefer to get Ron's build which is linked below. Linux users of Ron's build should get 'wmctrl', 'exuberant ctags' and 'idutils'

Once you become a hard-core vimmer, you'll want to drink your coffee from a VIM mug.

Links