Skip to content

Instantly share code, notes, and snippets.

@gmanley
Created February 19, 2012 08:28
Show Gist options
  • Save gmanley/1862614 to your computer and use it in GitHub Desktop.
Save gmanley/1862614 to your computer and use it in GitHub Desktop.
VIM Notes
# Various notes relating to my switch vim
ctrl-o in insert mode to switches you to normal mode for one command
then back to insert mode.
Key Movement
h Left
l Right
k Up a line
j Down a line
0 Start of line
^ First character of line
$ End of line
You can prefix these shortcuts with counts (as you can with many Vim
commands) which specify how many times they should be executed. For
instance, 2k moves up two lines.
Use `mvim -p` when opening files with globs to get a similar effect totextmate.
Use `:set autowrite` to saves files when you switch buffers.
Use :up instead of :w
"The more common command to save a file is :w, however this always saves
the file, even if it hasn't been changed. :up preserves timestamps and
saves needless disk access"
"Select a portion of a file visually then execute :up filename and the
text you selected will be written to a file named filename."
`x` to delete current character in normal mode or selected block in
visual mode.
Use :registers to view your recent deletions.
"To select text character by character change to Visual mode with v, then
move the cursor as normal using the h,j,k,l keys. For example, to select
the current character and the three that follow hit v, then 3l. To
select the current paragraph: v, then ap."
"To select text by lines switch to Visual Line mode with V, then move
upwards and downwards with k and j as normal. For example, to select the
current line and the 2 following it hit V, then 2j."
Start Vim in verbose mode: vim -V. (Describes each file being sourced).
http://www.jwz.org/doc/tabs-vs-spaces.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment