What are some of the improvements of Vim over Vi?
A short summary of the improvements of Vim over vi is listed below. The list shows that Vim is a thoroughly modern and feature-packed editor. Standard features of modern editors are implemented, and there is an equal emphasis on general power-user features and features for programmers.
Features to modernise Vi:
Multi-level undo
Allows you to set the number of times you can undo your changes in a file buffer. You can also redo an undone change. Also starting with version 7.3 Vim can permanently store your undo information, so that you can undo your changes which you have done in a previous editing session.
Tabs, Multiple windows and buffers
Each file can be displayed in its own window. You can move easily from one window to another. Each file opened during a Vim session also has an associated buffer and you can easily jump from one to the other. Also like any modern GUI, Vim supports opening several files in tabs. You can do batch processing for tabs, buffers, windows and the argumentlist.
Flexible insert mode
Vim allows you to use the arrow keys while in insert mode to move around in the file. No more hitting <Esc>, moving around, then hitting `i’ or `a’.
Macros
Vim has a facility which allows you to record a sequence of typed characters and repeat them any number of times.
Visual mode
You can highlight sections of text and execute operations on this section of text only.
Block operators
Allow selection and highlighting of rectangular blocks of text in order do execute specific operations on them.
Online help system
You can easily find help on any aspect of using Vim. Help is displayed in its own window.
Command-line editing and history
History allows you to use the arrow keys to repeat or search for a command that has already been typed. Allows you to match the beginning of a command with the beginning of another similar command in the history buffer. You can also edit a command to correct typos or change a few values.
Command line completion.
Using the <Tab> key, you can complete commands, options, filenames, etc. as needed.
Horizontal scrolling.
Long lines can be scrolled horizontally (with or without the GUI).
Unicode and internationalization improvements.
Vim is able to edit files in unicode encoding and uses internally an utf-8 encoding. Additionally Vim can display text right to left oriented.
Advanced user features:
Text formatting
With two keystrokes, you can format large sections of text, without the use of external programs.
Completion in Insert mode
Vim provides several different possibilities to complete your text. For example Vim can complete words while you are typing, by matching the current word with other similar words in the file.
Jump tags
Just like in an internet browser, you can jump back to previous parts of the text you were editing, and then forward again. Your brain is thus free to edit instead of navigate.
Automatic commands
Commands automatically executed when reading or writing a file, jumping to another buffer, etc.
Viminfo
Allows storing of the command line history, marks and registers in a file to be read on startup. Therefore, you can recall old search patterns, macros, etc., in a new Vim session.
Mouse support
The mouse is supported in an xterm and for MS-DOS. It can be used to position the cursor, select the visual area, paste a register, etc.
Graphical User Interface (GUI)
There are several different graphical user interfaces available. Also, it’s very easy to add your own menus. Of course, console vim is still supported, and very widely used.
Scripting language
Vim has a powerful scripting language so new commands can be created. You can also use Perl, Python, TCL, Lua and Ruby to achieve the same thing!
Plugins
Extra functionality implemented via vim commands (regular commands or the scripting language) that is automatically loaded on startup. Examples: file explorer, network editing, enhanced autocompletion, syntax checks. More are being developed and shared on VimOnline all the time.
Syntax highlighting for many programming languages
Syntax highlighting (including concealing items) for hundreds of programming languages is supported. Support for others can be added.
Extended regular expressions
Vim supports extended regular expressions which are similar in functionality to that of Perl regular expressions.
Integrated Spell checking
Spell checking has been integrated into Vim.
Diff mode
Vim can highlight the differences between two, three or four files. Identical lines will be folded away and hidden.
Encryption using the blowfish algorithm
Vim allows to encrypt your files using the symmetric block cipher blowfish as well as the swap file.
Extensive customizable
Vim can be tuned and customized to work like you want by setting options. You can define your own commands, macros and even plugins to extend its capabilities
Packages
Packages have been added to keep the installation of the growing number of plugins manageable. This is a convenient way to get one or more plugins, drop them in a directory and keep them updated. Vim will load them automatically, or only when desired.
Programming performance features:
Edit-compile-edit speedup
You can compile within Vim and automatically jump to the location of errors in the source code.
Indenting for many programming languages
C, C++, Java, Perl, XML and many other languages can be automatically indented by vim while you type. Support for others can be added.
Searching for words in include files
Vim allows you to search for a match of the word under the cursor in the current and included files.
Advanced text objects
Instantly select, delete, copy, indent, format, change case, or … to all the text between ( and ), or { and }, or < and >, or [ and ]. Or a word, sentence, or paragraph. Very powerful.
Folding
Certain parts of the text can be “folded” away. The best example is the body of a function. You can get an overview of the code, and then open the fold of the function whose detail you need to see.
ctags and cscope integration
Using these two powerful programs, you can jump to a definition of a function from a calling instance of it, and use other tricks to navigate source code.
Integration of several programming languages
If you find the internal scripting language not powerful enough, you can extend Vim using Lua, Ruby, Tcl, Perl and Python 2 and 3.
Asynchronous I/O support
Vim uses jobs and channels to talk to other programs asynchronously. This allows to have e.g. a compiler run in the background and open the quickfix list as soon as it is finished to fix warnings and errors.
Timers
Timers are asynchronous and can fire once or repeatedly to invoke a function to do any work.
#### vi-differences
Comments (1)
Pepsh Pepshinsky
Let’s see you to :help viminfo-file-name (option -i) :set viminfofile=NONE