Use armory/environment/neovim/install.sh
To return to normal mode:
escctrl+cctrl+[
Otherwise, the commands follow a grammar:
<valid action> = <command> <locator> <motion> | <locator> <motion> | <motion> <direction>
| <locator> <repeat>? | <search>
<command> = d | c | y | v | > | <
<search> = / <search term> <enter> <searchresult>
<searchresult> = n <searchresult> | N <searchresult> | n | N
<motion> = h | j | k | l
<direction> = $ | _
<locator> = <integer>? f <character> | <integer>? t <character>
| <integer>? F <character> | <integer>? T <character>
| <integer>
<repeat> = ; | ,
<character number> = position on the line
<character> = an ascii character
| KeyBind | Command |
|---|---|
x |
delete a character |
h |
cursor left |
j |
cursor down |
k |
cursor up |
l |
cursor right |
w |
skip one word forward |
b |
skip one word backward |
d |
delete (repeat for single line delete) |
< |
De-dent line |
> |
Indent line |
c |
? |
u |
undo |
y |
yank |
p |
paste |
_ |
Goes to the beginning of the line |
$ |
Goes to the end of the line |
0 |
Goes to the 0th item of the line |
; |
Next match |
, |
Previous match |
/ |
Initiate search |
n |
Next search match |
N |
Previous search match |
f + <character> |
find forward from cursor on to next |
t + <character> |
find forward from cursor next to to next |
F + <character> |
find backward from cursor on to next |
T + <character> |
find backward from cursor next to to next |
↑
k Hint: The h key is at the left and moves left.
← h l → The l key is at the right and moves right.
j The j key looks like a down arrow.
↓
i to enter the mode before the cursor.
a to enter the mode after the cursor.
O to enter the mode on a new line before the cursor.
o to enter the mode on a new line after the cursor.
v to enter the mode.
shift + v to enter an enforced multiline select. (visual line mode)
:
:s or :substitute
:[range]s/{pattern}/{replacement}/[flags]#Example usage:
`:%s/<regex>/<replace>/`% means substitute in the whole file. This is a range.
| Range Syntax | Meaning / Target | Example Command | What It Does |
|---|---|---|---|
| (none) | Current line only | :s/foo/bar/ |
Replace in the current line. |
. |
Current line | :.,.+2s/x/y/ |
Start at current line. |
% |
Entire file (equivalent to 1,$) |
:%s/foo/bar/g |
Replace in all lines. |
1,$ |
First line to last line | :1,$s/^/# / |
Comment entire file. |
5 |
Line number 5 | :5s/error/fix/ |
Fix only line 5. |
10,20 |
Lines 10 through 20 | :10,20s/\s\+$// |
Trim trailing spaces in those lines. |
.,+5 |
Current line through 5 lines below | :.,+5s/foo/bar/ |
Replace in the next 5 lines. |
.-3,+3 |
3 lines above through 3 lines below | :.-3,+3s/x/y/ |
Neighborhood edit around the cursor. |
$ |
Last line | :$s/end/END/ |
Fix last line only. |
'<,'> |
Visual selection | :'<,'>s/.*/REPLACED/ |
Replace selected lines. |
/pattern/ |
Line matching next occurrence of pattern |
:/TODO/s/low/high/ |
Replace on the next TODO line. |
/a/,/b/ |
From next match of a to next match of b |
:/BEGIN/,/END/s/foo/bar/ |
Replace only between markers. |
?pattern? |
Line matching previous occurrence of pattern | :?foo?s/x/y/ |
Replace in the previous "foo" line. |
;+1 / ;-2 |
Relative line numbers (below/above) | :;+1s/a/b/ |
Edit next line after a search-based range. |
| Syntax | Meaning / Target | Example Command | What It Does |
|---|---|---|---|
:g/pat/ |
Select all lines containing pat |
:g/DEBUG/d |
Delete all DEBUG lines. |
:g/pat/s/x/y/ |
Substitute only in lines containing pat |
:g/INFO/s/^.\{-}\s// |
Delete timestamp only on INFO lines. |
:v/pat/ |
Select all lines not containing pat |
:v/keep/d |
Delete all lines except those containing “keep”. |
:g!/pat/ |
Same as :v/pat/ |
:g!/ERROR/s/x/y/ |
Replace only in lines without "ERROR". |
| Token | Meaning | Example | Effect |
|---|---|---|---|
. |
Current line | :.,+3s/x/y/ |
From current to 3 below |
$ |
Last line | :.,$s/foo/bar/ |
From cursor to end |
'<' / '>' |
Start / end of visual selection | :'<,'>s/^/# / |
Comment selected lines |
+n / -n |
Relative offsets | :.-2,+2s/x/y/ |
5-line window around cursor |
/pat/ |
Next search match (moves cursor implicitly) | :/header/+1s/x/y/ |
Replace on line after "header" |
Non-greedy matcher syntax is not supported. Instead use \{-} to mean "as few possible between 0 and n times."
/search termenternfor next occurenceNfor previous occurence
A tag is an identifier that appears in a tags file. A tags file must be generated before it can be used, but once one exists, it'll keep track of stuff in a file. For instance in C function names will be tags. You will be able to advance between tags with ctrl-t for previous tag.