use prefix to save-excursion
mohkale opened this issue · comments
I'd like to add support for preventing the point from changing when you run something like ds
or cs
. Quite often, when you're in the middle of a string and decide to change the delimeter from "
to '
, you don't want to be taken back to the start of it. I think the best way to implement this would be with a single prefix... so... C-u cs"'
would run cs"'
and then return your point to where you began.
Thoughts?
I can't read latex to save my life... and I can't find any move-point like variables in emacs (through ivy fuzzy search). Typing :move-point
just prints out Invalid address. Could you clarify what move-point
is and how it addresses this problem?
Also... to clarify. I don't want to permenently change the behaviour, simply toggle it in the use cases where I don't want it to happen. for example, when I'm in ruby double and single speech marks have different affects regarding interpolation within the string. In that case, when I change the delimeter I would want to move to the start of it so that I can then start replacing any interpolation within it. In python, when I change the delimeter it won't make any difference so I'd probably want to stay where my point was.
a case by case tweak of behaviour is what I want here. by convention, I believe, you use a prefix argument for that.
Hi @mohkale, :move-point
is an option which evil (not evil-surround) provides for some of it's commands where it makes sense, such as yank
. You can see in this section, that I use :move-point
to configure yank's behaviour to my liking (although I think that this setting is the default behaviour):
(evil-set-command-property 'evil-yank :move-point t) ; I could set it to nil to stop point from moving
further, this prefix behaviour you are looking for does not exist in vim-surround
, as far as I am aware. As evil
and evil-surround
try to mimic their vim counterparts to the fullest, I believe that this feature you are looking for could be best implemented in a separate plugin.
closing because vim-surround does not provide the functionality. functionality best provided through an extra plugin.