1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-06-05 21:46:02 +02:00

vim: helpful additions

Closes #3779
This commit is contained in:
Ryan Olson 2020-01-22 16:38:21 -07:00 committed by Starbeamrainbowlabs
parent 9abba96cc0
commit 2c40178eb1

View file

@ -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>`