You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I use the surround-change operation (not sure if that is the official name) to switch between single and double quotes for strings in my Ruby program.
While trying to make shortcuts for the aforementioned operation, I noticed that the cursor moves to the beginning of the operand text after the operation. I tried to solve this by restoring Vim's default "position before the latest jump" marker (see :help '') as suggested by a person named "elik" in the #vim IRC channel:
nmap <leader>' cs"' ``
nmap <leader>" cs'" ``
But this did not work. Instead, I had to use an explicit temporary (I hope) marker:
" switch between single and double quotes (surround plugin)
"
" NOTE: we explictly set a temporary marker (z) and restore it after
" the surround operation because the surround plugin does not
" restore the cursor position after the surround operation; it
" leaves the cursor at the opening quote of the operand instead!
"
nmap <leader>' mz cs"' `z
nmap <leader>" mz cs'" `z
Perhaps surround.vim is interfering with this default Vim marker?
Thanks for your consideration.
The text was updated successfully, but these errors were encountered:
As the name implies, the "position before the latest jump" marker only applies to jumps like pageup/pagedown and searching. Surrounding isn't a jump. You can save to this marker explicitly though with `m`` if you want to avoid using a temporary marker.
SIde note: I just lost all respect for markdown trying to actually typeset two adjacent backticks as inline code.
Hello,
I use the surround-change operation (not sure if that is the official name) to switch between single and double quotes for strings in my Ruby program.
While trying to make shortcuts for the aforementioned operation, I noticed that the cursor moves to the beginning of the operand text after the operation. I tried to solve this by restoring Vim's default "position before the latest jump" marker (see :help '') as suggested by a person named "elik" in the #vim IRC channel:
But this did not work. Instead, I had to use an explicit temporary (I hope) marker:
Perhaps surround.vim is interfering with this default Vim marker?
Thanks for your consideration.
The text was updated successfully, but these errors were encountered: