Projekt

Allgemein

Profil

Setup vim » Historie » Version 2

Jeremias Keihsler, 27.05.2019 12:40

1 1 Jeremias Keihsler
h1. vim
2
3
*vim* is installed by default
4
5
h2. basic vim usage
6
7
the most vim-style way of getting help for @vim@ is starting vim and entering @:help@
8
9
for doing some basic editing the following sequences should be enough.
10
11
One edits a file in @vim@ by issuing the command:
12
<pre><code class="bash">
13
vim file-to-edit
14
</code></pre>
15
16
The vim editor has three modes:
17
* *command mode* letters or sequence of letters interactively command vim. Commands are case sensitive. The ESC key can end a command.
18
* *insert mode* Text is inserted. The ESC key ends insert mode and returns you to command mode. One can enter insert mode with the "i" (insert), "a" (insert after), "A" (insert at end of line), "o" (open new line after current line) or "O" (Open line above current line) commands.
19
* *command line mode* One enters this mode by typing ":" which puts the command line entry at the foot of the screen.
20
21
h3. command mode
22
23
|_.key  |_.action                        |
24
|x    |delete character under cursor |
25
|dd   |delete current line           |
26
|yy   |copy (yank) current line      |
27
|p    |paste                         |
28
|i    |change to @insert@ mode     |
29
30
h3. insert mode
31
32
edit text freely, press @<ESC>@ when you are finished.
33
34
h3. command line mode
35
36 2 Jeremias Keihsler
|_.key           |_.action                                                   |
37
| :help<enter>   | get help                                                  |
38
| :w<enter>      | save                                                      |
39
| :q!<enter>     | exit w/o saving                                           |
40
| :wq<enter>     | exit w/ saving                                            |
41
| :/foo          | search for @foo@ forward                                  |
42
| :?bar          | search for @bar@ backward                                 |
43
| n              | after search, go to next occurrence                       |
44
| N              | after search, go to previous occurrence                   |
45
| :%s/foo/bar/gc | replace all @foo@ with @bar@ but ask for confirmation     |