tldr/pages/common/vim.md

32 lines
565 B
Markdown
Raw Normal View History

2015-12-28 12:06:58 +00:00
# vim
> Vi IMproved, a programmer's text editor.
2015-12-28 12:06:58 +00:00
- Open a file with cursor at the given line number:
2015-12-28 12:06:58 +00:00
`vim {{file}} +{{linenumber}}`
2016-08-02 01:56:07 +01:00
- Open multiple files at once, each file in its own tab page:
2015-12-28 12:06:58 +00:00
`vim -p {{file1}} {{file2}} {{file3}}`
- Open a file in read-only mode:
2015-12-28 12:06:58 +00:00
`view {{file}}`
- Exit vim:
2015-12-28 12:06:58 +00:00
2015-12-29 17:09:30 +00:00
`[Esc] (to switch to command mode), then :q`
- save file in vim
`[Esc] (to switch to command mode), then :w`
- save file then exit vim
`[Esc] (to switch to command mode), then :wq`
- switch to edit (insert) mode
`[Esc] (to switch to command mode), then i`