Vim
General
Vim is a powerful text editor. Keystrokes can be chained together to combine actions, movements and selections into coolness. Folk using Vim 20 years still don't know it all. See also Emacs (and take care of your wrists (and posture)).
todo; big refactor to rearrange commands into motion, action, etc.
See also Documents
Quick
- VIM Reference Card
- Vim Quick Reference Card
- bullium.com Cheat Sheet
- vi/vim cheatsheet
- vim tips and trick
- normal mode and visual mode keys
- Best of Vim Tips by zzapper
- Vim Cheat Sheet
- https://github.com/liuchengxu/vim-which-key - Vim plugin that shows keybindings in popup
Articles
- The Invisible Interface [1] (xx is with script)
- Vim for people who think things like Vim are weird and hard [2]
- Learn Vim Progressively
- Your problem with Vim is that you don't grok vi.
- Learn to speak vim – verbs, nouns, and modifiers!
- Vim anti-patterns [3] [4]
- This is Your Brain on Vim - 15 Dec 2010
- Why Vim?
- Vim: revisited
- vim_faq.txt [5]
- Vim Galore [6]
- :best of Vim - Showcasing the top Vim plugins, tips and tricks.
Images
- Cheatsheet for programmers - Part of the deep end!
- vi/vim graphics cheatsheet kinda reduced o the above ([8] w/ black back)
- Shortcut layout - a sample of movement/selection, layed out in their direction
Video
- YouTube: a rubbish tutorial for the text editor vi / vim - funny basic
- YouTube: 7 Habits For Effective Text Editing 2.0 - "A large percentage of time behind the computer screen is spent on editing text. Investing a little time in learning more efficient ways to use a text editor pays itself back fairly quickly. This presentation will give an overview of the large number of ways of using Vim in a smart way to edit programs, structured text and documentation. Examples will be used to make clear how learning a limited number of habits will avoid wasting time and lower the number of mistakes. Bram Moolenaar is mostly known for being the benevolent dictator of the text editor Vim."
- YouTube: deavim with pycharm - good quick overview of commands
- Welcome to Vim - from Derek Wyatt
- YouTube: Vim Training Classes
- Vimcasts.org by Drew Neil
to sort
- OpenVim - a web-based project to let people quickly have a taste what kind of an editor Vim is. Vim is considered to be very useful but can feel devastatingly opaque at first. Hopefully this tutorial makes people feel more comfortable to give it a chance. OpenVim is based on a custom engine that interprets vim commands. Fun fact: the engine operates directly on the dom but can be easily refactored to a model that is not view-dependent.
- Vim Genius - Increase your speed and improve your muscle memory with Vim Genius, a timed flashcard-style game designed to make you faster in Vim. It’s free and you don’t need to sign up.
- Snake Vim Trainer - Hone your vim navigation skillz. Make your Vim snake eat the food to increase your score. You can only eat food while INSERT mode is on. You cannot change direction while INSERT mode is on
- VimGolf - Real Vim ninjas count every keystroke - do you? Head on over to vimgolf.com, pick a challenge, and show us what you've got! Each challenge provides an input file, and an output file. Your goal is to modify the input file such that it matches the output. Once you install the vimgolf CLI, pick a challenge, open a prompt and put away! When you launch a challenge from the command line, it will be downloaded from the site and a local Vim session will be launched, which will log every keystroke you make. Once you're done, simply :wq (write and quit) the session and we will score your input and upload it back to the site!
gem install vimgolf vimgolf setup vimgolf put [challenge ID]
- Vim Master - Android app that was created in order to master the operation of vim editor. You can learn a vim operations in quiz format. There are three types of difficulty, Easy, Normal, and Hard. There are 150 questions in total. There are explanations for all questions. You can browse the history of the answered results of yours and other players. You can register your name as Vim Masters for the top grades. This app supports English and Japanese.
- Coming Home to Vim
- Vim as your IDE
- Bespoke Vim
- Textmate to Vim - how to reproduce over 110 commands from Textmate in VIM.
- The Woodnotes Guide to Vim for Writers - Randall Wood
- Writing Prose with Vim
- Writing with Vim
- Writegood.vim - Writegood is a plugin to highlight common writing problems. The plugin uses the Error group to highlight errors, so I assume it will work on both gvim and terminal vim. Detects duplicate words (even over newlines). Highlights use of passive voice. Highlights common "weasel words"
- https://github.com/wikitopian/hardmode - Hard Mode is a plugin which disables the arrow keys, the hjkl keys, the page up/down keys, and a handful of other keys which allow one to rely on character-wise navigation. The philosophy behind Hard Mode is that you'll never master Vim's advanced motion and search functionality if you can fall back on the anti-pattern of fumbling around your code with the arrow keys.
Install
Some scripts require Vim 7.3, but some distros have older builds. You can build 7.3 locally though or use a provision system.
Had syntax issue errors. Rumtime path also should include distro base config..; http://www.linuxquestions.org/questions/linux-software-2/vim-syntax-highlight-fails-after-debian-upgrade-378073/
Packages and support
Building
Debugging
:map ; what is ; mapped to :verbose map ; include where ; is mapped from
Modes
Normal
:help Normal-mode
Insert
:help Insert-mode
i enter insert mode from normal mode r enter replace mode - deletes selected character, enters insert then returns to normal after a new character has been entered
Ctrl-o perform normal mode command in insert mode
Ctrl-Y copy character from line above Ctrl-E copy character from line below
Visual
:help Visual-mode
v enter visual mode from normal mode V enter visual linewise mode Ctrl+v enter visual block mode
- https://github.com/thinca/vim-visualstar - provides a star (*) feature for Visual-mode. In other words, you can search your selection text in Visual-mode.
- https://github.com/terryma/vim-expand-region - allows you to visually select increasingly larger regions of text using the same key combination.
- https://github.com/thoughtstream/Damian-Conway-s-Vim-Setup/blob/master/plugin/dragvisuals.vim - Vim global plugin for dragging virtual blocks
Select
:help Select-mode
like the visual mode but with more CUA like behavior. if you type a single character it replaces the selection. you lose access to all one key operations on selections.
This mode is usually activated by:
:behave mswin activate select mode (default for MS-Windows installations)
:behave xterm return to normal mode
Command-line
:help Command-line-mode
: enter command-line mode
Ex
:help Ex-mode
Q enter :Ex mode :visual exit :Ex mode
Ctrl-B beginning of line Ctrl-E end of line
:%!markdown # % = all lines, ! = external command, markdown = a md2html app
File operations
Command line
vim filename edit file (or create a buffer if file doesn't exist)
If you want to start vim with several files in a splitted window, just type;
vim -o a b c
for the horizontal split, and
vim -O a b c
for the vertical split.
- https://github.com/c00kiemon5ter/v - z for vim. uses viminfo's list of recently edited files to open one quickly no matter where you are in the filesystem. by default, it will open the most recently edited file matching all of the provided regular expressions.
In Vim
:e filename open filename in vim :w save :w filename save as :q quit if saved :x save if changed and quit, same as :wq ZZ save as above ZQ even if not saved (also :q!) :ex . explore files in file directory. opens in split pans if file modified. :Sex as above but forces split :Vex as above but vertical split :Tex as above but in new tab <enter> open file o open file in new split buffer
display;
:echo @% directory/name of file :echo expand('%:t') name of file ('tail') :echo expand('%:p') full path :echo expand('%:p:h') directory containing file ('head')
:Explore :e ..
- Oil and vinegar - split windows and the project drawer - "Split windows and the project drawer go together like oil and vinegar. I don't mean to say that you can combine them to create a delicious salad dressing. I mean that they don't mix well!" -Drew Neil
- https://github.com/tpope/vim-vinegar - enhances netrw, partially in an attempt to mitigate the need for more disruptive "project drawer" style plugins. Some of the behaviors added by vinegar.vim would make excellent upstream additions. Many, the author would probably reject. Others are a bit too wild to even consider.
- https://github.com/dhruvasagar/vim-vinegar - fork of vinegar.vim works with NERDTree instead for a better user experience.
- https://github.com/scrooloose/nerdtree - a file system explorer for the Vim editor. Using this plugin, users can visually browse complex directory hierarchies, quickly open files for reading or editing, and perform basic file system operations.
- https://github.com/Xuyuanp/nerdtree-git-plugin - plugin of NERDTree showing git status flags. Works with the LATEST version of NERDTree.
- https://github.com/Shougo/vimfiler.vim - A powerful file explorer implemented in Vim script
- https://github.com/justinmk/vim-gtfo - Opens the file manager or terminal at the directory of the current file in Vim.
Cursor
:set cursorline
- https://github.com/ntpeters/vim-airline-colornum - Sets the cursor line number to the same color as the current mode in the statusline set by the Vim Airline plugin.
- https://github.com/terryma/vim-multiple-cursors - True Sublime Text style multiple selections for Vim
Motion
gg start of file G end of file 123G move to line 123 :123 move to line 123 (easier imo)
0 line beginning ^ first non-whitespace character $ line end
w forward to start next word W forward to start of next WORD (ignoring hyphens, etc.) e forward to end of word E forward to end of WORD (ignoring hyphens, etc.) b backward word B backward WORD ge backward to the end of word [count] |inclusive|. gE backward to the end of WORD [count] |inclusive|. [13]
( beginning of previous sentence ) next sentence % current brace
{ beginning of previous } next paragraph
H cursor to top of screen (high) M cursor to middle of screen (middle) L cursor to bottom of screen (low) Ctrl-D move cursor down half-page Ctrl-U move cursor up half-page ma mark cursor position 'a' 'a move to mark position 'a'
:jumps Display the jump list for the current window with:
Ctrl-o move back location Ctrl-i move forward location
g;
gj move down a soft linebreak line g, move back one edit list location g, move forward one edit list location
zz centre screen on cursor zt move screen top to cursor zb move screen bottom to cursor
Ctrl-e Moves screen up one line Ctrl-y Moves screen down one line Ctrl-u Moves screen up ½ page Ctrl-d Moves screen down ½ page Ctrl-b Moves screen up one page Ctrl-f Moves screen down one page [14]
- https://github.com/tpope/vim-rsi - You know Readline key bindings? Of course you do, they're in your shell, your REPL, and perhaps even the GUI for your OS. They're similar to Emacs key bindings (C-a for home), but with several concessions for UNIX (C-w for delete word). With rsi.vim, I've taken that same concession philosophy and extended it to Vim. Get the most useful of the ubiquitous key bindings without blindly overriding built-in Vim functionality.
Finding things
/ search for text * search for text under cursor n repeat search forwards N repeat search backwards
fX move to next X on same line 3FX move to third last X on same line tX move to character before next X on same line T2X move to second previous X on same line ; repeat find/to movement command , repeat find/to movement in opposite direction
- https://github.com/svermeulen/vim-extended-ft - adds the following behaviour to the default behaviour of the f, F, t, and T commands: Multiline - Can search across multiple lines or continue searching across multiple lines using ; and , keys, Smart Case - When the search character is lower case it matches both lower and upper case, and when the character is uppercase it matches only upper case. Allow repeating t and T commands using ; or , commands. Highlighting - Which is disabled automatically when moving your cursor afterwards. It's also worth noting that it only adds the new position to the jumplist if you've changed lines.
- https://github.com/dahu/vim-fanfingtastic - a Vim plugin that enhances the builtin F f , T t and ; keys by allowing them to wrap over lines with the full gamut of normal, visual and operator pending mode supported. This is all the default configuration of Fanf,ingTastic; provides, however the following enhanced functionality can be enabled through configuration options: Case insensitivity: Fanf,ingTastic; is case sensitive by default but can be set to ignore case so that fx will match either x or X. Aliases: Fanf,ingTastic; allows you to create aliases which specify a set of characters that will be scanned for when FfTt;, is used on that alias
- Seek is a vim plugin that aims to make inline navigation effortless. The motion seek, summoned with s by default, is similar to f, but instead of one it expects two characters.
- compview - find string, with interactive search window
- EasyMotion provides a much simpler way to use some motions in vim. It takes the <number> out of <number>w or <number>f{char} by highlighting all possible choices and allowing you to press one key to jump directly to the target.
- ACEJUMP - Based on emacs' AceJump feature (http://www.emacswiki.org/emacs/AceJump). AceJump based on these Vim plugins: EasyMotion (http://www.vim.org/scripts/script.php?script_id=3526), PreciseJump (http://www.vim.org/scripts/script.php?script_id=3437) [16] - Type AJ mapping, followed by a lower or uppercase letter. All words on the screen starting with that letter will have their first letters replaced with a sequential character. Type this character to jump to that word.
- buffergrep - Grep buffers, not files
- Command-T - plug-in for VIM provides an extremely fast, intuitive mechanism for opening files with a minimal number of keystrokes. It's named "Command-T" because it is inspired by the "Go to File" window bound to Command-T in TextMate. Files are selected by typing characters that appear in their paths, and are ordered by an algorithm which knows that characters that appear in certain locations (for example, immediately after a path separator) should be given more weight. [17]
- FuzzyFinder - FuzzyFinder provides convenient ways to quickly reach the
buffer/file/command/bookmark/tag you want. FuzzyFinder searches with the fuzzy/partial pattern to which it converted an entered pattern.
- ctrlp.vim - Full path fuzzy file, buffer, mru, tag, ... finder for Vim.
- https://github.com/wincent/ferret - Enhanced multi-file search for Vim
Line numbers
- http://myusuf3.github.com/numbers.vim - requires vim 7.3, not in debian squeeze backports and some shared hosting. compile latest instead..
Operations
. repeat last change. doesn't work with plugin actions without script.
i insert at cursor I insert at line beginning
a append after the cursor A append at the end of the line
o add ('open') line below and insert O add line above and insert
x delete character under cursor X delete character before cursor
s change one character and insert
Delete, yank and paste
Cut, copy, paste.
- http://benmccormick.org/2014/07/28/learning-vim-in-2014-copy-and-paste-the-vim-way/
- http://vimcasts.org/blog/2013/11/registers-the-good-the-bad-and-the-ugly-parts/
y yank (copy) current text yy yank current line "+yy yank current line to system clipboard :%y+ yank all lines to clipboard [19]
d delete and yank (cut) df* delete to (find) and including * dl delete character (alias: "x") dd delete current line including linebreak dw delete to end of word from cursor including space dE delete to end of word from cursor leaving spae d$ delete to end of line from cursor diw delete inner word diW delete inner WORD daw delete word, up to delimiter daW delete WORD, including previous space dis delete inner sentence das delete a sentence dib delete inner '(' ')' block dab delete a '(' ')' block dip delete inner paragraph dap delete a paragraph diB delete inner '{' '}' block daB delete a '{' '}' block
3dk would delete 4 lines in the upward direction
"add delete line, yank to 'a' register "Add delete line, append yank to 'a' register "_d delete line to blackhole register (no yank)
p paste yanked text after cursor/line P paste yanked text before cursor/line "ap paste 'a' register "0p paste last yanked (not deleted) item
Change
c - change (delete and insert) cc delete current line including linebreak, insert cw delete to end of word from cursor, insert c$ delete to end of line from cursor, insert ciw delete inner word, insert ci" change inner quoted string ci( change inner brackets ci[ change inner contents of [].. ci], ci) for insert on closing bracket caw change an object caW change an object, including space etc.
Visual
Selection highlighting.
v visual select text viw visual inner word viw~ visual inner word, toggle case vip visual inner paragraph vec visual, end of word, change highlighted V visual select lines Ctrl-v visual select a block
Vim now supports incrementing numbers in Visual mode. You can increment numbers by pressing CTRL-A, and decrement with CTRL-X. [20]
Indentation
> # indent right < # indent left
= # fix indentation for selection == # fix indentation for one line V= # visual select lines, then reformat with =
" If you select one or more lines, you can use < and > for sihifting them sidewards. Unfortunately you immediately lose the selection afterwards. You can use gv to reselect the last selection (see :h gv), thus you can work around it like this in your config:
xnoremap < <gv xnoremap > >gv
Auto-completion
Ctrl-N auto-completion next match Ctrl-P auto-completion previous match
Search and replace
:s/foo/bar/ - search and replace first occurrence :s/foo/bar/s - search and replace, global current line :%s/foo/bar/g - search and replace, global whole file :%s/foo/bar/gc - search and replace, with confirm
Global action
:[range]g/pattern/cmd
:g/LinesThatMatchThisRegex/ExecuteThisCommand
:g/text string/d delete all lines with text string :!g/text string/d delete all lines without text string [22] :g/pattern/d_ fast delete
:g!/^\s*#/d delete all lines without a #
qaq:g/pattern/y A Explanation qaq is a trick to clear register a (qa starts recording a macro to register a, then q stops recording, leaving a empty). y A is an Ex command (:help :y). It yanks the current line into register A (append to register a).
Macros
qa - start recording macro 'a', q - stop recording qA - start appending to macro 'a' @a - play macro a @@ - execute again 3@a - play macro 3 thrice :let @a='macrogoeshere' - write macro manually Ctrl-R Ctrl-R a - insert mode :let @a='Ctrl-R Ctrl-R a - edit existing macro
(macros are saved in registers)
Registers
"adw delete word into the a register "_dw delete word into no register "* system clipboard
Sorting
Spaces
Buffers
An area of Vim's memory used to hold text read from a file. In addition, an empty buffer with no associated file can be created to allow the entry of text.
:b [buffer number of any part of name] switch to a buffer
set wildchar=<Tab> wildmenu wildmode=full with this, :b [tab] gives a menu
:bd close buffer
- https://github.com/qpkorr/vim-bufkill - provides :BD for close buffer but leave split window open
- spinner.vim : fast buffer/file/tab/window switching plugin with only 3 keys.
Windows
Windows are like tmux panes, awesome clients, i3 windows, etc. Windows can hold file buffers or plugins like Nerdtree, which are browsable via searches, etc.
:sp [filename] open file in new split window
Ctrl-W w move forward window Ctrl-W W move backwards window
Ctrl-W then h, j, k, l move window focus to left, below, above, right
Ctrl-W then H, J, K, L move window in the direction of left, below, above, right
Ctrl-W x switch windows around
Ctrl-W = balance window splits Ctrl-W _ maximize focused window horizontally Ctrl-W | maximize focused window vertically
:qall quit all buffer windows on current tab
- golden-ratio - Resize windows automatically using the Golden Ratio
- https://github.com/vim-scripts/zoomwintab.vim - doesn't work with dwm.vim
dwm.vim
map <silent> <C-J> <C-W>w map <silent> <C-K> <C-W>W map <silent> <C-,> :call DWM_Rotate(0)<CR> map <silent> <C-.> :call DWM_Rotate(1)<CR> map <silent> <C-N> :call DWM_New()<CR> map <silent> <C-C> :call DWM_Close()<CR> map <silent> <C-Space> :call DWM_Focus()<CR> map <silent> <C-@> :call DWM_Focus()<CR> map <silent> <C-H> :call DWM_GrowMaster()<CR> map <silent> <C-L> :call DWM_ShrinkMaster()<CR>
Tabs
- https://stackoverflow.com/questions/102384/using-vims-tabs-like-buffers - advice is generally not to go down that path
:tab new or :tabe create new tab :tabc close tab
:tabs list existing tabs
gt go to next tab gT go to previous tab {i}gt go to tab in position i
:tab drop {file} open {file} in a new tab, or jump to a window/tab containing the file if there is one :tab split copy the current window to a new tab of its own :tabm [n] move tab to nth position :tabm move tab to last :tab ball split all buffers into tabs :tab help open a new help window in its own tab page
:bufdo qall send qall command to all tabs :wqall! :xall! to check
- https://github.com/fholgado/minibufexpl.vim - a fork of Bindu Wavell's MiniBufExpl plugin for Vim.
- TabBar - derived from miniBufExplorer [26]
- https://github.com/gcmt/taboo.vim - tab names
- https://github.com/maxmeyer/vim-tabreorder
- https://github.com/kana/vim-tabpagecd
- https://github.com/benatkin/vim-move-between-tabs
- zoomwintab.vim - zoomwintab.vim is a simple zoom window plugin
Client/server
- http://vim.wikia.com/wiki/Enable_servername_capability_in_vim/xterm
- http://www.rohanjain.in/yet-another-vim-productivity-post-server-client/
- http://ajayfromiiit.wordpress.com/2009/10/21/server-and-client-mode-in-vim/
Sessions
:mks sessionsave.file save session vim -S sessionsave.file load session from cli
- https://github.com/xolox/vim-session - improves upon Vim's built-in :mksession command by enabling you to easily and (if you want) automatically persist and restore your Vim editing sessions. It works by generating a Vim script that restores your current settings and the arrangement of tab pages and/or split windows and the files they contain.
- https://github.com/tpope/vim-obsession - Vim features a :mksession command to write a file containing the current state of Vim: window positions, open folds, stuff like that. For most of my existence, I found the interface way too awkward and manual to be useful, but I've recently discovered that the only thing standing between me and simple, no-hassle Vim sessions is a few tweaks: Instead of making me remember to capture the session immediately before exiting Vim, allow me to do it at any time, and automatically re-invoke :mksession immediately before exit. Also invoke :mksession whenever the layout changes (in particular, on BufEnter), so that even if Vim exits abnormally, I'm good to go. If I load an existing session, automatically keep it updated as above. If I try to create a new session on top of an existing session, don't refuse to overwrite it. Just do what I mean. If I pass in a directory rather than a file name, just create a Session.vim inside of it. Don't capture options and maps. Options are sometimes mutilated and maps just interfere with updating plugins.
- https://github.com/mhinz/vim-startify - provides dynamically created headers or footers and uses configurable lists to show recently used or bookmarked files and persistent sessions. All of this can be accessed in a simple to use menu that even allows to open multiple entries at once.
Coding
- https://github.com/w0rp/ale - Asynchronous Lint Engine) is a plugin for providing linting in NeoVim and Vim 8 while you edit your text files.
- https://github.com/paradigm/TextObjectify - a Vim plugin which improves text-objects
- repmo.vim - repeat motions for which a count was given
- https://github.com/tpope/vim-repeat
- https://github.com/robmiller/vim-movar - a Vim plugin that adds a couple of movements that make working with variables easier.
- https://github.com/bkad/CamelCaseMotion - a Vim script to provide CamelCase motion through words
- https://github.com/coderifous/textobj-word-column.vim - word-based column text-object makes operating on columns of code conceptually simpler and reduces keystrokes.
- https://github.com/tpope/vim-surround - all about "surroundings": parentheses, brackets, quotes, XML tags, and more. The plugin provides mappings to easily delete, change and add such surroundings in pairs.
- https://github.com/tpope/vim-unimpaired - pairs of handy bracket mappings
- https://github.com/Raimondi/delimitMate - provides insert mode auto-completion for quotes, parens, brackets, etc.
- https://github.com/kurkale6ka/vim-pairs - Punctuation text objects: ci/ da; vi@ yiq da<space> ...
- https://github.com/sickill/vim-pasta - Pasting in Vim with indentation adjusted to destination context.
- https://github.com/nathanaelkane/vim-indent-guides is a plugin for visually displaying indent levels
- https://github.com/vim-scripts/Smart-Tabs - Use tabs for indent, spaces for alignment
- https://github.com/AndrewRadev/inline_edit.vim - Edit code that's embedded within other code. Execute :InlineEdit within the script tag. A proxy buffer is opened with only the javascript. Saving the proxy buffer updates the original one. You can reindent, lint, slice and dice as much as you like.
- https://github.com/PeterRincker/vim-argumentative - Argumentative aids with manipulating and moving between function arguments. Shifting arguments with <, and >, Moving between argument boundaries with [, and ], New text objects a, and i,
- https://github.com/AndrewRadev/sideways.vim - move function arguments (and other delimited-by-something items) left and right.
- https://github.com/kana/vim-arpeggio - Mappings for simultaneously pressed keys
Undo
u undo last change Ctrl-u undo whilst in insert mode U undo all changes to current line Ctrl-r redo
Ctrl-g create new undo point
- https://github.com/chrisbra/histwin.vim - for browsing the undo tree
- http://sjl.bitbucket.org/gundo.vim - a plugin to make browsing the undo tree less painful.
- https://github.com/mbbill/undotree - The ultimate undo history visualizer for VIM
Highlight
:so $VIMRUNTIME/syntax/hitest.vim # output all highlight groups
Alignment
- https://github.com/godlygeek/tabular - Vim script for text filtering and alignment
Completion
Ctrl-n # autocomplete keyword forwards Ctrl-p # autocomplete keyword backwards
Ctrl-x # completion mode
Ctrl-x Ctrl-f # filepath completion mode
- YouCompleteMe - a fast, as-you-type, fuzzy-search code completion engine for Vim. It has several completion engines: an identifier-based engine that works with every programming language, a semantic, Clang-based engine that provides native semantic code completion for C/C++/Objective-C/Objective-C++ (from now on referred to as "the C-family languages"), a Jedi-based completion engine for Python and an omnifunc-based completer that uses data from Vim's omnicomplete system to provide semantic completions for many other languages (Ruby, PHP etc.).[27]
- https://github.com/Shougo/neocomplcache - the abbreviation of "neo-completion with cache". It provides keyword completion system by maintaining a cache of keywords in the current buffer. neocomplcache could be customized easily and has a lot more features than the Vim's standard completion feature.
- https://github.com/ervandew/supertab - allows you to use <Tab> for all your insert completion needs (:help ins-completion).
Interface
- https://github.com/laktek/distraction-free-writing-vim - Collection of configurations I use to for my distraction free editing environment in Vim
- vim-pad - A quick notetaking plugin for vim.
- vimroom - Simulating a vaguely WriteRoom-like environment in Vim.
- scratch.vim - Plugin to create and use a scratch Vim buffer
- http://vim-voom.github.io/ - outliner pane
- https://github.com/junegunn/goyo.vim - Distraction-free writing in Vim.
- https://github.com/junegunn/limelight.vim - different font colors for the paragraph in which the cursor is operating and the other paragraphs. Normally it works the way that the paragraph with the cursor (in which I am writing) maintains the normal font color while the other paragraphs turn into a grey that does not raise attention anymore.
- https://github.com/amix/vim-zenroom2 - A Vim extension that emulates iA Writer environment when editing Markdown, reStructuredText or text files. It requires goyo.vim and it works by setting global Goyo callbacks that triggers special setup for Markdown, reStructuredText and text files.
Folds
Folds are sections of text reduced to one line (based on brackets, indentation, etc.). Folding is on by default. I have the foldlevel dialed up to 20 to avoid them.
zo - open fold zO - open fold recursively zc - close fold zC - close fold resursive zR - open all folds zM - close all zj - go down and up a fold zk - go up a fold
Git
- https://github.com/tpope/vim-fugitive - bestest gitwrapper
:Gwrite - git add file :Gread - git checkout (revert) open to staged version :Gremove - git rm and close buffer :Gmove - git mv file. with /, relative to git root; without, relative to file :Gcommit - git commit, opens message buffer :Gblame - open split window with git blame details :Gbrowse - open Github, else git instaweb for local sevrer
<c-w>h<c-w>c exit :Gdiff mode
vim#diff resolution:
:diffget [buffer] - get diff from another buffer :diffput [buffer] - put diff into another buffer :diffupdate - update diff colouring dg - get from other buffer pane (only 2 pane) dp - put to other buffer pane (works in 3 pane) [c - jump to previous changeset ]c - jump to next changeset :only - close buffers other than active
- https://github.com/airblade/vim-gitgutter - shows a git diff in the 'gutter' (sign column). It shows whether each line has been added, modified, and where lines have been removed. breaks vim on script load on server side git repos for me.
- https://github.com/mhinz/vim-signify - Sy sgitgutter.vim]hows all added, deleted and modified lines since the last commit via Vim its sign column. It supports several version control systems.
- https://github.com/gregsexton/gitv - a ‘gitk clone’ plugin for the text editor Vim. The goal is to give you a similar set of functionality as a repository viewer. Using this plugin you can view a repository’s history including branching and merging, you can see which commits refs point to. You can quickly and easily view what changed to which files and when. You can perform arbitrary diffs (using Vim’s excellent built in diff functionality) and you can easily check out whole commits and branches or just individual files if need be.
- https://github.com/wting/gitsessions.vim - Automatically saves and loads sessions based on the current working directory and git branch name after the first manual save.
- https://github.com/rhysd/committia.vim - When you type git commit, Vim starts and opens a commit buffer. This plugin improves the commit buffer. committia.vim splits the buffer into 3 windows; edit window, status window and diff window. You no longer need to repeat moving to another window, scrolling and backing to the former position in order to see a long commit diff.
Debugging
- https://github.com/skibyte/gdb-from-vim - A plugin to debug program with gdb by using vim
Syntax
General
- Syntastic is a syntax checking plugin that runs files through external syntax checkers and displays any resulting errors to the user. This can be done on demand, or automatically as files are saved. If syntax errors are detected, the user is notified and is happy because they didn't have to compile their code or execute their script to find them. At the time of this writing, syntax checking plugins exist for applescript, c, coffee, cpp, css, cucumber, cuda, docbk, erlang, eruby, fortran, gentoo_metadata, go, haml, haskell, html, javascript, json, less, lua, matlab, perl, php, puppet, python, rst, ruby, sass/scss, sh, tcl, tex, vala, xhtml, xml, xslt, yaml, zpt
- taglist.vim - Source code browser (supports C/C++, java, perl, python, tcl, sql, php, etc)
- Taglist-plus provides excellent Javascript support via jsctags- best fork of the fork
- https://github.com/Yggdroot/indentLine - display the indention levels with thin vertical lines
- https://github.com/chrisbra/Colorizer - A plugin to color colornames and codes
- https://github.com/junegunn/rainbow_parentheses.vim - A heavily-rewritten fork of kien/rainbow_parentheses.vim.
- https://github.com/luochen1990/rainbow - rainbow parentheses improved, shorter code, no level limit, smooth and fast, powerful configuration.
HTML
Highlighting
- MatchTagAlways.vim - highlights the XML/HTML tags that enclose your cursor location.
Creating and editing
- zencoding-vim vim plugins for HTML and CSS hi-speed coding.
- xml.vim : helps editing xml (and [x]html, sgml, xslt) files
CSS
- https://github.com/ap/vim-css-color - underlays the hexadecimal CSS colorcodes with their real color. The foreground color is selected appositely. So #FF0000 will look as hot as a fire engine! + Highlighting multiple colors on the same line (not sure if anyone uses it though), rgb and rgba color notation for all those fancy CSS3 niceties
- https://github.com/gorodinskiy/vim-coloresque
- https://github.com/hail2u/vim-css3-syntax - recent
- css3 - css3 syntax for vim
- https://github.com/ChrisYip/Better-CSS-Syntax-for-Vim - has vendor prefixes. breaks with scss [28] :/
SCSS
JavaScript
PHP
Other
- http://drupal.org/node/1303122 - drupal .info/make/build
- https://github.com/Firef0x/PKGBUILD.vim - Vim plugin to help editing and working with PKGBUILD files
Comments
- https://github.com/tomtom/tcomment_vim - comment add/remove
Doesn't work with some languages
gc{motion} toggle comments (for small comments) gcc toggle comment for the current line gC{motion} comment region gCc comment the current line
Modeline
- vim tips and tricks: modelines - modelines allow you to set variables specific to a file. By default, the first and last five lines are read by vim for variable settings. For example, if you put the following in the last line of a C program, you would get a textwidth of 60 chars when editing that file:
/* vim: tw=60 ts=2: */
The modelines variable sets the number of lines (at the beginning and end of each file) vim checks for initializations.
Arrow keys
Config
- http://yoursachet.com/ - create config
- http://vimbits.com/ - config snippets
- http://vim.wikia.com/wiki/Understanding_VIMRUNTIME
- http://vim.wikia.com/wiki/Set_VIMRUNTIME_within_vimrc
I chose /usr/share/config/vim
/usr/local/share/vim is a default $VIMRUNTIME though
If you're editing .vimrc, you can reload it with:
:so %
% stands for current file name (see :h current-file) and :so is short for :source, which reads the content of the specified file and treats it as Vim code. [29]
In general, to re-load the currently active .vimrc, use the following (see Daily Vim):
:so $MYVIMRC
Vimscripts
- Vim Awesome - a directory of Vim plugins sourced from GitHub, Vim.org, and user submissions. Plugin usage data is extracted from dotfiles repos on GitHub. [30]
- Vimpusher - Vim setup sharing
Script management
- pathogen.vim - Manage your 'runtimepath' with ease. In practical terms, pathogen.vim makes it super easy to install plugins and runtime files in their own private directories.
- Vundle is short for Vim bundle. Like pathogen but can install/update
- NeoBundle is Vim plugin manager based on Vundle.
- https://github.com/Shougo/dein.vim - replaces NeoBundle
- VAM - the short name for vim-addon-manager. You declare a set of plugins. VAM will fetch & activate them at startup or runtime depending on your needs. Activating means handling runtimepath and making sure all .vim file get sourced.
- vim-plug - A single-file Vim plugin manager. Somewhere between Pathogen and Vundle, but with faster parallel installer. [31]
- https://github.com/Carpetsmoker/packman.vim - simple Vim plugin/package manager. The ".vim" part of the name is a bit misleading, as it's really just a shell script. As the name hints, it relies on Vim's packages feature. At the time of writing, this is a relatively new feature that may not be available on your Vim. Use :echo has('packages') to find out. You can use pathogen to simulate this feature if your Vim is missing it.
Dashboard
- https://github.com/mhinz/vim-startify - If you start Vim without giving any filenames to it (or pipe stuff to it so it reads from STDIN), startify will show a small but pretty start screen which shows recently used files (using viminfo) and sessions by default. Additionally, you can define bookmarks, thus entries for files that always should be available in the start screen. It also eases handling of loading and saving sessions by only working with a certain directory.
Gist
- https://github.com/mattn/gist-vim - for creating gists
Status
- Powerline is a utility plugin which allows you to create better-looking, more functional Vim statuslines.
- SmartusLine is Vim plugin that changes the color of the statusline of the focused window according with the current mode (normal/insert/replace)
- https://github.com/edkolev/promptline.vim - Simple shell prompt generator with support for powerline symbols and airline integration
Services
- Vmail is a Vim interface to Gmail.
To sort
- https://github.com/Shougo/denite.nvim - a dark powered plugin for Neovim/Vim to unite all interfaces. It can replace many features or plugins with its interface. It is like a fuzzy finder, but is more generic. You can extend the interface and create the sources. Unite.vim was meant to be like Helm for Vim. But the implementation is ugly and it's very slow. Denite resolves Unite's problems.
- cmdalias.vim - Create aliases for Vim commands. [34]
- vimwiki - Personal Wiki for Vim
- https://github.com/jceb/vim-orgmode - Text outlining and task management for Vim based on Emacs’ Org-Mode
- snipMate.vim aims to be a concise vim script that implements some of TextMate's snippets features in Vim
- ZoomWin - Zoom in/out of windows (toggle between one window and multi-window)
- subvim - Vim customized to be like SublimeText
- spf13-vim - a distribution of vim plugins and resources for Vim, GVim and MacVim. It is a completely cross platform distribution that stays true to the feel of vim while providing modern features like a plugin management system, autocomplete, tags and tons more.
- http://drupal.org/project/vimrc
- http://reluctanthacker.rollett.org/software/drupavim - post content using blog api
Creating
- https://github.com/LimpidTech/Vimpy - allows you to write Vim plugins without writing any Vimscript. This is done by abstracting Vim commands through a Pythonic interface.
- https://github.com/google/vroom - for testing vim[scripts].
System
- Conque is a Vim plugin which allows you to run interactive programs, such as bash on linux or powershell.exe on Windows, inside a Vim buffer. In other words it is a terminal emulator which uses a Vim buffer to display the program output.
- https://github.com/vim-scripts/Conque-Shell - not latest version
:ConqueTerm zsh :ConqueTermSplit <command> :ConqueTermVSplit <command> :ConqueTermTab <command>
- browser-connect.vim - implements a VIM interface for browser-connect-server in order to provide a live coding environment similar to the one currently available in LightTable.
Math
- https://github.com/nixon/vim-vmath - Damian Conway's vmath plugin for vim as demonstrated at his OSCON 2013 "More Instantly Better Vim" presentation. Calculates the sum, average, min, and max for a visual region containing numbers.
Colours
- http://choorucode.com/2011/07/29/vim-chart-of-color-names/ - image of above
Themes
- Vivify - A ColorScheme Editor for Vim
- https://github.com/naquad/vim-picker - Color picker for console & GUI that can match colors.
Mouse
Voice
Tmux integration
- vimux - Easily interact with tmux from vim.
Remote
- netrw.vim : Network oriented reading, writing, and browsing
- http://sshmenu.sourceforge.net/articles/bcvi/ - open remote as local
Collaboration
- https://github.com/FredKSchott/CoVim - Collaborative Editing for Vim (One of Vim's most requested features) is finally here! Think Google Docs for Vim.
- https://github.com/guyzmo/vim-etherpad - Plugin to enable collaborative edition on etherpad with the best editor
Encryption
- gnupg.vim - Plugin for transparent editing of gpg encrypted files.
Handy
:e scp://root@example.com/~user/folder/.config open remote file $ vim scp://root@example.com/~user/folder/.config
:reg list register contents K in normal mode, run man for current word (opens "man word" in shell)
- stackoverflow: How to paste text into Vim command line
- https://github.com/mhinz/vim-startify - provides dynamically created headers or footers and uses configurable lists to show recently used or bookmarked files and persistent sessions. All of this can be accessed in a simple to use menu that even allows to open multiple entries at once. Startify doesn't get in your way and works out-of-the-box, but provides many options for fine-grained customization.
- https://github.com/vim-scripts/DrawIt - a plugin which allows one to draw lines left, right, up, down, and along both slants. Optionally one may "cap" the lines with arrowheads. One may change the horizontal, vertical, slant, and crossing characters to whichever characters one wishes.
- https://github.com/hsitz/VimOrganizer - like OrgMode
- http://vimcasts.org/blog/2013/05/vimprint---a-vim-keystroke-parser/ - parses Vim keystrokes and prints them prettily.
Vim everywhere
vim-anywhere
- https://github.com/cknadler/vim-anywhere - Once invoked, vim-anywhere will open a buffer. Close it and its contents are copied to your clipboard and your previous application is refocused.
File management
- http://vifm.sourceforge.net - Vi like hotkeys
Shell integration
- https://github.com/ardagnir/athame - Athame patches your shell to add full Vim support by routing your keystrokes through an actual Vim process. Athame can currently be used to patch readline (used by bash, gdb, python, etc) and/or zsh (which doesn't use readline). Don't most shells already come with a vi-mode? Yes, and if you're fine with basic vi imitations designed by a bunch of Emacs users, feel free to use them. ...but for the true Vim fanatics who sacrifice goats to the modal gods, Athame gives you the full power of Vim. [35]
- https://github.com/rkitover/vimpager - use vim as a pager
- Vimium - a Chrome extension that provides keyboard-based navigation and control of the web in the spirit of the Vim editor.
- https://github.com/ueokande/vim-vixen - Vim Vixen is a Firefox add-on which allows you to navigate with keyboard on the browser. Firefox started to support WebExtensions API and will stop supporting add-ons using legacy APIs from version 57. For this reason, many legacy add-ons do not work on Firefox 57. Vim Vixen is a new choice for Vim users since Vim Vixen uses the WebExtensions API.
Browser textarea
- wasavi - an extension for Chrome, Opera and Firefox. wasavi transforms TEXTAREA element of any page into a VI editor, so you can edit the text in VI. wasavi supports almost all VI commands and some ex commands. wasavi is under development. Any bug report or feature request is welcome.
- https://github.com/ardagnir/pterosaur - Firefox textarea
- textaid - Chrome extension. As Chrome can't spawn child processes, text is passed to a local server which launches Vim.
- GhostText 👻 - Use your text editor to write in your browser. Everything you type in the editor will be instantly updated in the browser (and vice versa).
- https://github.com/stsquad/emacs_chrome - A Chromium "clone" of It's All Text for spawning an editor to edit text areas in browsers. Based on David Hilley's original Chromium extension.
Javascript
hmm.
- http://gpl.internetconnection.net/vi/
- http://www.migniot.com/jsvim/
- http://codemirror.net/demo/vim.html
wasm
- https://github.com/rhysd/vim.wasm - Vim editor ported to WebAssembly [37]
Live editing
- https://github.com/jaxbot/brolink.vim - Browserlink is very simple. The plugin itself hooks autocommands for file changes (and other things) to the provided functions. The functions connect through HTTP to a node.js backend, which your webpage connects also to. The entire process happens extremely fast.
Neovim
- Neovim - a refactor, and sometimes redactor, in the tradition of Vim (which itself derives from Stevie). It is not a rewrite but a continuation and extension of Vim. Many clones and derivatives exist, some very clever—but none are Vim. Neovim is built for users who want the good parts of Vim, and more.