kana / vim-arpeggio Goto Github PK
View Code? Open in Web Editor NEWVim plugin: Mappings for simultaneously pressed keys
Home Page: http://www.vim.org/scripts/script.php?script_id=2425
Vim plugin: Mappings for simultaneously pressed keys
Home Page: http://www.vim.org/scripts/script.php?script_id=2425
i have been trying to map the sequence {|
. vim help says that the pipe character has to be escaped but none of the options worked for me?!
The latest update fixed the warnings, but now I'm getting the following error:
Unkown function: <SNR>28_chord_key
What could be causing that? Is this a bug or an error in my config?
It seems to happen when the following plugin is enabled, but I'm pretty sure it wasn't happening before the last update.
First of all, thank you for the great idea and implementation. This already speeds up my workflow by 100%. I would like to know if it would be possible to go a little bit further or to brainstorm how we could achieve so. I would like to combine sequences, just like in normal vim, if I have the following mappings:
nmap xa :DoA
nmap xb :DoB
When I press "x", vim waits for me to press "a" or "b". I would like to achieve similar behavior but with arpeggios, conceptually something like this:
nmap Arpeggio(<leader>,x)a :DoA
nmap Arpeggio(<leader>,x)b :DoB
Now I would do a <leader>+x
arpeggio, and vim would wait for "a" or "b".
This would speed up lots of commands. Going even further, it would be interesting to sequence also with other arpeggios. What do you think? Is this maybe already achievable?
For specific file types, I use Arpeggioinoremap
with the <buffer>
argument, for example, Arpeggioinoremap <buffer> {x}{y}
When switching to another filetype, I want to remove this key chord, So I use Arpeggioiunmap <buffer> {x}{y}
.
However, if another Arpeggioinoremap
contains {x}
in the lhs, vim freezes.
Full example:
" vimrc
Arpeggioinoremap jk ()<Left>
Arpeggioinoremap df {}<Left>
Arpeggioinoremap fj []<Left>
Arpeggioinoremap dj <><Left>
Arpeggioinoremap dk ""<Left>
Arpeggioinoremap gk ''<Left>
Arpeggioinoremap bk ``<Left> " <-- I think that only this line is relevant. It contains 'b'.
" inside vim session
:Arpeggioinoremap <buffer> zb ...
:Arpeggioiunmap <buffer> zb
In insert mode, hit zb
together. Vim freezes.
Pressing <C-c>
shows
<SNR>107_success:<SNR>107_success:<SNR>107_success:<SNR>107_success:<SNR>107_success:<SNR>107_success:<SNR>107_success:<SNR>107_success:<SNR>107_success:<SNR>107_success:<SNR>107_success:<SNR>107_success:<SNR>107_success:<SNR>107_success:<SNR>107_success:<SNR>107_success:<SNR>107_success:<SNR>107_success:<SNR>107_success:<SNR>107_success:<SNR>107_success:<SNR>107_success:<SNR>107_success:<SNR>107_success:<SNR>107_success:<SNR>107_success:<SNR>107_success:<SNR>107_success:<SNR>107_success:<SNR>107_success:<SNR>107_success:<SNR>107_success:<SNR>107_success:<SNR>107_success:<SNR>107_success:<SNR>107_success:<SNR>107_success:<SNR>107_success:<SNR>107_success:<SNR>107_success:<SNR>107_success:<SNR>107_success:<SNR>107_success:<SNR>107_success:<SNR>107_success:<SNR>107_success:<SNR>107_success:<SNR>107_success:<SNR>107_success:<SNR>107_success:<SNR>107_success:<SNR>107_success:<SNR>107_success:<SNR>107_success:<SNR>107_success:<SNR>107_success:<SNR>107_success:<SNR>107_success:<SNR>107_success:<SNR>107_success:<SNR>107_success:<SNR>107_
If I set the following mappings:
exec "Arpeggio nmap ar :Fun1<CR>
exec "Arpeggio nmap ao :Fun2<CR>
It works as expected, but if I use intead:
exec "Arpeggio nmap <leader>r :Fun1<CR>
exec "Arpeggio nmap <leader>o :Fun2<CR>
I get when entering vim from the terminal:
Key '<leader>' is already mapped in mode 'n'
Although it works as expected.
Is there a way to hide this warning?
Hello,
This is really a VIM issue, but perhaps there is a way to solve it:
Can one remap the <leader>
key? That is, the naive try
let mapleader = "/"
nnoremap ds /
does not work.
The idea is to provide a Arpeggio chord mapping, like
Arpeggio nnoremap ds <leader>
to access the leader key more comfortably.
Currently, chaining :Arpeggiounmap
statements with |
is not supported.
For example, if I have the following mappings,
Arpeggioinoremap jk ()<Left>
Arpeggioinoremap df {}<Left>
then if I attempt to remove them with
Arpeggioiunmap jk | Arpeggioiunmap df
The mapping for jk has been removed, while the mapping for df still exists.
I have also tried
Arpeggioiunmap jk| Arpeggioiunmap df
(without the trailing space), but that produces errors:
Error detected while processing function arpeggio#_unmap[2]..arpeggio#unmap[4]..<SNR>80_do_unmap:
line 8:
E474: Invalid argument
Error detected while processing function arpeggio#_unmap[2]..arpeggio#unmap[4]..<SNR>80_do_unmap:
line 13:
E31: No such mapping
Error detected while processing function arpeggio#_unmap[2]..arpeggio#unmap[4]..<SNR>80_do_unmap:
line 13:
E471: Argument required
Error detected while processing function arpeggio#_unmap[2]..arpeggio#unmap[4]..<SNR>80_do_unmap:
line 13:
E31: No such mapping
Error detected while processing function arpeggio#_unmap[2]..arpeggio#unmap[4]..<SNR>80_do_unmap:
line 13:
E31: No such mapping
Error detected while processing function arpeggio#_unmap[2]..arpeggio#unmap[4]..<SNR>80_do_unmap:
line 13:
E492: Not an editor command: jk
Error detected while processing function arpeggio#_unmap[2]..arpeggio#unmap[4]..<SNR>80_do_unmap:
line 13:
E31: No such mapping
Error detected while processing function arpeggio#_unmap[2]..arpeggio#unmap:
line 8:
E31: No such mapping
In the second example, I suspect that the command has been read as though jk|
was the entire lhs.
The outcome is the same as the first example. The mapping for jk has been removed, while the mapping for df still exists.
I hope this could be supported. If so, filetype specific arpeggio mappings can then be undone via b:undo_ftplugin
with a chain of Arpeggiounmap
statements
Would it be possible to create sequences of arpeggios? I realize it would start to become like stenography, but it might be interesting to have arpeggios prefixed by , or to be able to hit one arpeggio to mean "setting" and another to type out a particular setting, perhaps from a list of dozens thereof.
Arpeggio doesn't work for me when I also load vim-latex. I get no error messages, but the arpeggio mappings don't work. Any idea why?
So far I've been able to mostly adapt arpeggio to may needs (except for a few limitations like 'p'). I think chords are a really powerful mnemonic tool (it allows us to create richer keybindings, without having to pay any penalty) and I'm trying to share vim-arpeggio with as much people as possible. I dream about having chords as a native feature, it even makes want to switch to emacs as it seems to have chord support... Anyhow, back to my struggle accommodating plugins to work with vim-arpeggio, I'm stuck with the current scenario:
I have the following scenario. I want to use the following keybinding for the easymotion plugin:
"s+a: search all
silent Arpeggio map sa <plug>(easymotion-sn)
I'm also a huge fan of vim-targets, and with the previous mapping, the "argument" target stops working. To solve it I disabled the s+a mapping and check what's mapped to a. I created a default mapping so it doesn't break:
omap <expr> <plug>(arpeggio-default:a) targets#e('o', 'a', 'a')
xmap <expr> <plug>(arpeggio-default:a) targets#e('o', 'a', 'a')
Now "caa" (change an argument) works great. But for unknown reasons "caw" (change a word) now stops working and I get an error stating: "E223: recursive mapping". Not sure how to further debug this. Any ideas or suggestions?
i'm trying to undo an arpeggio map in one step. normally this works, i.e. Arpeggio imap jk asdf
will undo in one step. however, my map uses the expression register to call a function:
Arpeggio inoremap () ()<c-r>=UltiSnips#Expand()<cr>
this is useful for me as an auto-parentheses function in conjunction with a snippet that expands ()
in UltiSnips. See also this stackoverflow question.
when i undo after this mapping, the initial ()
is still present; i have to undo again to make it disappear. how can i undo the full mapping in one go?
Vim only adds package paths to 'runtimepath'
after loading the .vimrc, making the traditional autoload mechanic unusable for this particular case. If the plugin was installed in a package, using arpeggio#load()
as mentioned in the documentation does not work anymore.
One way to add the plugin directory to 'rtp'
is:
packadd! vim-arpeggio
call arpeggio#load()
Or simply source it all which dismisses the autoload function call:
packadd vim-arpeggio
I think it would be useful to have this information updated in the documentation or install instructions. Issue #11 might be related to this.
I'm getting a lot of messages like this:
Arpeggionoremap ls :ls<CR>
Key 'c' is already mapped in mode 'n'
Key 's' is already mapped in mode 'n'
Key 'l' is already mapped in mode 'v'
Key 's' is already mapped in mode 'v'
In normal mode, it's practically impossible to find actually a key that's not mapped to something. Is there a way to omit those warnings?
(I have been using this for a couple of days, and since I'm using two or three keys at once, they don't conflict).
Let's say I have bound the tr
to be expanded as true
:
Arpeggio inoremap tr true
Then, I run command :normal i'use strict'
, the result shown as use strueict
. Is there any workaround to solve this problem?
vim
and gvim
(and neovim
?) do not seem to be able to distinguish between <C-x>
and <C-S-x>
(multiple modifiers). For example, see here. I wonder if arpeggio
can solve the problem?
Error detected while processing /Users/jitendra.vyas/.vimrc:
line 510:
E117: Unknown function: arpeggio#map
Getting this error. OS = OSX Latest
Hi, this is more of a feature request / question.
Is it possible to :Arpeggio map
a key-chord to another key-chord?
As a minimal example, if I have the following:
Arpeggio iremap jk ()
Arpeggio inoremap () ()<C-G>U<Left>
then I hope that pressing jk will insert a pair of ()
with cursor in between. (I made up the command 'iremap', for illustration purposes)
I read about Arpeggionoremap
in the help. But as I understand it, that seems to be for recursive mappings of individual keystrokes, not for key-chords?
For now, it seems that a workaround is
Arpeggio imap jk <Plug>(parens)
Arpeggio imap () <Plug>(parens)
inoremap <Plug>(parens) ()<C-G>U<Left>
I would like to know if there is a better way to achieve this?
Hi..I'm bit newbie with vim and I just only know how install plugins with panthogen, I notice than you don't comment about bundle or panthogen so I'm not sure about the installing process...
I clone vim-arpeggio inside my bundle folder, then I add Arpeggio inoremap jk to my .vimrc but when I reload I get that warning...
I notice than I can call the Arpeggio command from the buffer line :Arpeggio but again..I'm so noob than I don't know if it's correct...thanks!
Using NeoVim 0.43 (latest stable) with installation via VimPlug.
Have tried this solution
But get the error
Directory not found in 'packpath': "pack/*/opt/vim-arpeggio"
Have also tried the process in the documentation:
packadd vim-arpeggio
-> Error detected while processing file
packloadall
-> No error, but then when I added either of these lines:
Arpeggio inoremap jk <Esc>
"call arpeggio#map('i', '', 0, 'jk', '<Esc>')
I get the usual Error detected while processing file
When I try this:
call arpeggio#load()
-> Error detected while processing file
so the problem is the following: I have the following arpeggio
:Arpeggioimap <silent> nt <c-j>
so that it will jump to the next tag in insert mode by pressing nt simultaneously, the problem is that if I am pasting something, with this will get captured by arpeggio if it appears in the text. Not sure if this should be considered a bug or just an inconvenience.
Could this plugin support tnoremap
in Neovim?
I've been experiencing problems with the following plugin:
https://github.com/neoclide/coc.nvim
In particular using the ts-server
The main issue was that suggestion boxes with errors and warnings would end up creating a buffer that would interfere with saving, so I couldn't :wa
. I did not know what was causing it, but after disabling the plugins I ended narrowing it down to vim-arpeggio. I'm not sure if it is the real cause, do you have any suggestion how could I further debug it or if there is something in vim-arpeggio that could be causing the issue?
Hi Kana, I am wondering if it would be possible to map only an Arpeggio sequence, and not a chord.
That is, the map happens only if keys are hit in a specified order, in quick succession.
For example, in insert mode, if I hit 'dm', a mapping occurs, but if I hit 'md', no mapping occurs. ie.
:Arpeggioinoremap <seq> dm \[ \]<Left><Left>
" dm -> \[ ... \]
" md -> md
I browsed through your code, and I think it can be achieved by bypassing the generation of permutations (see s:permutations
in s:do_map
)
However, I'm not sure if using <seq>
would be the best way to do this, as it may be confused with the other options such as <buffer>
, etc..
What are your thoughts on these?
Is it possible to define arpeggios with capital letters? According to the docs we can define arpeggios with 2 or more keys, so I guess it might be possible, but:
This works:
Arpeggio map <leader>f <plug>(plug-fun_f)
This doesn't:
Arpeggio map <leader>F <plug>(plug-fun_F)
Is this a limitation or can this be achieved?
Sometimes 'timeoutlen'
and 'ttimeoutlen'
are not restored properly for some reason. If the problem happens, it's nearly impossible to use key mappings with two or more keys, so it's very annoying. It would be better to take measures for the problem. For example:
CursorHold
/CursorHoldI
if appropriate.It would be cool if I could use already mapped keys to create chords. It doesn't seem to be the case.
If I do this:
imap d e
imap f t
There doesn't seem to be a way to set this (where df are the real keys):
Arpeggio imap df r
First of all, Thank you for the great plugin. Love it!
Consider that we have the following maps:
:Arpeggio inoremap th the
:Arpeggio inoremap tha that
If I only have the first map, all works fine. Once I add the second one, there seems to be a conflict and the first map no longer works. I've seen multiple such conflicts when the maps have shared keys.
I'm having trouble with vim-easymotion. The following works:
map / <plug>(easymotion-sn)
noremap <leader>/ /\v
but using Arpeggio seems to break it:
map / <plug>(easymotion-sn)
silent Arpeggio noremap <leader>/ /\v
I've been trying different options but I cannot figure out the reason, any suggestion about what could be causing this?
this might be unfair to pin on arpeggio, but I can't find a workaround. The issue is as follows:
say I start vim with no chords loaded and I have three lines:
:set ignorecase
:set smartcase
If in normal mode I position my cursor on the 'o' of ignore and execute ":echo winsaveview()", then I move down with 'j' and do the same, and again onto the smartcase line, I get:
{'lnum': 25, 'leftcol': 0, 'col': 8, 'topfill': 0, 'topline': 1, 'coladd': 0, 'skipcol': 0, 'curswant': 8}
{'lnum': 26, 'leftcol': 0, 'col': 0, 'topfill': 0, 'topline': 1, 'coladd': 0, 'skipcol': 0, 'curswant': 8}
{'lnum': 27, 'leftcol': 0, 'col': 8, 'topfill': 0, 'topline': 1, 'coladd': 0, 'skipcol': 0, 'curswant': 8}
and the cursor sits on the 'r' of smart.
next I execute
:call arpeggio#map('nv', 's', 0, 'jk', '<Esc>')
and repeat the exercise.
{'lnum': 25, 'leftcol': 0, 'col': 8, 'topfill': 0, 'topline': 1, 'coladd': 0, 'skipcol': 0, 'curswant': 8}
{'lnum': 26, 'leftcol': 0, 'col': 0, 'topfill': 0, 'topline': 1, 'coladd': 0, 'skipcol': 0, 'curswant': 0}
{'lnum': 27, 'leftcol': 0, 'col': 0, 'topfill': 0, 'topline': 1, 'coladd': 0, 'skipcol': 0, 'curswant': 0}
...and this time the cursor sits on the ':' .
I'm looking for the mapping to preserve the 'curswant' presumably, but this is already outside my vimfoo to work out what is going awry.
incidentally, the cursor keys still behave so I tried
:nnoremap <Plug>(arpeggio-default:j) <down>
but no luck.
And finally, thanks for such an awesome plugin. Its a huge boost to productivity.
Hi..I'm a bit newbie with vim and I just know how install plugins with panthogen but I notice than you don't comment about it, is the same process for install vim-arpeggio? (clone inside bundle and it's ready) or I need additional steps...sorry for the silly question...
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.