Jay Taylor's notes

back to listing index

macos - How do we select text the Terminal way while inside Vim? - Super User

[web search]
Original source (superuser.com)
Tags: os-x vim howto terminal macOS superuser.com
Clipped on: 2020-02-10

Make your voice heard. Take the 2020 Developer Survey now.

For example, when outside of Vim, I can select text then press cmd+c to copy text. But when I am inside of Vim, I can no longer do that because the mouse interacts with Vim.

Is there some way to get the Terminal selection ability back?

For example, in iTerm, this can be done by holding down the alt key, which causes the mouse to stop interacting with Vim, and to highlight text inside the terminal without caring that Vim is running.

asked Feb 1 '17 at 22:30
Image (Asset 2/3) alt=
Why not do :set mouse=all and then you don't have to worry about whether the mouse is handled by vim or your terminal? – James Feb 1 '17 at 22:34
  • @DJMcMayhem, I'm not sure what do you mean. First of all, :set mouse=all results in E539: Illegal character <l> for me, but I assume you mean :set mouse=a. Then, Vim behaves as @trusktr explains, and he wants to stop that. :set mouse= does the trick (as I wrote in my answer). – Dmitry Frank Feb 1 '17 at 22:53
  • @DmitryFrank Ah, that was just a typo. – James Feb 1 '17 at 22:54
  • 1

    I do this:

    :set mouse=
    

    And Vim stops handling mouse. If you want Vim to start handling it again:

    :set mouse=a
    
    answered Feb 1 '17 at 22:50
    Image (Asset 3/3) alt= Question feed