mjbrownie / swapit

vim plugin: Extensible Keyword Swapper
39 stars 8 forks source link

hotkey conflict? #30

Open Freed-Wu opened 4 years ago

Freed-Wu commented 4 years ago

this plugin use , . some plugins like https://github.com/tpope/vim-speeddating also use them. how can it provide some function to avoid conflict? such as

nmap <expr> <c-a> swap#canswap()? '<plug>(swap-next)': '<plug>blabla'

thanks!

mjbrownie commented 4 years ago

Sure that has been a passthrough set up thanks to a contributor. It looks like it might not be in the main docuentation.

https://github.com/mjbrownie/swapit/blob/master/plugin/swapit.vim " To integrate with other incrementor scripts (such as " speeddating.vim or monday.vim), map " SwapItFallbackIncrement and SwapItFallbackDecrement " to the keys that should be invoked when swapit doesn't have a " proper option. For example for speeddating.vim: " " nmap SwapItFallbackIncrement SpeedDatingUp " nmap SwapItFallbackDecrement SpeedDatingDown " vmap SwapItFallbackIncrement SpeedDatingUp " vmap SwapItFallbackDecrement SpeedDatingDown "

Freed-Wu commented 4 years ago

yes. it truly can integrate with speedating. i recommend move this comment to doc/help.txt.

and except speedating, monday, can it integrate with https://www.github.com/nishigori/increment-activator?

mjbrownie commented 4 years ago

It's possible to chain these type of plugins together so long as they support them. (I've only done it for speed dating myself) The increment-activator may need the equivalent SwapItFallbackIncrement or you could set it as the last point. eg.

swapit -> speeddating -> increment-activator

if that plugin cant do it then perhaps offer a pr for them simliar to SwapItFallbackIncrement https://github.com/mjbrownie/swapit/blob/master/plugin/swapit.vim#L242

It looks like increment-activator covers similar use cases as swapit so you could possibly ditch one if you don't need the features.. Their camel case changing looks nice. If you don't need swapit's xml/html start/end matching or the css stuff I'd just use that instead for now.

also there are a couple of alternatives switch.vim/cycle.vim

Freed-Wu commented 4 years ago

when i use swapit and speeddating together, i found if i press Ctrla in a word not date, it will return this error:

|| Error detected while processing function
|| SwapWord[26]
|| ProcessMatches[5]
|| speeddating#increment[18]
|| SwapWord[26]
|| ProcessMatches[5]
|| speeddating#increment[18]
|| SwapWord[26]
|| ProcessMatches[5]
|| speeddating#increment[18]
|| SwapWord[26]
|| ProcessMatches[5]
|| speeddating#increment[18]
|| SwapWord[26]
|| ProcessMatches[5]
|| speeddating#increment[18]
|| SwapWord[26]
|| ProcessMatches[5]
|| speeddating#increment[18]
|| SwapWord[26]
|| ProcessMatches[5]
|| speeddating#increment[18]
|| SwapWord[26]
|| ProcessMatches[5]
|| speeddating#increment[18]
|| SwapWord[26]
|| ProcessMatches[5]
|| speeddating#increment[18]
|| SwapWord[26]
|| ProcessMatches[5]
|| speeddating#increment[18]
|| SwapWord[26]
|| ProcessMatches[5]
|| speeddating#increment[18]
|| SwapWord[26]
|| ProcessMatches[5]
|| speeddating#increment[18]
|| SwapWord[26]
|| ProcessMatches[5]
|| speeddating#increment[18]
|| SwapWord[26]
|| ProcessMatches[5]
|| speeddating#increment[18]
|| SwapWord[26]
|| ProcessMatches[5]
|| speeddating#increment[18]
|| SwapWord[26]
|| ProcessMatches[5]
|| speeddating#increment[18]
|| SwapWord[26]
|| ProcessMatches[5]
|| speeddating#increment[18]
|| SwapWord[26]
|| ProcessMatches[5]
|| speeddating#increment[18]
|| SwapWord[26]
|| ProcessMatches[5]
|| speeddating#increment[18]
|| SwapWord[26]
|| ProcessMatches[5]
|| speeddating#increment[18]
|| SwapWord[26]
|| ProcessMatches[5]
|| speeddating#increment[18]
|| SwapWord[26]
|| ProcessMatches[5]
|| speeddating#increment[18]
|| SwapWord[26]
|| ProcessMatches[5]
|| speeddating#increment[18]
|| SwapWord[26]
|| ProcessMatches[5]
|| speeddating#increment[18]
|| SwapWord[26]
|| ProcessMatches[5]
|| speeddating#increment[18]
|| SwapWord[26]
|| ProcessMatches[5]
|| speeddating#increment[18]
|| SwapWord[26]
|| ProcessMatches[5]
|| speeddating#increment[18]
|| SwapWord[26]
|| ProcessMatches[5]
|| speeddating#increment[18]
|| SwapWord[26]
|| ProcessMatches[5]
|| E169: Command too recursive

this is vimrc

set nocompatible
set runtimepath +=$GITHUBWORKSPACE/mjbrownie/swapit
set runtimepath +=$GITHUBWORKSPACE/tpope/vim-speeddating

nmap <Plug>SwapItFallbackIncrement <Plug>SpeedDatingUp
nmap <Plug>SwapItFallbackDecrement <Plug>SpeedDatingDown
xmap <Plug>SwapItFallbackIncrement <Plug>SpeedDatingUp
xmap <Plug>SwapItFallbackDecrement <Plug>SpeedDatingDown

i will take a try for these plugin which you recommended. thanks!

Freed-Wu commented 4 years ago

https://github.com/nishigori/increment-activator/issues/2