Navigation
  • Home
  • Recent
  • Most Active
  • Popular
  • Blog
  • Credits
  • RSS
  •   Interaction
  • Register
  • Statistics
  •   Help
  • Suggestions
  • Contact Us
  • How to Edit
  • Help



  • [Edit]




    Vim, which stands for Vi IMproved ''sic'', is an open-source, multiplatform text editor extended from vi. It was first released by Bram Moolenaar in 1991. Since then, numerous features have been added to Vim, many of which are helpful in editing program source code. Vim is today one of the two most popular editors for programmers and users of Unix-like operating systems, alongside Emacs.


        Vim (text editor)
            Learning to use Vim
            Modal editing
                Normal
                    Operator-pending
                    Insert Normal
                Visual
                    Insert Visual
                Select
                    Insert Select
                Insert
                    Replace
                Command-line
                Ex mode
                Evim
            Customization
            Features and improvements over vi
            History
            See also
    NameVim
    LogoImage:Vimlogo.png
    ScreenshotImage:Vim.png
    CaptionGraphical Vim under GTK+
    DeveloperBram Moolenaar and others
    Operating SystemAmiga, Linux, Mac OS X, Microsoft Windows
    GenreText editor
    LicenseGNU General Public License
    Websitehttp://www.vim.org/

    top

    Learning to use Vim
    Vim has a steep learning curve, meaning learning is slow initially but once the user gets a grasp of the basics they progress quickly and their editing becomes more efficient. To facilitate this, there is the Vim tutorial for beginners, usually invoked by typing "vimtutor" on the Unix command line or clicking on the Vim tutor icon on the Windows desktop. There is also the Vim Users' Manual that details the basic and more advanced Vim features which can be read by typing ":help user-manual" within Vim.

    New users should also learn how to navigate and understand the conventions of the Vim help system by reading the main help file by typing ":help" without any arguments.

    top

    Modal editing
    As a descendant of vi, Vim is modal — an unusual feature which tends to confuse new users. All editors are modal in the general sense of having to distinguish insert and command inputs, but most others implement that modality through very different methods: command menus (mouse or keyboard driven), meta keys (simultaneous use of multiple keys, usually involving control key (CTRL) or alt key (ALT)), and mouse input. Vim, following vi, is unique in that you switch the entire keyboard into and out of these modes. This allows you, but does not require you, to perform all editing functions with no use of the mouse or menus and minimal use of meta keys. For touch-typists and those averse to the mouse, this can be a great benefit in power and efficiency.

    Vim has six basic modes and five variants of the basic modes:

    top

    Normal
    In normal mode you can enter all the editor commands such as cursor movement, text deletion, etc. Vim starts in this mode by default. This is contrary to what many new users expect.


    Vim's power derives primarily from its extensive normal mode commands, many of them requiring an operator to complete. For example, the normal mode command "dd" deletes the line the cursor is currently on, but "d" can be followed by a motion command instead of another "d" such as the line down key ("j") to delete the current and the next line. You can also provide a count; "2dd" (repeat 'dd' twice) does the same thing as "dj". Once the user learns various movement/jump commands and other normal mode editing commands and how they can be combined, their editing often becomes much more efficient than users of "modeless" editors.


    From normal mode you can enter insert mode any number of ways; the most common are to press "a" (append) or "i" (insert).


    top

    Operator-pending
    In this sub-mode of normal mode an operator command has been started and Vim is waiting for a "motion" to complete it. Vim also supports special "text objects" in place of motions in operator-pending mode, which can include "aw" for a word, "as" for a sentence, "ap" for a paragraph, etc.


    For example, "d2as" in normal mode deletes the current sentence and the next, and in visual mode, "apU" converts the current paragraph to uppercase.


    top

    Insert Normal
    This mode is entered when control-o is pressed in insert mode. It behaves like normal mode but only lets you execute one command before Vim returns to insert mode.


    top

    Visual
    This behaves much like normal mode, but the movement commands extend highlighted text. When a non-movement command is used it is performed on the highlighted area. Vim's "text objects" can be used in this mode as motion commands as well.


    top

    Insert Visual
    This is entered from insert normal mode by pressing control-o then starting a visual selection. After the visual selection ends Vim returns to insert mode.


    top

    Select
    This is somewhat like the Microsoft Windows selection mode — you can highlight text with the mouse and the cursor keys, but typing a character causes the highlighted area to be deleted and Vim enters insert mode with the character you typed inserted.


    top

    Insert Select
    This mode is usually entered by dragging the mouse or using a shifted arrow key in insert mode. After the selection ends Vim returns to insert mode.


    top

    Insert
    In this mode most keys on the keyboard insert text into the buffer. This behavior is what most new users expect text editors to always do.


    From insert mode you can go back to normal mode by pressing the escape key (ESC).


    top

    Replace
    This is a special insert mode where you can do the same things as you would do in insert mode, but each character you type overwrites an existing character in the buffer.


    top

    Command-line
    In command-line mode you can enter one line which is interpreted as a command (":" key), search ("/" and "?" keys), or a filter command ("!" key).


    top

    Ex mode
    This is like command-line mode, but you can enter multiple commands until you leave this mode by typing "visual".


    top

    Evim
    Evim is a special GUI mode that tries to behave more like a "modeless" editor where the editor starts and stays in insert mode and the user has to use the menus, mouse, and keyboard control keys, such as the arrow keys. This mode can be enabled by typing "evim" on the command line (Unix) or clicking on the evim icon (Windows).

    top

    Customization
    Part of Vim's power is that it can be extensively customized. For example the basic interface can be controlled by the many options available (":help options"). Additionally the user can define personalized key mappings—often called macros—to automate sequences of keystrokes, or even call internal or user defined functions (":help map.txt").

    There are many plugins available that will extend or add new functionality to Vim. These complex scripts are usually written in Vim's internal scripting language (":help vim-script-intro"), but they can also be implemented using the Perl, Python, Ruby, etc. interfaces that can be included in Vim at compile time.

    top

    Features and improvements over vi
    Some of the main features of Vim and improvements of Vim over vi:

      Vim is almost fully vi compatible (in compatible mode)
        Mac OS (discontinued in Vim 7)
      Graphical User Interface (GUI) mode
      IDE-like build/review/edit features
      Multiple buffers
      Session state preservation
      Split windows — both horizontal and vertical
      Trans-session history of commands, searches, registers, positions, …
      Unlimited multi level undo/redo
      Visual mode selection with character/line/block ranges


    top

    History


    (Note that some dates are approximate,Dates were taken from the ftp://ftp.vim.org/pub/vim official Vim FTP site. development releases are not listed, and many minor version releases are not yet included in this list.)



    top

    See also

      Cream — Configuration of the Vim text editor for Windows and GNU/Linux
     
    Search more:
     

       
    Source Privacy License Download Contact Us Atlas
    Scientus.org Dictionary (Yet Another Wiki) RC : 1.39
    MIT OpenCourseWare
    This article is licensed under the GNU Free Documentation License [copyleft]. It uses material from the Wikipedia article "Vim (text editor)". link