Skip to content

Commit 5ff9911

Browse files
committed
Re-format markdown to rst
1 parent bde1de5 commit 5ff9911

File tree

2 files changed

+106
-102
lines changed

2 files changed

+106
-102
lines changed

docs/source/features/vim_mode.rst

Lines changed: 105 additions & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -1,103 +1,106 @@
1-
# Vim mode
2-
3-
Vim is a keyboard-centric text editor. A vim mode refers
4-
to another editor implementing the ability to perform
5-
a subset of vim motions. This will allow you to write,
6-
select, edit, copy, paste, navigate, etc, efficiently
7-
all by using your keyboard.
8-
9-
10-
Vim is modal, three such modes have been implemented
11-
in NovelWriter:
12-
- Normal mode: this is the default mode used to navigate text
13-
- Insert mode: where you can write text as in a 'normal' text editor
14-
- Visual mode: for selecting text
15-
- Visual mode: per character selection
16-
- V-line mode: per line selection
17-
18-
## Mode switching
19-
20-
To switch between the various vim modes there are these
21-
keystrokes implemented (definitions provided below):
22-
23-
Normal mode -> Insert mode:
24-
- i, I, a, A, o, O
25-
Insert mode -> Normal mode:
26-
- ESC (escape key)
27-
Normal mode -> Visual mode:
28-
- v, V
29-
30-
You can exit visual mode back to normal mode by pressing
31-
escape, but all visual mode commands that logically
32-
'terminate' the visual mode usage will return you to
33-
normal mode.
34-
E.g: press "V" to enter V-line mode, select next word with "w"
35-
press "y" to yank (copy), you are now automatically put
36-
back in normal mode as you have completed selecting your text.
37-
38-
## Implemented keystrokes (vim motions)
39-
40-
This table shows the vim motions currently implemented in NovelWriter:
41-
42-
| Motion | Mode(s) | Description |
43-
|--------|---------|-------------|
44-
| `i` | Normal → Insert | Enter insert mode |
45-
| `I` | Normal → Insert | Jump to first non-blank of line and enter insert |
46-
| `v` | Normal → Visual | Enter character-wise visual mode |
47-
| `V` | Normal → V-Line | Enter line-wise visual mode |
48-
| `dd` | Normal | Delete (cut) current line |
49-
| `x` | Normal | Delete character under cursor |
50-
| `w` | Normal / Visual | Move to next word start |
51-
| `b` | Normal / Visual | Move to previous word start |
52-
| `e` | Normal / Visual | Move to next word end |
53-
| `dw` | Normal | Delete from cursor to next word start |
54-
| `de` | Normal | Delete from cursor to next word end |
55-
| `db` | Normal | Delete from cursor to previous word start |
56-
| `d$` | Normal | Delete from cursor to end of line |
57-
| `yw` | Normal | Yank (copy) from cursor to next word start |
58-
| `gg` | Normal / Visual | Jump to first line |
59-
| `G` | Normal / Visual | Jump to last line |
60-
| `yy` | Normal | Yank current line |
61-
| `p` | Normal | Paste after current line |
62-
| `P` | Normal | Paste before current line |
63-
| `o` | Normal → Insert | Open new line below and enter insert |
64-
| `O` | Normal → Insert | Open new line above and enter insert |
65-
| `$` | Normal / Visual | Move to end of line |
66-
| `a` | Normal → Insert | Enter insert after cursor |
67-
| `A` | Normal → Insert | Enter insert at end of line |
68-
| `u` | Normal | Undo last change |
69-
| `zz` | Normal | Center cursor vertically |
70-
| `h` | Normal / Visual | Move left |
71-
| `j` | Normal / Visual | Move down |
72-
| `k` | Normal / Visual | Move up |
73-
| `l` | Normal / Visual | Move right |
74-
| `d` / `x` | Visual / V-Line | Delete selection |
75-
| `y` | Visual / V-Line | Yank selection |
76-
| `0` | Visual | Move to start of line (extend selection) |
77-
78-
### Known bugs
79-
80-
Currently "dd" on an empty line will no delete, but using "x" will.
81-
82-
vypyy" will have ypyy in command and thus not register yy.
83-
Expected behavior would be visual mode, yank, paste, yank line.
84-
This could be fixed by having a list of suffixes potentially.
85-
86-
Not a bug but differing behavior from vim: the "e" command behaves
87-
a bit differently with regards to the last character of a word.
88-
The behavior is inconsistent with vim but functional and still logical
89-
to use. The cursor is placed at the end of the word after the last
90-
character rather than on the last character.
91-
E.G: test
1+
.. _docs_features_vim_mode:
2+
3+
********
4+
Vim Mode
5+
********
6+
7+
.. _Vim: https://www.vim.org/
8+
9+
Vim_ is a keyboard-centric text editor. "Vim mode" refers to another editor implementing the
10+
ability to perform a subset of vim motions. This will allow you to write, select, edit, copy,
11+
paste, navigate, etc, efficiently by using keyboard commands.
12+
13+
Vim is modal, three such modes have been implemented in novelWriter:
14+
15+
- **Normal** mode is the default mode used to navigate text.
16+
- **Insert** mode is where you can write text like in a 'normal' text editor.
17+
- **Visual** mode is for selecting text, with:
18+
- **Visual** mode for per character selection.
19+
- **V-line** mode for per-line selection.
20+
21+
22+
Mode Switching
23+
==============
24+
25+
To switch between the various vim modes, these keystrokes implemented:
26+
27+
.. csv-table::
28+
:header: "From Mode", "To Mode", "Keystrokes"
29+
30+
"Normal", "Insert", ":kbd:`i`, :kbd:`I`, :kbd:`a`, :kbd:`A`, :kbd:`o`, :kbd:`O`"
31+
"Insert", "Normal", ":kbd:`Esc`"
32+
"Normal", "Visual", ":kbd:`v`, :kbd:`V`"
33+
34+
You can exit visual mode back to normal mode by pressing :kbd:`Esc`, but all visual mode commands
35+
that logically "terminate" the visual mode usage will return you to normal mode.
36+
37+
Fro instance, press :kbd:`V` to enter V-line mode, select next word with :kbd:`w`. press :kbd:`y`
38+
to yank (copy), you are now automatically put back in normal mode as you have completed selecting
39+
your text.
40+
41+
42+
Implemented Keystrokes (Vim Motions)
43+
====================================
44+
45+
The table below shows the vim motions currently implemented in novelWriter.
46+
47+
.. csv-table::
48+
:header: "Motion", "Mode(s)", "Description"
49+
50+
":kbd:`i`", "Normal → Insert", "Enter insert mode"
51+
":kbd:`I`", "Normal → Insert", "Jump to first non-blank of line and enter insert"
52+
":kbd:`v`", "Normal → Visual", "Enter character-wise visual mode"
53+
":kbd:`V`", "Normal → V-Line", "Enter line-wise visual mode"
54+
":kbd:`dd`", "Normal", "Delete (cut) current line"
55+
":kbd:`x`", "Normal", "Delete character under cursor"
56+
":kbd:`w`", "Normal / Visual", "Move to next word start"
57+
":kbd:`b`", "Normal / Visual", "Move to previous word start"
58+
":kbd:`e`", "Normal / Visual", "Move to next word end"
59+
":kbd:`dw`", "Normal", "Delete from cursor to next word start"
60+
":kbd:`de`", "Normal", "Delete from cursor to next word end"
61+
":kbd:`db`", "Normal", "Delete from cursor to previous word start"
62+
":kbd:`d$`", "Normal", "Delete from cursor to end of line"
63+
":kbd:`yw`", "Normal", "Yank (copy) from cursor to next word start"
64+
":kbd:`gg`", "Normal / Visual", "Jump to first line"
65+
":kbd:`G`", "Normal / Visual", "Jump to last line"
66+
":kbd:`yy`", "Normal", "Yank current line"
67+
":kbd:`p`", "Normal", "Paste after current line"
68+
":kbd:`P`", "Normal", "Paste before current line"
69+
":kbd:`o`", "Normal → Insert", "Open new line below and enter insert"
70+
":kbd:`O`", "Normal → Insert", "Open new line above and enter insert"
71+
":kbd:`$`", "Normal / Visual", "Move to end of line"
72+
":kbd:`a`", "Normal → Insert", "Enter insert after cursor"
73+
":kbd:`A`", "Normal → Insert", "Enter insert at end of line"
74+
":kbd:`u`", "Normal", "Undo last change"
75+
":kbd:`zz`", "Normal", "Centre cursor vertically"
76+
":kbd:`h`", "Normal / Visual", "Move left"
77+
":kbd:`j`", "Normal / Visual", "Move down"
78+
":kbd:`k`", "Normal / Visual", "Move up"
79+
":kbd:`l`", "Normal / Visual", "Move right"
80+
":kbd:`d`", "Visual / V-Line", "Delete selection"
81+
":kbd:`x`", "Visual / V-Line", "Delete selection"
82+
":kbd:`y`", "Visual / V-Line", "Yank selection"
83+
":kbd:`0`", "Visual", "Move to start of line (extend selection)"
84+
85+
86+
Known Issues
87+
============
88+
89+
* Currently, :kbd:`dd` on an empty line will not delete, but using :kbd:`x` will.
90+
* :kbd:`vypyy` will have :kbd:`ypyy` in command memory and thus not register :kbd:`yy`. Expected
91+
behavior would be visual mode, yank, paste, yank line.
92+
* Differing behavior from vim: the :kbd:`e` command behaves a bit differently with regards to the
93+
last character of a word. The behavior is inconsistent with vim but functional and still logical
94+
to use. The cursor is placed at the end of the word after the last character rather than on the
95+
last character.
96+
97+
.. code-block::
98+
99+
test
92100
^ Cursor placed here in vim
93-
E.G: test
94-
^ Cursor placed here in NovelWriter vim mode
95-
You will only really ever notice this behavior if you try to combine
96-
the "e" command with another, e.g "de" will not delete the last character
97-
but delete forward as it starts one character after the word boundary.
98-
99-
### Useful commands not yet added:
100-
- r, R : replace text
101-
- c : change, delete and enter insert mode
102-
- ciw : change in word, to "vedi", select current word, delete, then
103-
enter insert mode.
101+
test
102+
^ Cursor placed here in novelWriter vim mode
103+
104+
You will only really ever notice this behavior if you try to combine the :kbd:`e` command with
105+
another. For instance, :kbd:`de` will not delete the last character but delete forward as it
106+
starts one character after the word boundary.

docs/source/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ storage for robustness.
6868
features/dialogue
6969
features/story_comments
7070
features/shortcuts
71+
features/vim_mode
7172

7273
.. toctree::
7374
:caption: In-Depth Topics

0 commit comments

Comments
 (0)