Learning the vi editor/Vim/Vim on Windows

From Wikibooks, the open-content textbooks collection

Jump to: navigation, search

Learning the vi editor: Getting acquaintedBasic tasksMaking your work easierAdvanced tasksDetailsVi clones (VimBasic navigationModesTips and TricksUseful things for programmers to knowEnhancing VimVim on WindowsVimL Script language, Vile, BB vi)vi Reference

Contents

Vim is available for Microsoft Windows, but there are many issues attendant to that platform that make effective use of Vim quite challenging. This section deals with some of the issues relevant to users who are using or considering Vim for use on Windows systems.

[edit] Installation

There are a variety of installation options for users who wish to install Vim on Windows.

These include:

  • Self-installing executable
  • Win32s GUI executable
  • Windows 3.1 GUI executable
  • Win32 console executable
  • Win64 binaries for x64

Moreover, if desired, a user may compile Vim from source. This may be useful or even necessary if the user wants to add support for additional options that are not compiled into one of the pre-existing binaries by default. Perhaps the most common scenario for compiling on Windows is when the user wishes to add support for a programming language (either a specific language, or a specific version of the language) that is not included in the Windows binaries by default.

When installing Vim, the user has to accommodate for any required elements that do not come with Windows by default, such as a compiler and make.

[edit] General usage

Users who are not well-acquainted with how Vim works and the general "vi way of doing things" may find Vim especially challenging. This is especially so if they are already comfortable with the workflow of most other text editors on Windows. Because of this, there's actually more than one way of doing things if you want to use Vim on Windows. One way of using Vim on windows can be called standard vim workflow (Vim); another way would be the windows vim workflow (WinVim).

Using the "WinVim" style definitely has advantages for those users who are not amenable to the steep learning curve commonly associated with Vim, however there are many features within Vim that are difficult to use when working from the "WinVim" paradigm. Whether one chooses one usage pattern over the other, or some combination of the two, is largely a matter of personal preference.

[edit] Behave mswin

Vim configuration allows the user to set the editor behavior to reflect some aspects of the "WinVim" working style. This enables a 'scaled down' version of the WinVim style, users who want a very detailed emulation of WinVim style will have to do more than just set 'behave mswin'. See :help behave for more details.

[edit] Cream editor

The Cream editor is an example of a Vim configuration that is designed for users who prefer the "WinVim" style of working.

[edit] Compatibility

For those who are familiar with UNIX-like operating systems, and leverage such systems to enhance and extend Vim, the Windows operating system may present some unexpected differences and limitations.

[edit] Path separators

Windows (by default) uses the backslash character to delimit path-steps in file paths. This can be challenging for users who are not used to this. See :help shellslash for more details.

[edit] Command piping

The Windows command shell does not support command piping and redirection in the same way as UNIX systems. Some users may find this especially challenging, because it significantly limits the way Vim can interact with other programs external to the editor. There are workarounds, however, that allow a user to approximate some of the power that comes natively from piping and redirection.

[edit] Temporary text transport file

A temporary text transport file is one workaround that allows Vim to interact with other programs on Windows without requiring use of pipes and redirection. The basic approach is to specify one or more temporary files on the local file system that Vim and external programs use to "transport" text between each other.