1
1
# Talon-Vim
2
2
3
- [ talon-vim] ( https://github.com/fidgetingbits/talon-vim ) is a set of talon scripts that allows for convenient interaction
4
- with vim (more focused on neovim). In the [ age of
5
- cursorless] ( https://github.com/cursorless-dev/cursorless ) , the main benefit from using talon-vim is not for text
6
- editing, but rather for powerful terminal interaction.
3
+ This is a set of extra commands for controlling neovim using Talon Voice, in combination with the [ talonhub
4
+ community] ( https://github.com/talonhub/community/ ) repo or [ my talon repo] ( https://github.com/fidgetingbits/fidgetingbits-talon )
5
+
6
+ You probably are looking for [ neovim-talon] ( https://github.com/hands-free-vim/neovim-talon ) which is a lighter weight
7
+ port of what used to be soley this repo (and previously in my talon repo). It contains most of what you need to use
8
+ neovim for managinig terminals with voice, and is meant to be used with
9
+ [ cursorless] ( https://github.com/cursorless-dev/cursorless ) rather than using native neovim motions.
10
+
11
+ This repo [ talon-vim] ( https://github.com/fidgetingbits/talon-vim ) now relies on neovim-talon to function, but it
12
+ contains additional functionality, like lots of convenience, support for many plugins, support for real vim motion.
13
+
14
+ Due to [ cursorless] ( https://github.com/cursorless-dev/cursorless ) being so powerful, I no longer use neovim as my
15
+ primary editor, but rather vscode. I do however use neovim as a container for all my terminals, as it allows much more
16
+ powerful command-line use (especially with [ cursorless.nvim] ( https://github.com/hands-free-vim/cursorless.nvim/ ) than a
17
+ regular terminal provides.
18
+
19
+ Note that many parts of this repo will still slowly be migrated to neovim-talon, but it should be relatively seamless.
7
20
8
21
- [ Talon-Vim] ( #talon-vim )
9
- - [ UNDER CONSTRUCTION] ( #under-construction )
10
- - [ Project Layout] ( #project-layout )
11
- - [ Installation] ( #installation )
12
- - [ Nix] ( #nix )
13
- - [ Using Vim Terminals] ( #using-vim-terminals )
14
- - [ Recommended Terminal Plugins] ( #recommended-terminal-plugins )
15
- - [ vim-zoom] ( #vim-zoom )
16
- - [ lualine] ( #lualine )
22
+ - [ Dependencies] ( #dependencies )
17
23
- [ Using Vim As Your Editor] ( #using-vim-as-your-editor )
18
24
- [ Using VIM under Talon] ( #using-vim-under-talon )
19
- - [ Initial Setup Walkthrough] ( #initial-setup-walkthrough )
20
25
- [ Talon Change - The word ` yank ` ] ( #talon-change---the-word-yank )
21
26
- [ Talon Change - The key ` end ` ] ( #talon-change---the-key-end )
22
27
- [ Talon Change - The command ` word ` ] ( #talon-change---the-command-word )
23
- - [ The ` generic_editor.talon ` commands] ( #the-generic_editortalon-commands )
24
- - [ Vim Config Changes] ( #vim-config-changes )
25
- - [ Detecting VIM running inside terminals from Talon] ( #detecting-vim-running-inside-terminals-from-talon )
26
- - [ Preventing title truncation] ( #preventing-title-truncation )
27
- - [ Detecting the code language of edited files] ( #detecting-the-code-language-of-edited-files )
28
- - [ Detecting current vim mode] ( #detecting-current-vim-mode )
29
- - [ Automatically switching neovim using RPC] ( #automatically-switching-neovim-using-rpc )
30
- - [ Using VIM as your terminal] ( #using-vim-as-your-terminal )
31
- - [ Neovim Terminal Quirks] ( #neovim-terminal-quirks )
28
+ - [ Neovim Terminal Quirks] ( #neovim-terminal-quirks )
32
29
- [ Working directory] ( #working-directory )
33
- - [ Supported command overview] ( #supported-command-overview )
30
+ - [ Supported motion command overview] ( #supported-motion -command-overview )
34
31
- [ Commands] ( #commands )
35
32
- [ Motions] ( #motions )
36
33
- [ Text object selection] ( #text-object-selection )
37
34
38
- ## UNDER CONSTRUCTION
39
-
40
- talon-vim is currently in the process of being updated after moving out of the [ fidgetingbits talon
41
- repo] ( https://github.com/fidgetingbits/fidgetingbits-talon ) . Expect lots of documentation voidchanges.
42
-
43
- ## Project Layout
44
-
45
- - ` vim/core ` : Core talon-vim functions and objects
46
- - ` vim/apps ` : Terminal utilities that can leverage talon-vim API to add functionality
47
- - ` vim/modes ` : Mode-specific detection and functionality
48
- - ` vim/docs ` : Documentation and tutorials for specific features
49
-
50
- ## Installation
51
-
52
- Add the following to your ` init.lua ` (or equivalent).
53
-
54
- ``` lua
55
-
56
- ```
57
-
58
- TODO: Add ` vimscript ` equivalent question?
59
-
60
- ### Nix
61
-
62
- If you want to try out the exact vim configuration being used by @fidgetingbits , you can install neovim using nix via
63
-
64
- ``` bash
65
- nix run FIXME
66
- ```
67
-
68
- ## Using Vim Terminals
69
-
70
- Since this is the most likely use of this talon plugin, all focus on it first. If you actually want to use him for other
71
- basic editing, see the section about editing. Know there is a little bit of overlap because once you're in ` NORMAL ` or
72
- ` VISUAL ` mode in the terminal, you'll be using editing commands to copy data, etc. Is just the command sat you'll be
73
- using is more limited.
35
+ ## Dependencies
74
36
75
- ### Recommended Terminal Plugins
76
-
77
- I recommend installing the following plugins if you're going to be using the terminal:
78
-
79
- #### [ vim-zoom] ( https://github.com/dhruvasagar/vim-zoom )
80
-
81
- Zooms in and out of a split.
82
-
83
- FIXME: Include a .gif
84
-
85
- #### lualine
86
-
87
- Any sort of line plugin that lets you quickly see the mode you're in.
88
-
89
- FIXME: Include a screenshot
37
+ - [ talon.nvim] ( https://github.com/hands-free-vim/talon.nvim/ ) (Required)
38
+ - [ neovim-talon] ( https://github.com/hands-free-vim/neovim-talon ) (Required)
39
+ - [ cursorless.nvim] ( https://github.com/hands-free-vim/cursorless.nvim/ ) (Optional)
90
40
91
41
## Using Vim As Your Editor
92
42
43
+ I recommend using VSCode for now, until cursorless in neovim supports hats. That said, this repo does support native
44
+ vim motions, so you can give it a try.
45
+
93
46
## Using VIM under Talon
94
47
95
48
This document serves as an instruction manual and quick tutorial for people
@@ -104,26 +57,21 @@ the slack channel.
104
57
Please note that if you want to have the full vim experience you will have to
105
58
make modifications to both the vim config and talon.
106
59
107
- Currently supported VIM features:
60
+ Currently supported VIM features (that aren't in neovim-talon) :
108
61
109
62
- motions
110
63
- registers
111
64
- macros
112
65
- folds
113
- - tabs
114
- - splits
115
- - [ plugins] ( plugins ) (see list below)
66
+ - plugins (see source for list. NOTE: some are in neovim-talon now)
116
67
- settings
117
- - automatic mode switching (including terminal)
118
68
119
- You can contact ` fidget ` on the Talon slack for questions/support.
120
-
121
- ## Initial Setup Walkthrough
69
+ You can contact ` fidgetingbits ` on the Talon slack for questions/support.
122
70
123
71
### Talon Change - The word ` yank `
124
72
125
73
The default Talon alphabet uses ` yank ` for the letter ` y ` . This conflicts with
126
- the natural VIM verb, so it is recommended you change the ` y ` word in
74
+ the natural VIM verb, so it is recommended you change the ` y ` word in your talon
127
75
` code/keys.py ` . For example you could instead use: ` yell `
128
76
129
77
### Talon Change - The key ` end `
@@ -147,132 +95,9 @@ word. See `misc/formatters.talon`. In vim "word" is a natural movement motion
147
95
so it is included by default. If you decide to use this you will want to
148
96
change the talon command to be a separate word.
149
97
150
- ### The ` generic_editor.talon ` commands
151
-
152
- The default actions defined in ` generic_editor.talon ` are supported, but in
153
- some cases are too simple for more complicated use with vim. You can try to use
154
- them in general but in some cases you will want to switch to use the vim
155
- specific ones.
98
+ ### Neovim Terminal Quirks
156
99
157
- ### Vim Config Changes
158
-
159
- #### Detecting VIM running inside terminals from Talon
160
-
161
- The vim support in talon is built around supporting running vim as your
162
- terminal and being able to pop in and out of terminal mode.
163
-
164
- If you won't use vim from inside of a terminal you can ignore this step.
165
-
166
- Normally by default all terminal grammars will be still loaded when VIM is
167
- running in a terminal, because the app itself that talon detects (at least on
168
- Linux) is the terminal. This takes some manual intervention to fix.
169
-
170
- The current fix for this is to modify the ` ~/.vimrc ` configuration file, so
171
- that talon is able to differentiate between vim running in the terminal and the
172
- terminal itself. For instance I add ` VIM ` in the ` titlestring ` and this allows
173
- me to set the ` vim ` talon tag by using ` win.title: /VIM/ ` . It also lets me
174
- descriminate terminal vs vim tags in terminal talon files by using
175
- ` not win.title: /VIM/ ` .
176
-
177
- To set your ` titlestring ` to include ` VIM ` , use something like the following:
178
-
179
- ```
180
- let &titlestring ='VIM - (%f) %t'
181
- set title " required for neovim
182
- ```
183
-
184
- Talon will search the active terminal window title and look for ` VIM ` , at which
185
- point it will correctly trigger the vim tag and disable the terminal tag.
186
-
187
- #### Preventing title truncation
188
-
189
- In some scenarios if the window is very narrow the title gets truncated, and
190
- talon isn't able to detect the right information. In order to fix this you can
191
- set the following setting in your vim configuration:
192
-
193
- ```
194
- let &titlelen = 2048
195
- ```
196
-
197
- ### Detecting the code language of edited files
198
-
199
- Currently the logic for detecting the code language inside of vim expect their
200
- actual file name to be the last part of the titlestring that is pulled out of
201
- ` win.title ` . This means you'll have to added your title string to ensure that
202
- the last entry is the file name. This can be done using the ` %t ` format
203
- specifier, which was shown in the previous example. No matter what you say your
204
- ` titlestring ` to just be sure that ` %t ` is the last entry.
205
-
206
- ### Detecting current vim mode
207
-
208
- ` code/vim.py ` currently relies on the mode being advertised in the title
209
- string in order to make intelligent decisions about how to flip between modes.
210
- You can disable this functionality in the settings. If you want to use it you
211
- need to make sure that your ` titlestring ` includes a pattern like ` MODE:<mode> `
212
- for example:
213
-
214
- ```
215
- let &titlestring ='VIM MODE:%{mode()} - (%f) %t'
216
- set title
217
- ```
218
-
219
- ### Automatically switching neovim using RPC
220
-
221
- XXX - note this isn't supported yet
222
-
223
- Once again we can rely on the ` titlestring ` to tell talon where to look to
224
- access the current neovim RPC interface.
225
- .
226
-
227
- ```
228
- let &titlestring ='VIM MODE:%{mode()} RPC:%{v:servername} - (%f) %t'
229
- set title
230
- ```
231
-
232
- ### Using VIM as your terminal
233
-
234
- Recent versions of vim and neovim both allow you to run a terminal emulator
235
- inside of a vim buffer itself. For people that are using voice to control their
236
- systems this is actually very useful it allows you to navigate the terminal
237
- history using vim motions. This allows you to for instance copy and paste lines
238
- that were printed from different terminal commands that would otherwise require
239
- you to use a mouse to highlight.
240
-
241
- As an alternative to vim you might be tempted to use a terminal that supports
242
- of vim-like selection mode similar to termite, however the selection mode in
243
- these terminals has serious drawbacks such as no line numbers, limited motion
244
- verbs, etc.
245
-
246
- If you choose to use them as your terminal than you have to make certain
247
- modifications again to the talon configuration files, and the vim configuration
248
- in order for it to differentiate between terminal mode.
249
-
250
- First you'll have to ensure that the vim mode is correctly advertised in your
251
- title string, similar to the previous section. The following example can be
252
- placed into your vim config file.
253
-
254
- ```
255
- let &titlestring ='VIM MODE:%{mode()} RPC:%{v:servername} - (%f) %t'
256
- set title
257
- if has ('autocmd')
258
- autocmd TermEnter * let &titlestring='VIM MODE:%{mode()} RPC:%{v:servername} - (%f) %t'|redraw
259
- endif
260
- ```
261
-
262
- In the example above we need to set up in ` autocomd ` because by default
263
- terminals were lazily redraw the ` titlestring ` , which causes talon to not
264
- correctly detect the mode switch.
265
-
266
- The ` apps/linux/vim_terminal.talon ` file can then match based off of the
267
- ` titlestring ` above holding ` MODE:t ` , in which case it will trigger ` terminal `
268
- mode despite being inside of vim.
269
-
270
- #### Neovim Terminal Quirks
271
-
272
- XXX - not completed
273
-
274
- Here I will try to document some potential problems you will encounter when
275
- moving your workflow into vim terminal for everything, and how I solved them.
100
+ If you want your Neovim buffer working directory to match the folder your terminal is in, use the following:
276
101
277
102
https://gist.github.com/DrSpeedy/9022d3bee63a7029570c7d3d43054329
278
103
@@ -288,24 +113,19 @@ neovim_autocd() {
288
113
chpwd_functions+=( neovim_autocd )
289
114
```
290
115
291
- ## Supported command overview
116
+ ## Supported motion command overview
292
117
293
- In this section summarizes most of the main grammars that are supported
294
- by the current talon vim implementation. For the most truthful representation
295
- of what is supported you need to check the talon and python files. All of the
296
- commands follow the typical vim grammar style such as
118
+ All of the commands follow the typical vim grammar style such as
297
119
` [count][action][motion] ` . Motions are also supported is to move along where
298
120
you are in the file or select things in VISUAL mode. By default these motions
299
121
are also accessible for the inside INSERT mode without needing to manually
300
- change modes, to reduce voice strain.
301
-
302
- For the most complete as you need to check ` vim.py ` and ` vim.linux.talon ` .
122
+ change modes.
303
123
304
124
### Commands
305
125
306
126
Many of these can be combined with motions or text objects selection, etc.
307
127
308
- ```
128
+ ``` python
309
129
" join" : " J" ,
310
130
" filter" : " =" ,
311
131
" paste" : " p" ,
@@ -329,7 +149,7 @@ Many of these can be combined with motions or text objects selection, etc.
329
149
These are motions that can be used in VISUAL mode, and can also be used as
330
150
motions when combined with commands.
331
151
332
- ```
152
+ ``` python
333
153
" back" : " b" ,
334
154
" back word" : " b" ,
335
155
" big back" : " B" ,
@@ -385,7 +205,7 @@ motions when combined with commands.
385
205
386
206
With character arguments:
387
207
388
- ```
208
+ ``` python
389
209
" jump to mark" : " '" ,
390
210
" find" : " f" ,
391
211
" find reversed" : " F" ,
@@ -398,7 +218,7 @@ With character arguments:
398
218
399
219
### Text object selection
400
220
401
- ```
221
+ ``` python
402
222
" word" : " w" ,
403
223
" words" : " w" ,
404
224
" big word" : " W" ,
0 commit comments