Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
my vim cheatsheet.txt
## Vim
### Basic
enable line numbers :set number | :set nu
disable line numbers :set nonumber | :set nonu | :set nu!
enable relative numbers :set relativenumber
convert entire word to uppercace <leader>u
convert entire word to lowercase <leader>l
convert first char of word to uppercase <leader>U
convert first char of word to lowercase <leader>L
change cwd to current active buffer's file <leader>cd
mkdir current active buffer's file folder <leader>md # ie. when buffer's path does not exit
swap the current word with the one gw
underline the current line with = <leader>ul
toggle wrap <leader>tw
Finds the next conflict marker <leader>fc
toggle highlight search <leader>hs
adjust viewports to the same size <leader>=
expands to :e (dir current file) <leader>ew # opens same window
expands to :sp (dir current file) <leader>es # opens horizontal split
expands to :vsp (dir current file) <leader>ev # opens vertical split
expands to :tabe (dir current file) <leader>et # opens in new tab
write using sudo (if forgot sudo vi) :w!!
toggles paste mode <F4>
formats entire file <leader>fef
### [Ack.vim](http://github.com/mileszs/ack.vim)
Ack.vim uses ack to search inside the current directory for a pattern.
opens Ack.vim <leader>f
__shourtcuts__
open (same as enter) o
open and close quickfix window O
preview file (open and keep ack.vim results) go
open in new tab t
open in new tab silently T
open in horizontal split h
open in horizontal split silently H
open in vertical split v
open in vertical split silently gv
close the quickfix window q
### [CtrlP](https://github.com/kien/ctrlp.vim)
Fuzzy file, buffer, mru and tag finder. Replaces
opens CtrlP <c-p>
__shortcuts__
purge cache <F5>
cyble between modes <c-f> <c-b>
search filename only search or full path <c-d>
enable/disable regexp mode <c-r>
navigate result list <c-j> <c-k>
open selected entry in new tab or split <c-t> <c-v> <c-x>
select next/previous string on prompt hist <c-n> <c-p>
create new file and its parent dirs <c-y>
mark / unmark multiple file and open then <c-z> then <c-o>
### [NERDCommenter](http://github.com/ddollar/nerdcommenter)
NERDCommenter allows you to wrangle your code comments, regardless of
filetype.
comment current line (visual mode too) <leader>/
### [NERDTree](https://github.com/scrooloose/nerdtree)
NERDTree is a file explorer plugin that provides "project drawer"
functionality to your vim projects.
opens NERDTree <leader>n
__shortcuts__
get NERDTree help on navigation pane ?
create new node m
### [SuperTab](http://github.com/ervandew/supertab)
In insert mode, start typing something and hit `<TAB>` to tab-complete
based on the current context.
### [Syntastic](https://github.com/scrooloose/syntastic/)
Syntastic is a syntax checking plugin that runs buffers through external syntax
checkers as they are saved and opened.
### [Tagbar](https://github.com/majutsushi/tagbar)
Tagbar is a vim plugin for browsing the tags of source code files.
opens Tagbar <leader>rt
### [EasyMotion](https://github.com/Lokaltog/vim-easymotion)
EasyMotion provides a much simpler way to use some motions in vim.
show targets for words <leader><leader>w
search for one character above cursor <leader><leader>F
search for one character below cursor <leader><leader>f
search for one character full screen <leader><leader>s
goes up in the text <leader><leader>k
goes down in the text <leader><leader>j
### [NrrwRgn](https://github.com/chrisbra/NrrwRgn)
Narrowing means focussing on a region and making the rest inaccessible.
open selected text in a narrow window \nr
open selected region in a NR :NR
open current visual window in a NR :NW
(In NR) write the changes to original buffer :WidenRegion
Open NR for region visually selected :NRV
(In unified diff) open selected diff in 2 NRs :NUD
mark a region for a multi narrowed window :NRP
create a new multi narrowed window (after :NRP) :NRM
enable sync buffer content back (default on) :NRS
disable sync buffer content back :NRN
reselect last selected region and open in NR :NRL
arrowed window
### Git Support ([Fugitive](http://github.com/tpope/vim-fugitive))
Fugitive adds pervasive git support to git directories in vim.
Use `:Gstatus` to view `git status` and type `-` on any file to stage or
unstage it. Type `p` on a file to enter `git add -p` and stage specific
hunks in the file.
:Gblame <leader>gb
:Gstatus <leader>gs
:Gdiff <leader>gd
:Glog <leader>gl
:Gcommit <leader>gc
:Gitpush <leager>gp
### [ZoomWin](http://github.com/vim-scripts/ZoomWin)
When working with split windows, ZoomWin lets you zoom into a window
toogle Window zoom on current buffer <leader>zw
### [BufferGator](https://github.com/jeetsukumaran/vim-buffergator)
Buffergator is a plugin for listing, navigating between, and selecting
buffers to edit.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.