side-vim 0.1.1__tar.gz → 0.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: side-vim
3
- Version: 0.1.1
3
+ Version: 0.2.0
4
4
  Summary: Vim mode for PySide6's QPlainTextEdit
5
5
  Author: sprytnyk.dev
6
6
  License-Expression: MIT
@@ -59,9 +59,11 @@ Attach one `VimMode` per editor. Import `Mode` to compare `vim.mode` with
59
59
  | API | Behavior |
60
60
  | --- | --- |
61
61
  | `vim.mode_changed.connect(callback)` | Calls `callback(mode)` when the mode changes. |
62
- | `vim.pending_changed.connect(callback)` | Calls `callback(text)` with pending keys such as `2d`, or `""` when done. |
62
+ | `vim.pending_changed.connect(callback)` | Calls `callback(text)` with pending keys such as `2d`, or `""` when done. Moving the focus to another widget drops pending keys, as a click in another window does in Vim. Switching apps or opening a menu keeps them. |
63
63
  | `vim.escape_hook = callback` | Calls `callback()` before handling Esc. Return `True` if the app used it, for example to close a popup. |
64
64
  | `vim.search_hook = callback` | `/` calls `callback(True)`; `?` calls `callback(False)`. The app opens its search UI. |
65
+ | `vim.window_hook = callback` | `Ctrl+W` and one more key call `callback(key)`, such as `"h"` for `Ctrl+W h`. The app moves the focus, for example to a panel beside the editor. |
66
+ | `vim.spell_hook = callback` | The spelling commands call `callback(command, count)`, such as `("z=", None)` or `("]s", 2)`. The app shows suggestions, moves the cursor or adds the word. |
65
67
  | `vim.set_search("rent", forward=True)` | Saves the search text and jumps to the next match. `n` repeats in that direction; `N` reverses it. |
66
68
  | `vim.normal()` | Goes to Normal mode as Esc does, from Insert or Visual mode. |
67
69
  | `vim.clipboard = True` | Uses the system clipboard for yank, delete, change and paste. Defaults to `False`. |
@@ -92,54 +94,82 @@ repeats the typed text: `3ix<Esc>` inserts `xxx`.
92
94
  | Insert | `i a I A o O` |
93
95
  | Delete, change, yank | `d c y` followed by a motion; `dd cc yy`, `x D C` |
94
96
  | Paste, join | `p P`, `J` |
97
+ | Replace characters | `r` and a character: `3rx` turns three characters into `xxx` |
98
+ | Switch case | `~`: `3~` turns `abc` into `ABC` and moves past it |
95
99
  | Undo, redo | `u`, `Ctrl+R` |
96
100
  | Select | `v` for characters, `V` for lines; motions extend the selection |
97
- | Edit a selection | `d c y x p`; `o` switches its ends |
101
+ | Edit a selection | `d c y x p r ~`; `o` switches its ends |
98
102
  | Search | `/ ?` through the app hook, then `n N` |
99
103
  | Scroll a line | `Ctrl+E`, `Ctrl+Y` |
100
104
  | Scroll half a screen | `Ctrl+D`, `Ctrl+U` |
101
105
  | Scroll a screen | `Ctrl+F`, `Ctrl+B` |
102
106
  | Return to Normal | `Esc`, `Ctrl+[` |
107
+ | Window command | `Ctrl+W` and a key, through the app hook |
108
+ | Spelling | `z=`, `]s [s`, `zg zG`, through the app hook |
103
109
 
104
110
  In Normal and Visual modes, the Ctrl keys above take priority over app shortcuts.
105
111
  `j` and `k` keep the screen column across tabs and wide characters, and a wrapped
106
112
  line counts as one line, as in Vim.
107
113
 
114
+ After `r`, Enter puts in a line break, and `Ctrl+E` or `Ctrl+Y` copy the
115
+ characters below or above. `Ctrl+V` puts in the next key as it is, or a character
116
+ code such as `065` or `u20ac`. `Ctrl+K` and two characters put in a
117
+ [digraph](https://vimhelp.org/digraph.txt.html), such as `e:` for ë. Esc cancels
118
+ `r`. These work as in Vim.
119
+
108
120
  This release has only the keys above. It has no repeat (`.`), text objects,
109
- `f t r ~`, colon commands, macros, marks, named registers or block selection.
121
+ `f t`, `g~ gu gU`, colon commands, macros, marks, named registers or block
122
+ selection.
110
123
 
111
124
  ## Differences from Vim
112
125
 
113
126
  side-vim follows Vim 9.1 with its default settings, except for these:
114
127
 
115
128
  - Joined emoji and flags, such as 👨‍👩‍👧 and 🇺🇦, are one character. Vim splits
116
- them into their parts. Accents, CJK and single emoji work as in Vim.
129
+ them into their parts. Accents, CJK and single emoji work as in Vim, except
130
+ that `r Ctrl+E` and `r Ctrl+Y` copy an accented letter made of two code points
131
+ whole. Vim copies it without the accent.
132
+ - Qt turns a carriage return into a line break, so `r` can't put one in. Vim
133
+ puts one in for `r Ctrl+V Enter`, and for Enter after `r` in Visual mode.
134
+ side-vim does nothing there, and Visual mode keeps its selection.
135
+ - After `r Ctrl+V` and part of a code, such as `r Ctrl+V 6`, a key with no
136
+ character, such as an arrow, ends the code. Vim then also runs that key as a
137
+ command, but side-vim drops it.
117
138
  - Search uses plain text, not regular expressions. There is no command line.
118
139
  `/` and `?` call `search_hook`, then the app shows its own search box and
119
140
  passes the text to `set_search`.
141
+ - side-vim has no windows. `Ctrl+W` and the key after it go to `window_hook`,
142
+ and the app decides what they do. `Ctrl+W Ctrl+H` and `Ctrl+W Left` arrive as
143
+ `h`, as in Vim. It works only in Normal mode, and the hook gets no count.
144
+ - side-vim has no spell checker. `z=`, `]s`, `[s`, `zg` and `zG` go to
145
+ `spell_hook` with their count, and the app finds the words and shows the
146
+ suggestions. They work only in Normal mode. `]s` and `[s` aren't motions, so
147
+ `d]s` does nothing. side-vim doesn't have `zw`, `zW` or `zug`.
120
148
  - `J` puts one space after a period, like Vim with `nojoinspaces`. Vim's default
121
149
  puts two.
122
150
  - Qt stops scrolling when the last line reaches the bottom of the editor. Vim
123
151
  scrolls on until the last line is at the top, so `Ctrl+F` and `Ctrl+E` stop
124
152
  sooner near the end. The cursor still goes to the line Vim picks.
125
- - In Insert mode the editor handles every key except Esc and `Ctrl+[`. Arrows,
126
- Backspace and app shortcuts work as in any Qt editor. Vim's Insert mode keys,
127
- such as `Ctrl+W`, `Ctrl+U` and `Ctrl+O`, are not there.
153
+ - In Insert mode, Esc and `Ctrl+[` go back to Normal mode. Every other key goes
154
+ to the editor, so arrows, Backspace and app shortcuts work as in any Qt
155
+ editor. side-vim doesn't have Vim's Insert mode keys, such as `Ctrl+W`,
156
+ `Ctrl+U` and `Ctrl+O`.
128
157
  - In Normal and Visual modes, Ctrl keys that side-vim doesn't use go to the
129
158
  editor or the app, and so do PageUp, PageDown and the function keys. `Ctrl+A`
130
159
  selects all, for example. Qt's keys that change the text do nothing in these
131
160
  modes: paste, cut, `Ctrl+Backspace` and `Ctrl+Delete`. In Vim, `Ctrl+V` starts
132
161
  a block selection, which side-vim doesn't have.
133
162
  - Other keys without a command do nothing in Normal mode. They never type text.
134
- - Esc in Normal mode with nothing pending goes to the app, for example to close a
135
- dialog. Vim beeps.
163
+ - In Normal mode, an Esc with nothing pending goes to the app, so it can close a
164
+ dialog, for example. Vim does nothing with that Esc except ring its error bell.
136
165
  - A read-only editor allows movement, scrolling, selection, yank and search, and
137
166
  ignores edits. Vim only warns when you change a read-only file.
138
167
  - Dragging with the mouse in Normal mode starts Visual mode.
139
168
  - Outside Insert mode, Ukrainian letters work as the Latin keys in the same
140
169
  place, so `ц` is `w`. Vim needs `langmap` for that. Punctuation stays as typed,
141
170
  `ґ` isn't mapped because its key moves between layout variants, and `/` needs
142
- the English layout.
171
+ the English layout. The character after `r` is text, so `кц` puts in ц, as
172
+ `langmap` does in Vim.
143
173
  - On macOS, Ctrl means the physical Control key. Command shortcuts stay with the
144
174
  app.
145
175
  - The tab width comes from the editor's tab stop, not from a `tabstop` setting.
@@ -155,6 +185,7 @@ make check # Ruff and pytest
155
185
  make format # Format Python
156
186
  make record # Record expected results using local Vim
157
187
  make unicode # Regenerate Vim character classes and widths
188
+ make digraphs # Regenerate Vim digraphs
158
189
  make mac-keys # Key checks on a Mac
159
190
  ```
160
191
 
@@ -47,9 +47,11 @@ Attach one `VimMode` per editor. Import `Mode` to compare `vim.mode` with
47
47
  | API | Behavior |
48
48
  | --- | --- |
49
49
  | `vim.mode_changed.connect(callback)` | Calls `callback(mode)` when the mode changes. |
50
- | `vim.pending_changed.connect(callback)` | Calls `callback(text)` with pending keys such as `2d`, or `""` when done. |
50
+ | `vim.pending_changed.connect(callback)` | Calls `callback(text)` with pending keys such as `2d`, or `""` when done. Moving the focus to another widget drops pending keys, as a click in another window does in Vim. Switching apps or opening a menu keeps them. |
51
51
  | `vim.escape_hook = callback` | Calls `callback()` before handling Esc. Return `True` if the app used it, for example to close a popup. |
52
52
  | `vim.search_hook = callback` | `/` calls `callback(True)`; `?` calls `callback(False)`. The app opens its search UI. |
53
+ | `vim.window_hook = callback` | `Ctrl+W` and one more key call `callback(key)`, such as `"h"` for `Ctrl+W h`. The app moves the focus, for example to a panel beside the editor. |
54
+ | `vim.spell_hook = callback` | The spelling commands call `callback(command, count)`, such as `("z=", None)` or `("]s", 2)`. The app shows suggestions, moves the cursor or adds the word. |
53
55
  | `vim.set_search("rent", forward=True)` | Saves the search text and jumps to the next match. `n` repeats in that direction; `N` reverses it. |
54
56
  | `vim.normal()` | Goes to Normal mode as Esc does, from Insert or Visual mode. |
55
57
  | `vim.clipboard = True` | Uses the system clipboard for yank, delete, change and paste. Defaults to `False`. |
@@ -80,54 +82,82 @@ repeats the typed text: `3ix<Esc>` inserts `xxx`.
80
82
  | Insert | `i a I A o O` |
81
83
  | Delete, change, yank | `d c y` followed by a motion; `dd cc yy`, `x D C` |
82
84
  | Paste, join | `p P`, `J` |
85
+ | Replace characters | `r` and a character: `3rx` turns three characters into `xxx` |
86
+ | Switch case | `~`: `3~` turns `abc` into `ABC` and moves past it |
83
87
  | Undo, redo | `u`, `Ctrl+R` |
84
88
  | Select | `v` for characters, `V` for lines; motions extend the selection |
85
- | Edit a selection | `d c y x p`; `o` switches its ends |
89
+ | Edit a selection | `d c y x p r ~`; `o` switches its ends |
86
90
  | Search | `/ ?` through the app hook, then `n N` |
87
91
  | Scroll a line | `Ctrl+E`, `Ctrl+Y` |
88
92
  | Scroll half a screen | `Ctrl+D`, `Ctrl+U` |
89
93
  | Scroll a screen | `Ctrl+F`, `Ctrl+B` |
90
94
  | Return to Normal | `Esc`, `Ctrl+[` |
95
+ | Window command | `Ctrl+W` and a key, through the app hook |
96
+ | Spelling | `z=`, `]s [s`, `zg zG`, through the app hook |
91
97
 
92
98
  In Normal and Visual modes, the Ctrl keys above take priority over app shortcuts.
93
99
  `j` and `k` keep the screen column across tabs and wide characters, and a wrapped
94
100
  line counts as one line, as in Vim.
95
101
 
102
+ After `r`, Enter puts in a line break, and `Ctrl+E` or `Ctrl+Y` copy the
103
+ characters below or above. `Ctrl+V` puts in the next key as it is, or a character
104
+ code such as `065` or `u20ac`. `Ctrl+K` and two characters put in a
105
+ [digraph](https://vimhelp.org/digraph.txt.html), such as `e:` for ë. Esc cancels
106
+ `r`. These work as in Vim.
107
+
96
108
  This release has only the keys above. It has no repeat (`.`), text objects,
97
- `f t r ~`, colon commands, macros, marks, named registers or block selection.
109
+ `f t`, `g~ gu gU`, colon commands, macros, marks, named registers or block
110
+ selection.
98
111
 
99
112
  ## Differences from Vim
100
113
 
101
114
  side-vim follows Vim 9.1 with its default settings, except for these:
102
115
 
103
116
  - Joined emoji and flags, such as 👨‍👩‍👧 and 🇺🇦, are one character. Vim splits
104
- them into their parts. Accents, CJK and single emoji work as in Vim.
117
+ them into their parts. Accents, CJK and single emoji work as in Vim, except
118
+ that `r Ctrl+E` and `r Ctrl+Y` copy an accented letter made of two code points
119
+ whole. Vim copies it without the accent.
120
+ - Qt turns a carriage return into a line break, so `r` can't put one in. Vim
121
+ puts one in for `r Ctrl+V Enter`, and for Enter after `r` in Visual mode.
122
+ side-vim does nothing there, and Visual mode keeps its selection.
123
+ - After `r Ctrl+V` and part of a code, such as `r Ctrl+V 6`, a key with no
124
+ character, such as an arrow, ends the code. Vim then also runs that key as a
125
+ command, but side-vim drops it.
105
126
  - Search uses plain text, not regular expressions. There is no command line.
106
127
  `/` and `?` call `search_hook`, then the app shows its own search box and
107
128
  passes the text to `set_search`.
129
+ - side-vim has no windows. `Ctrl+W` and the key after it go to `window_hook`,
130
+ and the app decides what they do. `Ctrl+W Ctrl+H` and `Ctrl+W Left` arrive as
131
+ `h`, as in Vim. It works only in Normal mode, and the hook gets no count.
132
+ - side-vim has no spell checker. `z=`, `]s`, `[s`, `zg` and `zG` go to
133
+ `spell_hook` with their count, and the app finds the words and shows the
134
+ suggestions. They work only in Normal mode. `]s` and `[s` aren't motions, so
135
+ `d]s` does nothing. side-vim doesn't have `zw`, `zW` or `zug`.
108
136
  - `J` puts one space after a period, like Vim with `nojoinspaces`. Vim's default
109
137
  puts two.
110
138
  - Qt stops scrolling when the last line reaches the bottom of the editor. Vim
111
139
  scrolls on until the last line is at the top, so `Ctrl+F` and `Ctrl+E` stop
112
140
  sooner near the end. The cursor still goes to the line Vim picks.
113
- - In Insert mode the editor handles every key except Esc and `Ctrl+[`. Arrows,
114
- Backspace and app shortcuts work as in any Qt editor. Vim's Insert mode keys,
115
- such as `Ctrl+W`, `Ctrl+U` and `Ctrl+O`, are not there.
141
+ - In Insert mode, Esc and `Ctrl+[` go back to Normal mode. Every other key goes
142
+ to the editor, so arrows, Backspace and app shortcuts work as in any Qt
143
+ editor. side-vim doesn't have Vim's Insert mode keys, such as `Ctrl+W`,
144
+ `Ctrl+U` and `Ctrl+O`.
116
145
  - In Normal and Visual modes, Ctrl keys that side-vim doesn't use go to the
117
146
  editor or the app, and so do PageUp, PageDown and the function keys. `Ctrl+A`
118
147
  selects all, for example. Qt's keys that change the text do nothing in these
119
148
  modes: paste, cut, `Ctrl+Backspace` and `Ctrl+Delete`. In Vim, `Ctrl+V` starts
120
149
  a block selection, which side-vim doesn't have.
121
150
  - Other keys without a command do nothing in Normal mode. They never type text.
122
- - Esc in Normal mode with nothing pending goes to the app, for example to close a
123
- dialog. Vim beeps.
151
+ - In Normal mode, an Esc with nothing pending goes to the app, so it can close a
152
+ dialog, for example. Vim does nothing with that Esc except ring its error bell.
124
153
  - A read-only editor allows movement, scrolling, selection, yank and search, and
125
154
  ignores edits. Vim only warns when you change a read-only file.
126
155
  - Dragging with the mouse in Normal mode starts Visual mode.
127
156
  - Outside Insert mode, Ukrainian letters work as the Latin keys in the same
128
157
  place, so `ц` is `w`. Vim needs `langmap` for that. Punctuation stays as typed,
129
158
  `ґ` isn't mapped because its key moves between layout variants, and `/` needs
130
- the English layout.
159
+ the English layout. The character after `r` is text, so `кц` puts in ц, as
160
+ `langmap` does in Vim.
131
161
  - On macOS, Ctrl means the physical Control key. Command shortcuts stay with the
132
162
  app.
133
163
  - The tab width comes from the editor's tab stop, not from a `tabstop` setting.
@@ -143,6 +173,7 @@ make check # Ruff and pytest
143
173
  make format # Format Python
144
174
  make record # Record expected results using local Vim
145
175
  make unicode # Regenerate Vim character classes and widths
176
+ make digraphs # Regenerate Vim digraphs
146
177
  make mac-keys # Key checks on a Mac
147
178
  ```
148
179
 
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "side-vim"
3
- version = "0.1.1"
3
+ version = "0.2.0"
4
4
  description = "Vim mode for PySide6's QPlainTextEdit"
5
5
  readme = "README.md"
6
6
  license = "MIT"
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "side-vim"
3
- version = "0.1.1"
3
+ version = "0.2.0"
4
4
  description = "Vim mode for PySide6's QPlainTextEdit"
5
5
  readme = "README.md"
6
6
  license = "MIT"