|
Windows
| Action | Key |
| close frame (saving changes) | ZZ |
| split window | ^ws |
| close window | ^wc |
| close all other windows | ^wo |
| next window | ^w^w |
| previous window | ^wk |
| go to 3rd window | 3^w^w |
start learning | start learning |
Windows II
| Question | Answer |
| new file (in new window) | ^wn |
| move window down | ^wr |
| move window up | ^wR |
| move up | ^w^k |
| move down | ^w^j |
| recenter | zz |
start learning | start learning |
Buffers / Replacing
| Action | Key |
| close buffer | :bd |
| see all *txt* buffers | :b txt [tab] |
| go to next search item | n |
| go to previous search item | N |
| Search and replace (on current line) | :s/old/new/g |
| Search and replace (on all lines) | :%s/old/new/g |
start learning | start learning |
Selecting and copying
| Action | Key |
| start selecting | v |
| copy (vim clipboard) | y |
| paste (vim clipboard) | p |
| copy (windows clipboard) | ^c |
| paste (windows clipboard) | ^v |
| select all | ^a |
| jump to other end of selection | o (while selecting) |
start learning | start learning |
Advanced selecting and copying
| Action | Key |
| create mark named a | ma |
| jump to mark named a | `a |
| copy current line | yy |
| select current line | V |
| copy up to a | y/a |
| select what you last had selected | gv |
start learning | start learning |
Advanced inserting
| Action | Key |
| insert (after current line) | o |
| insert (beginning of current line) | I |
| insert (above current line) | O |
| insert ls output (at current point) | :r !ls |
| insert f.txt (at current point) | :r f.txt |
start learning | start learning |
Macros
| Action | Key |
| start recording macro (named a) | qa |
| stop recording macro | q |
| execute macro (named a) | @a |
| rerun last macro | @@ |
start learning | start learning |
Helpful config file (.vimrc) settings
| Question | Answer |
| set incsearch | incremental searching |
| set ignorecase | case insensitive searching |
| set g:netrw_keepdir=0 | set current dir, when viewing a dir |
| :nmap ; : | make ; key behave like : |
start learning | start learning |
The last one is useful because it saves you from having to hold down the shift key ((while typing a command, such as :w))
Misc II
| Question | Answer |
| undo all changes to current line | U |
| show help | :h |
| help for the set command | :h set |
| vim irc channel | irc.openprojects.net #vim |
| Plugin to helps navigate buffers | bufexplorer |
| autocompletion | ^p (while inserting) |
| :abbreviate h hello | abbreviate h as hello |
start learning | start learning |
Packages
| Package | Description |
| netrw | edit files remotely |
| vimshell | run shells within vim (unix-only) |
| :Nread scp://you@yourserver.com/ | view remote directory |
start learning | start learning |
|
|
|
| |