set list
Shows invisible characters.set listchars
What invisibile characters should be set to, see:h listchars
for complete list.
map
creates a key map that works in normal, visual, select and operator pending modesmap!
creates a key map that works in insert and command-line mode.
:nmap - Display normal mode maps
:imap - Display insert mode maps
:vmap - Display visual and select mode maps
:smap - Display select mode maps
:xmap - Display visual mode maps
:cmap - Display command-line mode maps
:omap - Display operator pending mode maps
noremap
is added when you don't want a mapping to be recursive e.g. map z to v, but not to what v is then mapped to. http://stackoverflow.com/a/3776182.<bar>
should be used in place of|
when used in map commands to distinguish it from a pipe
" Indenting in visual mode keeps the visual highlight.
vnoremap < <gv
vnoremap > >gv
" Yank from the cursor to the end of the line, to be consistent with C and D.
nnoremap Y y$
" Jump to start and end of line using the home row keys.
nnoremap H ^
nnoremap L $
" Fix the filetype for .md files.
augroup MarkDownType
autocmd!
autocmd BufNewFile,BufRead *.md setlocal filetype=markdown
augroup end
" Quick escape from insert mode.
inoremap jj <ESC>
When you see something like let g:some_variable = x
you're setting the value of a global variable.
To see all global variables let g:
.
From :help internal-variables
(nothing) In a function: local to a function; otherwise: global
buffer-variable b: Local to the current buffer.
window-variable w: Local to the current window.
tabpage-variable t: Local to the current tab page.
global-variable g: Global.
local-variable l: Local to a function.
script-variable s: Local to a :source'ed Vim script.
function-argument a: Function argument (only inside a function).
vim-variable v: Global, predefined by Vim.
Why let
vs. set
?
:set
is for setting options, :let
for assigning a value to a variable.
:edit .
to open a netrw buffer:e .
same as above
From within the netrw interface
<enter>
edit a file / enter a directoryP
edit file in most recent tab (or current tab if only one)-
go up a directory%
create an empty filed
create a directoryD
delete the selected itemR
rename the selected items
cycle through different sort options
- You can use visual highlighting to paste over text with
p
:reg
see all register contents:reg "0
see contents of register 0<C-r>"
in insert mode, paste the contents of the default register<C-r>0
in insert mode, paste the contents of register 0"+p
paste from the system copy / paste buffer (if multi-line, don't have toset paste
firstput +
paste contents of system copy / paste buffer"+
is the system clipboard"*
is the "mouse highlight" clipboard"0
holds last yank"1
holds last delete / change- So, you can use
"0
to paste yanked text after deleting / changing text p
paste after the cursorP
paste before the cursor"Ay
append text to registerA
(
or)
move backward or forward by "sentences"{
or}
move backward or forward by "paragraphs"g$
move to visual end of wrapped lineg0
move to visual beginning of wrapped line%
go to matching (), [], {} etc
:g/^$/d
delete all blank linesgqgq
format / wrap the current line:e %:h<TAB>
edit files in same directory as current file
Tabularize /<pattern>
Run the tabular plugin (does some smart multi-line matchingTab /<pattern>
Same as above<,'>Tab /=
Run tabularize on the selected text, targeting equal signs