
committed by
Starbeamrainbowlabs

parent
9abba96cc0
commit
2c40178eb1
@@ -1,20 +1,28 @@
|
||||
# vim
|
||||
|
||||
> Vi IMproved, a programmer's text editor, provides several modes for different kinds of text manipulation.
|
||||
> Vim (Vi IMproved), a programmer's command-line text editor, provides several modes for different kinds of text manipulation.
|
||||
> Pressing `i` enters edit mode. `<Esc>` goes back to normal mode, which doesn't allow regular text insertion.
|
||||
> More information: <https://www.vim.org>.
|
||||
|
||||
- Open a file:
|
||||
|
||||
`vim {{file}}`
|
||||
`vim {{path/to/file}}`
|
||||
|
||||
- Enter text editing mode (insert mode):
|
||||
- Save a file:
|
||||
|
||||
`<Esc>i`
|
||||
`:write`
|
||||
|
||||
- Copy ("yank") or cut ("delete") the current line (paste it with `P`):
|
||||
- Quit without saving:
|
||||
|
||||
`<Esc>{{yy|dd}}`
|
||||
`<Esc>:quit!<Enter>`
|
||||
|
||||
- Open a file at a specified line number:
|
||||
|
||||
`vim +{{line_number}} {{path/to/file}}`
|
||||
|
||||
- View help for setting (such as {{set number}}):
|
||||
|
||||
`<Esc>:help '{{setting_name}}'`
|
||||
|
||||
- Undo the last operation:
|
||||
|
||||
@@ -27,11 +35,3 @@
|
||||
- Perform a regex substitution in the whole file:
|
||||
|
||||
`<Esc>:%s/{{pattern}}/{{replacement}}/g<Enter>`
|
||||
|
||||
- Save (write) the file, and quit:
|
||||
|
||||
`<Esc>:wq<Enter>`
|
||||
|
||||
- Quit without saving:
|
||||
|
||||
`<Esc>:q!<Enter>`
|
||||
|
Reference in New Issue
Block a user