Note

The Funtoo Linux project has transitioned to "Hobby Mode" and this wiki is now read-only.

Difference between revisions of "Package:Vim/Cheatsheet"

From Funtoo
Jump to navigation Jump to search
(Added actions)
Line 1: Line 1:
* The description given in the "description" column is rather short, often it is best to try it your self and see what it actually does.
* Even if not specified in the "command" column, most commands fired in normal mode accept a "<num> prefix" (Eg. `5w` is equivalent to `wwwww`).
* Most commands will work in visual mode as well as in normal mode.
== Deplacements ==
== Deplacements ==


{{TableStart|striped=true}}
{{TableStart|striped=true}}
Line 143: Line 148:
</tr>
</tr>
{{TableEnd}}
{{TableEnd}}
== Actions ==
{{TableStart|striped=true}}
<tr>
  <th>command</th>
  <th>meaning</th>
  <th>description</th>
</tr>
<tr>
  <td><num>dd</td>
  <td>delete</td>
  <td>delete <num> lines</td>
</tr>
<tr>
  <td><num>yy</td>
  <td>yank</td>
  <td>copy <num> lines to vim's default buffer</td>
</tr>
<tr>
  <td>x</td>
  <td></td>
  <td>remove the character under the cursor</td>
</tr>
<tr>
  <td><num>p</td>
  <td>paste</td>
  <td>paste <num> times vim's default buffer after the cursor</td>
</tr>
<tr>
  <td><num>P</td>
  <td>Paste</td>
  <td>paste <num> times vim's default buffer before the cursor</td>
</tr>
<tr>
  <td>~</td>
  <td></td>
  <td>swap case under the cursor</td>
</tr>
<tr>
  <td>.</td>
  <td></td>
  <td>repeat previous action (kind of "live macro", try it yourself and see)</td>
</tr>
<tr>
  <td>/<pattern><CR></td>
  <td></td>
  <td>search next occurrence of <pattern></td>
</tr>
<tr>
  <td>?<pattern><CR></td>
  <td></td>
  <td>search previous occurrence of <pattern></td>
</tr>
<tr>
  <td>*</td>
  <td></td>
  <td>look for the next occurrence of the word under the cursor</td>
</tr>
<tr>
  <td>n</td>
  <td></td>
  <td>forward search last searched pattern</td>
</tr>
<tr>
  <td>N</td>
  <td></td>
  <td>backward search last searched pattern</td>
</tr>
{{TableEnd}

Revision as of 21:20, April 7, 2015

  • The description given in the "description" column is rather short, often it is best to try it your self and see what it actually does.
  • Even if not specified in the "command" column, most commands fired in normal mode accept a "<num> prefix" (Eg. `5w` is equivalent to `wwwww`).
  • Most commands will work in visual mode as well as in normal mode.

Deplacements

command meaning description
w word move to next word
W Word move to the next word (broad sens)
b begin move to the previous word beginning
B Begin move to the previous word beginning (broad sense)
e end move to the next word end
E End move to the next word end (broad sense)
{ move to the previous blank line
} move to the next blank line
f<char> fetch move to the next occurrence of the character <char>
F<char> Fetch move to the previous occurrence of the character <char>
$ move to the end of the line
^ move to the first non-whitespace character of the line
zz center the viewport on the currently
<num>gg goto move to line number <num> (default is 1 if <num> is omitted)
G move to the last line
C-o Go to the previous cursor position

Switch to insert mode

command meaning description
i insert insert before the cursor
I Insert insert at the beginning of the line (= ^i)
a append insert after the cursor/td>
A Append insert at the end of the line (= $a)
o insert on a new blank line after the current line
O insert on a new blank line before the current line
s substitute remove the current character and instert instead (= xi)
S Substitute remove the current line and insert instead (= ddi
R Replace insert and override on the fly

Actions

{{TableEnd}
command meaning description
<num>dd delete delete <num> lines
<num>yy yank copy <num> lines to vim's default buffer
x remove the character under the cursor
<num>p paste paste <num> times vim's default buffer after the cursor
<num>P Paste paste <num> times vim's default buffer before the cursor
~ swap case under the cursor
. repeat previous action (kind of "live macro", try it yourself and see)
/<pattern><CR> search next occurrence of <pattern>
?<pattern><CR> search previous occurrence of <pattern>
* look for the next occurrence of the word under the cursor
n forward search last searched pattern
N backward search last searched pattern