VIM Notes

editor vim
Created on 2016-10-04 Last Modified 2016-10-04


VIM Basic

Some useful skills

Update VIM Pathogen Plugin

for i in ~/.vim/bundle/*; do git -C $i pull; done

Insert across multi-lines

Select the lines you want to modify using Ctrl-v. Press: I: Insert before what’s selected. A: Append after what’s selected. c: Replace what’s selected. Type the new text. Press Esc to apply the changes to all selected lines.

Search and replace

:s/foo/bar/g Change each ‘foo’ to ‘bar’ in the current line. :%s/foo/bar/g Change each ‘foo’ to ‘bar’ in all the lines.

VIM Plugin

Basic Settings

## General
set number  # Show line numbers
set linebreak # Break lines at word (requires Wrap lines)
set showbreak=+++ # Wrap-broken line prefix
set textwidth=100 # Line wrap (number of cols)
set showmatch # Highlight matching brace
set visualbell  # Use visual bell (no beeping)
 
set hlsearch  # Highlight all search results
set smartcase # Enable smart-case search
set ignorecase  # Always case-insensitive
set incsearch # Searches for strings incrementally
 
set autoindent  # Auto-indent new lines
set shiftwidth=4  # Number of auto-indent spaces
set smartindent # Enable smart-indent
set smarttab  # Enable smart-tabs
set softtabstop=4 # Number of spaces per Tab
 
## Advanced
set ruler # Show row and column ruler information
 
set undolevels=1000 # Number of undo levels
set backspace=indent,eol,start  # Backspace behaviour
 
 
## Generated by VimConfig.com

Plugins

Reference


comments powered by Disqus