articles/vi.md: update
This commit is contained in:
parent
1b8caab62e
commit
189935d6e5
1 changed files with 15 additions and 4 deletions
|
@ -30,7 +30,7 @@ in doubt of something by using the `:help <topic>` command or `<F1>` to access t
|
|||
Some of these can be prefixed with a register name and a count number (in that order).
|
||||
Commands that work with registers use by default an anonymous registers if none is explicitly specified.
|
||||
|
||||
`c`: command mode, `i` = insert mode; `v`: visual mode; `n`: normal mode.
|
||||
`c`: command mode, `i` = insert mode; `v`: visual mode; `n`: normal mode; `t`: terminal mode.
|
||||
|
||||
### Basics
|
||||
- `:e`: open file in a new buffer, file needn't exist
|
||||
|
@ -113,9 +113,15 @@ It has to be noted that `Home`, `End`, `PageUp/Down` and cursor keys also work.
|
|||
- `fe`: move to `e`
|
||||
- (n) `F`: move to specified character, backwards
|
||||
|
||||
### Searching
|
||||
### Search & Replace
|
||||
- (n) `/`: search for pattern, forwards
|
||||
- (n) `?`: search for pattern, backwards
|
||||
- (n) `s`: replace (substitute) matches
|
||||
The `%` expands to the current file name of the current buffer. It is required if you want
|
||||
to apply `s` to the entire file, because it defaults to the current line only (therefore the `g` flag actually is global
|
||||
to the current line and not the file). This by the way, is legacy from earlier line-based **ed**itors.
|
||||
- `%s/pattertosearch/replacement/g`: replace all instances of `pattertosearch` by `replacement` in the file
|
||||
- `%s/foo/bar/gc`: prompt for each possible replacement
|
||||
|
||||
### Other
|
||||
- (n) `~`: change case of current character under the cursor
|
||||
|
@ -126,9 +132,13 @@ It has to be noted that `Home`, `End`, `PageUp/Down` and cursor keys also work.
|
|||
- (n) `K`: look for the identifier under the cursor in the man pages, really useful when you're doing C programming.
|
||||
- (n) `.`: repeat last action
|
||||
- `:help`, `:h`: Vim help pages
|
||||
- `:!`: execute shell command (in the shell specified by the `shell` varible)
|
||||
- `:!`: execute shell command (in the shell specified by the `shell` variable)
|
||||
- `:r!`: execute shell command and paste the stdout of that command in the current buffer at where the cursor is
|
||||
- `:w !`: (not `:w!`) send buffer or current range to the specified shell command
|
||||
- `:term`: opens a terminal window, enters to a special `terminal` mode, similar to insert mode.
|
||||
- (t) `Ctrl-\ Ctrl-n`: escape from terminal (Escape gets sent literally to the terminal process), also you may want to remap this
|
||||
- `:mkses`: saves current session (optionally takes a filename where to save the session; `Session.vim` by default)
|
||||
- `:so`: Source VimScript file, also used to restore from a session file.
|
||||
|
||||
### Macros
|
||||
- (n) `q`: start recording macro to register
|
||||
|
@ -183,7 +193,8 @@ It has to be noted that `Home`, `End`, `PageUp/Down` and cursor keys also work.
|
|||
## vi-like editors
|
||||
- Vim: vi improved, one of the most popular vi-like editors; includes a scripting language,
|
||||
VimScript for extending the editor.
|
||||
- Neovim: a fork of Vim, adds [Lua](lua.md) as a replacement for VimScript, improves performance.
|
||||
- Neovim: a fork of Vim, adds [Lua](lua.md) as a replacement for VimScript, improves performance, cleans cruft from
|
||||
Vim's codebase (has less LOC than Vim).
|
||||
- nvi: reimplementation of the original Berkley vi, is the default `vi` editor in the [BSDs](bsd.md).
|
||||
- vis: minimalistic vi-like editor, adds structured regular expressions inspired by the [Sam](sam.md) and
|
||||
[Acme](acme.md) editors, includes Lua for scripting.
|
||||
|
|
Loading…
Add table
Reference in a new issue