Differences between version 10 and predecessor to the previous major change of Vim.
Other diffs: Previous Revision, Previous Author, or view the Annotated Edit History
Newer page: | version 10 | Last edited on Friday, June 4, 2004 4:12:57 pm | by BartvanDeventer | Revert |
Older page: | version 5 | Last edited on Thursday, February 27, 2003 8:11:23 am | by AristotlePagaltzis | Revert |
@@ -1,21 +1,27 @@
-The "other" text editor for Linux.
[Emacs
] is a fairly standard text editor used for programming under Linux, Vim is often known as its slightly less-used cousin
.
+[Vim
] is an evolution of vi(1)
.
-Vim is an evolution of "
vi",
a text editor that comes installed
with Unix. "Vi" wasn
't exactly free and quite limited
, so Bram Moolenar created Vim
. Vim now has many more features than "
vi" but still contains the basic interface and usage.
+vi(1) is
a text editor that comes with the original
Unix system as well as pretty much every other flavour, variation or clone of it known to mankind
. They
're all the same
, except for when they're different (see below)
. vi(1) is rather unique among text editors because it explicitly operates in
"modes", of which it knows three:
-Vim (
and "vi") is rather unique among
text editors because it operates on the fact that there are certain "modes" that the editor can be
in at any one time. The
mode Vim is
in upon startup is "
normal"
mode, press the key "i"
and the editor goes into "insert"
mode where the user can type text. This is perhaps what stops many people from adopting it. Nevertheless, Vim is quite a popular text editor and many programmers swear by it.
+; __Normal__ : you move the cursor
and perform single-keystroke commands here
+; __Insert__ : you enter
text in this
mode, which you invoke using the __i__ command
in normal mode and leave using __Esc__.
+; __Ex__ : ex(1) commands like search-and-replace commands can be entered into a CommandLine at
the bottom of the screen in this
mode
-Though "vi" originally only worked under Unix
, Vim
has been ported
to almost every platform under
the sun
. More information
can be found at
[http
://www
.vim.org]
or [http
://vim
.sf.net]
.
+The default mode is normal. While this makes more sense than defaulting to insert mode
, most people find it confusing that you can't just start hacking text into a file as soon as the editor loads and get scared away from vi(1) after their first encounter. It
has to be noted, however, that while it may not seem so on
the surface, the concept of modes is inherent in ''every'' editor, if only implictly
. In [Emacs] f.ex, you
can think of pressing __
[[Ctrl]__ as "entering normal mode"
: as long as you hold that key, you can enter command shortcuts
. Once you let go (and optionally enter some command
or whatever), you're "back in insert mode".
[GUI] text editors work much the same way
: once you activate a menu, keystrokes get interpreted as menu navigation - essentially command shortcuts -, and no longer as text input
. You get back to "input mode" by leaving the menus
.
-See
[VimHowto
].
+So when you get down to it vi(1) doesn't work much different from any
[GUI
] editor except perhaps for the lack of displayed drop down menu. And unlike any [GUI] editor, it has a CommandLine with a vocabulary that leaves little to be desired once you've memorized a handful of the commands
.
-The best
thing about all the versions of vi and vim
is that they're all
the same, except for when they're different. For example, on some machines
(eg *real* unix
), your arrow keys
don't work. You have
to navigate using "h"
, "j", "k" and "l". And only
in normal mode - pressing these keys in insert mode just inserts that character. Some versions
do let you use the arrow keys, but they only
work in normal mode - pressing the arrow keys in insert mode inserts the control code generated by the keypress instead
. Sometimes
(normally using vim
on linux) the arrow keys work as expected, in both insert and normal modes. Sometimes the arrow keys work, but if you press an arrow key in insert mode, it will change to normal mode
(as well as move the cursor
). To be fair, these observations aren't really vim's fault, but it's what I think of when I think of vim. Having said that though, I still use vim a lot, especially for smallish tasks
.
+Another
thing to remember
is that as opposed to [Emacs], even
the bog standard vi
(1
) offers a huge pile of useful bindings out of the box. You
don't ''need''
to synchronize [DotFile]s across machines or spend a lot of time setting things up to achive an environment close to what your very own configuration feels like
, even if you may still want to
in order to
do an extended amount of
work. You can immediately work productively on any random machine a vi
(1) is installed
on (which means everywhere
).
-----
+Since vi(1) isn't free and limited in various annoying ways, Bram Moolenar created [Vim], which adheres to the interface and usage philosophy of its ancestor but has many more features.
-In defense of
[Vim] (or actually,
in offense against other editors
), it has to be noted that although it may seem so, the concept of modes is not unique to [Vim] but inherent in
''every'' editor. In [Emacs] f.ex
, you "enter normal mode
" by pressing Ctrl; as long as you hold that key, you can enter command shortcuts
. Once you let go
(and optionally enter some command or whatever
), you're "back
in insert mode". GUI text editors work much the same way - once you activate
a menu, keystrokes get interpreted as menu navigation -- essentially command shortcuts --, and no longer as text input. You get back
to "input
mode" by leaving
the menus
.
+A notable addition in
[Vim] is arrow key navigation
(rather than having to use the __h j k l__ keys as
in original vi(1)
) - even in insert mode
, where you traditionally can
't navigate at all (except using Backspace
, if
you are inclined to call that
"navigation
")
. Some other vi
(1
) clones that allow arrow key navigation stick closer to the original by interpreting arrow keys
in insert mode as
a request
to change to normal
mode or even to insert
the control codes into the file you're editing
.
-So basically, [Vim] works much like any GUI editor except
for the lack of displayed drop down menu. And unlike any GUI editor, it has
a CommandLine with a vocabulary that leaves little to be desired once you've memorized a handful
of the commands
.
+There's support
for a huge number
of neat features, like OnTheFly [gzip] and bzip2 de/compression and [SCP]/[FTP] up/download
.
-Another thing to remember is that as opposed to
[Emacs
], even
the bog standard vi
(1
) offers a huge pile of bindings out of the box. You don
't need
to synchronize dotfiles across machines or spend a lot of time setting things up to achive an environment close to what your very own configuration feels like. You can immediately work productively on any random machine a
vi(1) is installed on
(which means everywhere
).
+[Vim
] has been ported to almost every platform under
the sun
(no pun intended
), so there
's no excuse
to still be using
vi(1) (let alone other inferior editors ;^)
).
---
[Aristotle|AristotlePagaltzis
] "
[Vim
] is awesome"
[Pagaltzis|AristotlePagaltzis]
:)
+See also:
+* VimHowto
+*
[vimtutor(1)
]
+*
[.vimrc
]
+*
[http
://vim.sf.net]