Monday, February 22, 2016

Re: make operator maps such as ib not change jump list

Le samedi 20 février 2016 20:37:58 UTC+1, Enno a écrit :
> Hello,
>
> In a file with the content
>
> Oui (Non)
>
> and the cursor on `O`, after typing
>
> m`foyib``
>
> the cursor is on `o`.
>
> But because `:h jump-motions` does not list the operator command `ib` as one that changes the jump list, one expects that the cursor
> is instead on `O`.
>
> Usecase: For example, sometimes it is convenient to paste, on the current line, text from somewhere else in the buffer . Then hitting `m'`, moving to the text, yanking, say by `yib`, and returning by `''` is convenient to type and does not override marks.
>
> There's the work-around :onoremap i" :keepjumps normal ib<cr> but this message is about asking if Vim should not default, according to the documentation at least, to this behavior?!
>
> Best regards
>
> Enno

In the meanwhile, the following additional lines in ~/.vimrc work around it:

for d in ['(', ')', 'b', '{', '}', 'B', '[', ']', '<', '>']
for ia in ['i', 'a']
execute 'silent! onoremap <unique><silent><expr> ' . ia . d . ' ' . '":<c-u>keepjumps normal! v" . v:count1 . "' . ia . d .'<CR>"'
endfor
endfor

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: