Aktionen
Setup vim¶
as of Fedora 33 vim is not the default editor anymore ...
taken from https://dev.to/tylerauerbeck/reverting-your-default-editor-to-vim-in-fedora-33-3kdl
dnf remove nano-default-editor
dnf install vim-default-editor
basic vim usage¶
the most vim-style way of getting help for vim
is starting vim and entering :help
for doing some basic editing the following sequences should be enough.
One edits a file in vim
by issuing the command:
vim file-to-edit
The vim editor has three modes:
- command mode letters or sequence of letters interactively command vim. Commands are case sensitive. The ESC key can end a command.
- 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.
- command line mode One enters this mode by typing ":" which puts the command line entry at the foot of the screen.
command mode¶
key | action |
---|---|
x | delete character under cursor |
dd | delete current line |
yy | copy (yank) current line |
p | paste |
i | change to insert mode |
insert mode¶
edit text freely, press <ESC>
when you are finished.
command line mode¶
key | action |
---|---|
:help<enter> | get help |
:w<enter> | save |
:q!<enter> | exit w/o saving |
:wq<enter> | exit w/ saving |
:/foo | search for foo forward |
:?bar | search for bar backward |
n | after search, go to next occurrence |
N | after search, go to previous occurrence |
:%s/foo/bar/gc | replace all foo with bar but ask for confirmation |
Von Jeremias Keihsler vor mehr als 2 Jahren aktualisiert · 2 Revisionen