2015-12-28 13:06:58 +01:00
|
|
|
# vim
|
|
|
|
|
2016-01-07 18:31:27 +01:00
|
|
|
> Vi IMproved, a programmer's text editor.
|
2015-12-28 13:06:58 +01:00
|
|
|
|
2016-01-07 18:31:27 +01:00
|
|
|
- Open a file with cursor at the given line number:
|
2015-12-28 13:06:58 +01:00
|
|
|
|
|
|
|
`vim {{file}} +{{linenumber}}`
|
|
|
|
|
2016-08-02 10:56:07 +10:00
|
|
|
- Open multiple files at once, each file in its own tab page:
|
2015-12-28 13:06:58 +01:00
|
|
|
|
|
|
|
`vim -p {{file1}} {{file2}} {{file3}}`
|
|
|
|
|
2016-01-07 18:31:27 +01:00
|
|
|
- Open a file in read-only mode:
|
2015-12-28 13:06:58 +01:00
|
|
|
|
|
|
|
`view {{file}}`
|
|
|
|
|
2016-08-06 14:29:34 +01:00
|
|
|
- Switch to normal mode:
|
2015-12-28 13:06:58 +01:00
|
|
|
|
2016-01-05 17:07:51 -05:00
|
|
|
`<esc>`
|
2015-12-29 12:09:30 -05:00
|
|
|
|
2016-08-06 14:29:34 +01:00
|
|
|
- Switch to insert mode:
|
2015-12-29 12:09:30 -05:00
|
|
|
|
2016-08-06 14:34:25 +01:00
|
|
|
`<esc> i`
|
2015-12-29 12:09:30 -05:00
|
|
|
|
2016-08-06 14:29:34 +01:00
|
|
|
- Exit vim:
|
2016-01-05 17:07:51 -05:00
|
|
|
|
|
|
|
`<esc> :q <enter>`
|
2015-12-29 12:09:30 -05:00
|
|
|
|
2016-08-06 14:29:34 +01:00
|
|
|
- Save file in vim:
|
2016-01-05 17:07:51 -05:00
|
|
|
|
|
|
|
`<esc> :w <enter>`
|
2015-12-29 12:09:30 -05:00
|
|
|
|
2016-08-06 14:29:34 +01:00
|
|
|
- Save file then exit vim:
|
2015-12-29 12:09:30 -05:00
|
|
|
|
2016-01-05 17:07:51 -05:00
|
|
|
`<esc> :wq <enter>`
|