Top Related Projects
Quick Overview
Vim is a highly configurable text editor built to enable efficient text editing. It is an improved version of the vi editor distributed with most UNIX systems. Vim is often called a "programmer's editor," and so useful for programming that many consider it an entire IDE.
Pros
- Extremely powerful and customizable
- Available on almost all platforms
- Efficient keyboard-based editing
- Large community and extensive plugin ecosystem
Cons
- Steep learning curve
- Can be overwhelming for beginners
- Default configuration may not be user-friendly
- Some users find the modal editing paradigm unintuitive
Code Examples
- Basic text manipulation:
" Delete the current line
dd
" Copy the current line
yy
" Paste the copied/deleted content
p
- Search and replace:
" Search for 'foo' in the current file
/foo
" Replace all occurrences of 'foo' with 'bar'
:%s/foo/bar/g
- Working with multiple files:
" Open a new file in a split window
:sp filename
" Switch between split windows
Ctrl-w h " move to the left window
Ctrl-w j " move to the window below
Ctrl-w k " move to the window above
Ctrl-w l " move to the right window
- Using macros:
" Start recording a macro named 'a'
qa
" Perform your actions...
" Stop recording the macro
q
" Play the macro named 'a'
@a
Getting Started
-
Install Vim:
- On Ubuntu/Debian:
sudo apt-get install vim
- On macOS with Homebrew:
brew install vim
- On Windows: Download the installer from the official Vim website
- On Ubuntu/Debian:
-
Open Vim in your terminal:
vim
-
Enter insert mode to start typing:
i
-
Exit insert mode and save your file:
<Esc> :w filename.txt
-
Quit Vim:
:q
-
For a guided introduction, run the Vim tutor:
vimtutor
Competitor Comparisons
Vim-fork focused on extensibility and usability
Pros of Neovim
- Built-in terminal emulator for seamless integration
- Asynchronous plugin architecture for improved performance
- Lua scripting support, offering a more modern and powerful configuration language
Cons of Neovim
- Potential compatibility issues with some Vim plugins
- Steeper learning curve for users transitioning from traditional Vim
- Smaller ecosystem compared to Vim's long-established community
Code Comparison
Vim configuration (vimrc):
set nocompatible
filetype plugin indent on
syntax enable
set number
set expandtab
Neovim configuration (init.vim or init.lua):
vim.opt.compatible = false
vim.cmd('filetype plugin indent on')
vim.cmd('syntax enable')
vim.opt.number = true
vim.opt.expandtab = true
The code comparison shows that while Vim uses traditional VimScript for configuration, Neovim allows for Lua-based configuration, which can be more intuitive and powerful for some users. However, Neovim still supports VimScript for backwards compatibility.
Both Vim and Neovim are powerful text editors with strong communities and extensive plugin ecosystems. The choice between them often comes down to personal preference and specific use cases.
Mirror of GNU Emacs
Pros of Emacs
- Highly extensible with Emacs Lisp, allowing for deep customization
- Built-in package manager (package.el) for easy installation of extensions
- Org-mode for powerful note-taking, task management, and document authoring
Cons of Emacs
- Steeper learning curve, especially for non-programmers
- Slower startup time compared to Vim
- Default key bindings can be less ergonomic, potentially leading to "Emacs pinky"
Code Comparison
Vim (vimscript):
function! GreetUser(name)
echo "Hello, " . a:name . "!"
endfunction
Emacs (Emacs Lisp):
(defun greet-user (name)
(interactive "sEnter your name: ")
(message "Hello, %s!" name))
Both editors support powerful scripting languages, but Emacs Lisp is generally considered more versatile and easier to work with for complex extensions. Vim's scripting language is more tightly integrated with the editor's core functionality, while Emacs Lisp allows for broader system-wide customization.
Emacs tends to have a more unified ecosystem with its built-in package manager, while Vim relies more on third-party plugin managers. However, Vim's modal editing paradigm is often praised for its efficiency in text manipulation tasks.
:star: Vim for Visual Studio Code
Pros of VSCodeVim
- Integrates Vim keybindings and functionality into VS Code's modern IDE environment
- Easier setup and configuration for users familiar with VS Code
- Regular updates and active community support
Cons of VSCodeVim
- May not fully replicate all native Vim features and behaviors
- Performance can be slower compared to native Vim, especially for large files
- Potential conflicts with other VS Code extensions or settings
Code Comparison
VSCodeVim:
// Example of VSCodeVim configuration in settings.json
"vim.useSystemClipboard": true,
"vim.hlsearch": true,
"vim.incsearch": true,
"vim.easymotion": true,
"vim.leader": "<space>"
Vim:
" Example of native Vim configuration in .vimrc
set clipboard=unnamed
set hlsearch
set incsearch
let g:EasyMotion_do_mapping = 0
let mapleader = " "
The code comparison shows how similar functionality can be achieved in both environments, with VSCodeVim using JSON-based settings and native Vim using its traditional configuration syntax. While the core concepts remain the same, the implementation and syntax differ between the two platforms.
Native, lightweight modal code editor
Pros of Oni2
- Modern UI with a sleek, customizable interface
- Built-in language server protocol (LSP) support for enhanced code intelligence
- Cross-platform compatibility (Windows, macOS, Linux)
Cons of Oni2
- Larger resource footprint compared to traditional Vim
- Steeper learning curve for users transitioning from vanilla Vim
- Less extensive plugin ecosystem than Vim's vast collection
Code Comparison
Oni2 configuration (in JavaScript):
oni.config.set("ui.fontFamily", "Fira Code");
oni.config.set("editor.fontSize", 14);
oni.config.set("editor.lineNumbers", "relative");
Vim configuration (in Vimscript):
set guifont=Fira\ Code:h14
set number relativenumber
set linebreak
While both editors allow for extensive customization, Oni2 uses a more modern JavaScript-based configuration approach, whereas Vim relies on its traditional Vimscript language. Oni2 aims to provide a more user-friendly experience with its default settings and GUI, while Vim offers unparalleled flexibility and a lighter footprint at the cost of a steeper initial learning curve.
A post-modern modal text editor.
Pros of Helix
- Modern, Rust-based implementation with better performance and memory safety
- Built-in language server protocol (LSP) support for advanced code intelligence
- Modal editing with a more intuitive and consistent keybinding system
Cons of Helix
- Smaller ecosystem and fewer plugins compared to Vim's extensive collection
- Less customizable due to configuration limitations and lack of scripting language
- Steeper learning curve for users already familiar with Vim's keybindings
Code Comparison
Vim configuration (.vimrc
):
set nocompatible
filetype plugin indent on
syntax enable
set number
set expandtab
Helix configuration (config.toml
):
theme = "gruvbox"
[editor]
line-number = "relative"
mouse = false
rulers = [80]
Both editors support customization, but Vim's approach is more flexible and extensive, while Helix aims for a more streamlined, out-of-the-box experience. Vim's scripting capabilities allow for complex plugins and configurations, whereas Helix focuses on providing a modern, efficient editing experience with built-in features like LSP support and tree-sitter integration.
A modern and intuitive terminal-based text editor
Pros of micro
- Easier learning curve for beginners
- Modern, intuitive interface with mouse support
- Built-in features like auto-indent and soft-wrap
Cons of micro
- Less extensible compared to Vim's plugin ecosystem
- Fewer advanced text manipulation features
- Limited customization options for power users
Code comparison
micro:
func (v *View) Insert(pos int, value []byte) {
v.Buf.Insert(pos, value)
v.Cursor.Loc = v.Cursor.Loc.Move(Count(value), v.Buf)
}
Vim:
void ins_char(int c)
{
char_u *p;
int n = (int)STRLEN(get_cursor_pos_ptr());
p = alloc(n + 2);
mch_memmove(p, get_cursor_pos_ptr(), n);
p[n] = c;
p[n + 1] = NUL;
ml_replace(curwin->w_cursor.lnum, p, FALSE);
changed_bytes(curwin->w_cursor.lnum, curwin->w_cursor.col);
}
The code snippets show basic text insertion functions. micro's implementation is more concise and uses Go's built-in slice manipulation, while Vim's C code handles memory allocation and string manipulation manually.
Convert
designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
If you find a bug or want to discuss the best way to add a new feature, please open an issue. If you have a question or want to discuss the best way to do something with Vim, you can use StackExchange or one of the Maillists.
What is Vim?
Vim is a greatly improved version of the good old UNIX editor
Vi. Many new
features have been added: multi-level undo, syntax highlighting, command line
history, on-line help, spell checking, filename completion, block operations,
script language, etc. There is also a Graphical User Interface (GUI)
available. Still, Vi compatibility is maintained, those who have Vi "in the
fingers" will feel at home.
See runtime/doc/vi_diff.txt
for differences with
Vi.
This editor is very useful for editing programs and other plain text files. All commands are given with normal keyboard characters, so those who can type with ten fingers can work very fast. Additionally, function keys can be mapped to commands by the user, and the mouse can be used.
Vim runs under MS-Windows (7, 8, 10, 11), macOS, Haiku, VMS and almost all flavours of UNIX. Porting to other systems should not be very difficult. Older versions of Vim run on MS-DOS, MS-Windows 95/98/Me/NT/2000/XP/Vista, Amiga DOS, Atari MiNT, BeOS, RISC OS and OS/2. These are no longer maintained.
For Vim9 script see README_VIM9.
Distribution
You can often use your favorite package manager to install Vim. On Mac and Linux a small version of Vim is pre-installed, you still need to install Vim if you want more features.
There are separate distributions for Unix, PC, Amiga and some other systems.
This README.md
file comes with the runtime archive. It includes the
documentation, syntax files and other files that are used at runtime. To run
Vim you must get either one of the binary archives or a source archive.
Which one you need depends on the system you want to run it on and whether you
want or must compile it yourself. Check https://www.vim.org/download.php for
an overview of currently available distributions.
Some popular places to get the latest Vim:
- Check out the git repository from GitHub.
- Get the source code as an archive.
- Get a Windows executable from the vim-win32-installer repository.
Compiling
If you obtained a binary distribution you don't need to compile Vim. If you
obtained a source distribution, all the stuff for compiling Vim is in the
src
directory. See src/INSTALL
for instructions.
Installation
See one of these files for system-specific instructions. Either in the READMEdir directory (in the repository) or the top directory (if you unpack an archive):
README_ami.txt Amiga
README_unix.txt Unix
README_dos.txt MS-DOS and MS-Windows
README_mac.txt Macintosh
README_haiku.txt Haiku
README_vms.txt VMS
There are other README_*.txt
files, depending on the distribution you used.
Documentation
The Vim tutor is a one hour training course for beginners. Often it can be
started as vimtutor
. See :help tutor
for more information.
The best is to use :help
in Vim. If you don't have an executable yet, read
runtime/doc/help.txt
.
It contains pointers to the other documentation files.
The User Manual reads like a book and is recommended to learn to use
Vim. See :help user-manual
.
Copying
Vim is Charityware. You can use and copy it as much as you like, but you are
encouraged to make a donation to help orphans in Uganda. Please read the file
runtime/doc/uganda.txt
for details (do :help uganda
inside Vim).
Summary of the license: There are no restrictions on using or distributing an unmodified copy of Vim. Parts of Vim may also be distributed, but the license text must always be included. For modified versions, a few restrictions apply. The license is GPL compatible, you may compile Vim with GPL libraries and distribute it.
Sponsoring
Fixing bugs and adding new features takes a lot of time and effort. To show your appreciation for the work and motivate developers to continue working on Vim please send a donation.
The money you donated will be mainly used to help children in Uganda. See
runtime/doc/uganda.txt
. But at the same time
donations increase the development team motivation to keep working on Vim!
For the most recent information about sponsoring look on the Vim web site: https://www.vim.org/sponsor/
Contributing
If you would like to help make Vim better, see the CONTRIBUTING.md file.
Information
If you are on macOS, you can use MacVim.
The latest news about Vim can be found on the Vim home page: https://www.vim.org/
If you have problems, have a look at the Vim documentation or tips: https://www.vim.org/docs.php https://vim.fandom.com/wiki/Vim_Tips_Wiki
If you still have problems or any other questions, use one of the mailing lists to discuss them with Vim users and developers: https://www.vim.org/maillist.php
If nothing else works, report bugs directly to the vim-dev mailing list:
<vim-dev@vim.org>
Main author
Most of Vim was created by Bram Moolenaar <Bram@vim.org>
Bram-Moolenaar
Send any other comments, patches, flowers and suggestions to the vim-dev mailing list:
<vim-dev@vim.org>
This is README.md
for version 9.1 of Vim: Vi IMproved.
Top Related Projects
Convert
designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot