vim-swap icon indicating copy to clipboard operation
vim-swap copied to clipboard

Insert command in swap mode

Open zdcthomas opened this issue 4 years ago • 3 comments

I was hoping to do some work to add in an insert command into swap mode, probably bound to i and a that would add in a delimiter and enter insert mode in the correct place. Potentially similar to sideways.vim's mappings.

I wanted to check in here though before I start to see:

  • I this something that would be accepted at all into the plugin
  • Is this the UX we want
  • Where should I start and take a look if this has any interest behind it?

Thanks for the plugin and all the hard work!

zdcthomas avatar May 04 '21 04:05 zdcthomas

Thank you for your request! If I did not misunderstand, it inserts a delimiter and enters into insert mode. Am I right?

It sounds interesting. In short, the step to add a new command is:

  1. Add a mode interface to Swapmode object in autoload/swap/mode.vim
  2. Implement the actual buffer processing into Swap object in autoload/swap/swap.vim
  3. List it in Swap._edit method in autoload/swap/swap.vim
  4. Connect the new function to a key in autoload/swap.vim

It may not be so easy... vim-swap gets complicated by time.

machakann avatar May 09 '21 14:05 machakann

Thank you for the in depth help! I've gotten everything done except for implementing the buffer processing and entering insert mode, but I don't know how to proceed. Is there already a way to exit the interactive mode that's been created based on some return from my s:Swap._insert function? if not I can easily just insert a break in the _edit function

zdcthomas avatar May 11 '21 01:05 zdcthomas

hmm... This is kind of difficult. There is no function like this. Probably, for example, s:Swap._insert exit the swap mode and go into insert mode(, and re-start swap mode if necessary).

machakann avatar May 16 '21 14:05 machakann