Friday, September 15, 2017

Re: Don't load specific keymap when pasting

You can also disable keymaps temprarily while pasting.

Toggling keymaps is Ctrl-^ in Insert mode or ":let &imi = !&imi"
(without the quotes) in Normal mode; and if your keyboard (like my
Belgian AZERTY) doesn't give easy access to Ctrl-^ you can remap it to
something else: I use F8, as follows (this stands before the
"loadkeymap" line in my homemade keymap, but you could also put it in
your vimrc):

" map F8 to toggle keymaps, but only if that key isn't yet used for
" something else
if mapcheck("<F8>", "nvoicsxl") == ""
map <F8> :let &l:imi = !&l:imi<CR>
sunmap <F8>
map! <F8> <C-O><F8>
cmap <F8> <C-^>
endif

Best regards,
Tony.

On Fri, Sep 15, 2017 at 10:04 AM, Steve <dlist@bluewin.ch> wrote:
> Hi Christian,
>
> Le 15-09-2017, à 09:39:26 +0200, Christian Brabandt a écrit :
>
>>> So the question is how could I do to not have this behaviour when
>>> copy-pasting?
>>
>>
>> Depends on how you paste. If you paste from the clipboard (and your vim
>> is compiled with clipboard support) this shouldn't happen.
>
>
> vim --version | grep clip
> -clipboard +job +path_extra +user_commands
> +eval +mouse_dec +statusline -xterm_clipboard
>
> So it's not.
> I paste using Edit-> Paste from the Terminal menu.
>
>> However if you use something like MiddleMouse Paste with your mouse
>> using X selection, Vim cannot distinguish this from typing. So you
>> would have to set `:set paste`.
>
>
> Doesn't work with middle mouse button (I used that 15 years ago).
>
> So do you think I should recompile with +clipboard and
> +xterm-clipboard? A bit lost here.
>
>
> Thank you,
> Steve
>
>
> --
> --
> 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.

--
--
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: