Copy-paste for vim is not working when mouse (:set mouse=a) is on?












40














I was trying to copy paste something from vim to another application and also, from that application to vim using right click with mouse and then copy and paste (or with Ctrl+v and Ctrl+c and also tried the Command version for mac OSX, obviously.). However, when I try doing it, it only copies the first word when I do it from vim or when I copy from the application to vim, it copies everything, but inserts strange tabs and spaces. I think this happened when I decided to set my mouse on in the terminal. As in:



:set mouse=a


I have that line on my .vimrc file on iTerm (mac os x). Though, is it possible to make my copy paste with other applications that are not in vim not to break with the mouse=a on? Or is it at least possible to set my mouse off while I do the copy paste? I did :help mouse but the comments were not useful for me. I would paste them here but... my copy paste tool is broken!



I did try :set mouse! and :set mouse=a! but these did nothing useful... :(





Additional info of my environment:



I am also using tmux most of the time, though, I tested this error/bug without a tmux session, thats why I posted this mainly as a vim question.










share|improve this question




















  • 4




    I can tell you that vim is capable of yanking to the Primary Selection just fine using the y verb. I don't know why you wouldn't just use that.
    – HalosGhost
    Jun 27 '14 at 19:44






  • 1




    I wouldn't do that because I don't know how to do that I guess, apologize for my incompetence. I didn't even know that existed until you mentioned it. Please share your knowledge! :)
    – Pinocchio
    Jun 27 '14 at 20:07












  • Is this macvim?
    – Patrick
    Jun 28 '14 at 0:00










  • no it is not its just iTerm (as I mentioned on the question, but good question though).
    – Pinocchio
    Jun 28 '14 at 1:17






  • 3




    @Pinocchio - take a look here: How to make vim paste from (and copy to) system's clipboard?.
    – slm
    Jun 28 '14 at 12:10


















40














I was trying to copy paste something from vim to another application and also, from that application to vim using right click with mouse and then copy and paste (or with Ctrl+v and Ctrl+c and also tried the Command version for mac OSX, obviously.). However, when I try doing it, it only copies the first word when I do it from vim or when I copy from the application to vim, it copies everything, but inserts strange tabs and spaces. I think this happened when I decided to set my mouse on in the terminal. As in:



:set mouse=a


I have that line on my .vimrc file on iTerm (mac os x). Though, is it possible to make my copy paste with other applications that are not in vim not to break with the mouse=a on? Or is it at least possible to set my mouse off while I do the copy paste? I did :help mouse but the comments were not useful for me. I would paste them here but... my copy paste tool is broken!



I did try :set mouse! and :set mouse=a! but these did nothing useful... :(





Additional info of my environment:



I am also using tmux most of the time, though, I tested this error/bug without a tmux session, thats why I posted this mainly as a vim question.










share|improve this question




















  • 4




    I can tell you that vim is capable of yanking to the Primary Selection just fine using the y verb. I don't know why you wouldn't just use that.
    – HalosGhost
    Jun 27 '14 at 19:44






  • 1




    I wouldn't do that because I don't know how to do that I guess, apologize for my incompetence. I didn't even know that existed until you mentioned it. Please share your knowledge! :)
    – Pinocchio
    Jun 27 '14 at 20:07












  • Is this macvim?
    – Patrick
    Jun 28 '14 at 0:00










  • no it is not its just iTerm (as I mentioned on the question, but good question though).
    – Pinocchio
    Jun 28 '14 at 1:17






  • 3




    @Pinocchio - take a look here: How to make vim paste from (and copy to) system's clipboard?.
    – slm
    Jun 28 '14 at 12:10
















40












40








40


14





I was trying to copy paste something from vim to another application and also, from that application to vim using right click with mouse and then copy and paste (or with Ctrl+v and Ctrl+c and also tried the Command version for mac OSX, obviously.). However, when I try doing it, it only copies the first word when I do it from vim or when I copy from the application to vim, it copies everything, but inserts strange tabs and spaces. I think this happened when I decided to set my mouse on in the terminal. As in:



:set mouse=a


I have that line on my .vimrc file on iTerm (mac os x). Though, is it possible to make my copy paste with other applications that are not in vim not to break with the mouse=a on? Or is it at least possible to set my mouse off while I do the copy paste? I did :help mouse but the comments were not useful for me. I would paste them here but... my copy paste tool is broken!



I did try :set mouse! and :set mouse=a! but these did nothing useful... :(





Additional info of my environment:



I am also using tmux most of the time, though, I tested this error/bug without a tmux session, thats why I posted this mainly as a vim question.










share|improve this question















I was trying to copy paste something from vim to another application and also, from that application to vim using right click with mouse and then copy and paste (or with Ctrl+v and Ctrl+c and also tried the Command version for mac OSX, obviously.). However, when I try doing it, it only copies the first word when I do it from vim or when I copy from the application to vim, it copies everything, but inserts strange tabs and spaces. I think this happened when I decided to set my mouse on in the terminal. As in:



:set mouse=a


I have that line on my .vimrc file on iTerm (mac os x). Though, is it possible to make my copy paste with other applications that are not in vim not to break with the mouse=a on? Or is it at least possible to set my mouse off while I do the copy paste? I did :help mouse but the comments were not useful for me. I would paste them here but... my copy paste tool is broken!



I did try :set mouse! and :set mouse=a! but these did nothing useful... :(





Additional info of my environment:



I am also using tmux most of the time, though, I tested this error/bug without a tmux session, thats why I posted this mainly as a vim question.







vim clipboard






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Aug 19 '17 at 19:14









Jeff Schaller

38.7k1053125




38.7k1053125










asked Jun 27 '14 at 19:12









Pinocchio

3632411




3632411








  • 4




    I can tell you that vim is capable of yanking to the Primary Selection just fine using the y verb. I don't know why you wouldn't just use that.
    – HalosGhost
    Jun 27 '14 at 19:44






  • 1




    I wouldn't do that because I don't know how to do that I guess, apologize for my incompetence. I didn't even know that existed until you mentioned it. Please share your knowledge! :)
    – Pinocchio
    Jun 27 '14 at 20:07












  • Is this macvim?
    – Patrick
    Jun 28 '14 at 0:00










  • no it is not its just iTerm (as I mentioned on the question, but good question though).
    – Pinocchio
    Jun 28 '14 at 1:17






  • 3




    @Pinocchio - take a look here: How to make vim paste from (and copy to) system's clipboard?.
    – slm
    Jun 28 '14 at 12:10
















  • 4




    I can tell you that vim is capable of yanking to the Primary Selection just fine using the y verb. I don't know why you wouldn't just use that.
    – HalosGhost
    Jun 27 '14 at 19:44






  • 1




    I wouldn't do that because I don't know how to do that I guess, apologize for my incompetence. I didn't even know that existed until you mentioned it. Please share your knowledge! :)
    – Pinocchio
    Jun 27 '14 at 20:07












  • Is this macvim?
    – Patrick
    Jun 28 '14 at 0:00










  • no it is not its just iTerm (as I mentioned on the question, but good question though).
    – Pinocchio
    Jun 28 '14 at 1:17






  • 3




    @Pinocchio - take a look here: How to make vim paste from (and copy to) system's clipboard?.
    – slm
    Jun 28 '14 at 12:10










4




4




I can tell you that vim is capable of yanking to the Primary Selection just fine using the y verb. I don't know why you wouldn't just use that.
– HalosGhost
Jun 27 '14 at 19:44




I can tell you that vim is capable of yanking to the Primary Selection just fine using the y verb. I don't know why you wouldn't just use that.
– HalosGhost
Jun 27 '14 at 19:44




1




1




I wouldn't do that because I don't know how to do that I guess, apologize for my incompetence. I didn't even know that existed until you mentioned it. Please share your knowledge! :)
– Pinocchio
Jun 27 '14 at 20:07






I wouldn't do that because I don't know how to do that I guess, apologize for my incompetence. I didn't even know that existed until you mentioned it. Please share your knowledge! :)
– Pinocchio
Jun 27 '14 at 20:07














Is this macvim?
– Patrick
Jun 28 '14 at 0:00




Is this macvim?
– Patrick
Jun 28 '14 at 0:00












no it is not its just iTerm (as I mentioned on the question, but good question though).
– Pinocchio
Jun 28 '14 at 1:17




no it is not its just iTerm (as I mentioned on the question, but good question though).
– Pinocchio
Jun 28 '14 at 1:17




3




3




@Pinocchio - take a look here: How to make vim paste from (and copy to) system's clipboard?.
– slm
Jun 28 '14 at 12:10






@Pinocchio - take a look here: How to make vim paste from (and copy to) system's clipboard?.
– slm
Jun 28 '14 at 12:10












10 Answers
10






active

oldest

votes


















52





+25









mouse=a prevents the ability of copying and pasting out of vim with readable characters.



Change mouse=a to mouse=r and that should fix your issue with that.



one thing I am wondering is, are you changing the config file for your vim with the mouse set to mouse=a?



orignal answer ^



If mouse=r doesn't give you all the copy past options change it to mouse=v



Both mouse=r and mouse=v have the same functions you are needing, but depending on the vimrc you are using one will work better then the other.






share|improve this answer























  • also have you tryed highlighting the the text and use you mouse middle button to past into another place. that tends to work better when tryng to Ctrl+v and Ctrl+c
    – bgrif
    Jul 3 '14 at 15:31










  • I don't know what your question means: one thing I am wondering is, are you changing the config file for your vim with the mouse set to mouse=a? You mean if I have :mouse=a on in my .vimrc file? I do have :mouse=a in my .vimrc file file.
    – Pinocchio
    Jul 3 '14 at 15:57












  • that is what I mean. That is my mistake on asking it like that. you need to change it to mouse=x.....
    – bgrif
    Jul 3 '14 at 16:10






  • 1




    just --with-x=yes? I do not need to put :set --with-x=yes mouse=a or something? Could you clarify what you mean?
    – Pinocchio
    Jul 7 '14 at 14:57






  • 1




    Let me research if you need to combine --with-x=yes to set mouse=a. When i was reading up on it all i saw was it was by itself in the config file. But it could be different so I want to make sure that I tell you the right thing that will work for you.
    – bgrif
    Jul 7 '14 at 15:06



















18














For OS X users: To copy paste with mouse=a use alt instead of Shift to selec the text. Then cmd-c and cmd-v work as expected.



Found this answer here https://stackoverflow.com/a/4608387/671639 after a lot of googling.






share|improve this answer























  • You are God...... :')
    – omerjerk
    Dec 14 '16 at 6:54










  • the only thing that worked for me, thanks!
    – Don
    May 23 '17 at 15:10






  • 2




    For me on OSX works "fn" instead of "shift" or "alt".
    – ssasa
    Sep 10 '17 at 14:17





















6














From https://stackoverflow.com/questions/4608161/copy-text-out-of-vim-with-set-mouse-a-enabled/4608387



Press 'shift' key while selecting with the mouse. This will make mouse selection behave as if mouse=a was not enabled.



This works and has been verified by reviewers of stack-overflow who have accepted this as answer :)






share|improve this answer





























    6














    Bharath's solution, pressing Shift while copying, will do it, but it will copy more than what you'd like to copy in-case of numbering or hash comments.



    One way to do so even with mouse=a is use visual mode by pressing V for single cursor or Shift+V for full line highlight, and you can move up or down with arrows and use Y to copy or D to cut and that should work.






    share|improve this answer























    • @Anthon, Will do, Thanks for the clarification.
      – amrx
      Apr 2 '15 at 14:02






    • 1




      I rephrased your self-pronounced comment to make it more like an answer that way the mods will probably leave it as is (and you might gain some reputation on it so you can comment). If the original had been a more minor correction, commenting would have been more appropriate.
      – Anthon
      Apr 2 '15 at 14:15





















    3














    Refer: http://vimdoc.sourceforge.net/htmldoc/options.html



    Look at Note section at the bottom of the reference:
    When enabling the mouse, the mouse buttons can still be used by keeping the shift key pressed. This includes copy paste using mouse buttons.



    *'mouse'* *E538*
    'mouse' string (default "", "a" for GUI, MS-DOS and Win32)
    global
    {not in Vi}
    Enable the use of the mouse. Only works for certain terminals
    (xterm, MS-DOS, Win32 |win32-mouse|, QNX pterm, *BSD console with
    sysmouse and Linux console with gpm). For using the mouse in the
    GUI, see |gui-mouse|.
    The mouse can be enabled for different modes:
    n Normal mode
    v Visual mode
    i Insert mode
    c Command-line mode
    h all previous modes when editing a help file
    a all previous modes
    r for |hit-enter| and |more-prompt| prompt
    Normally you would enable the mouse in all four modes with:
    :set mouse=a
    When the mouse is not enabled, the GUI will still use the mouse for
    modeless selection. This doesn't move the text cursor.

    See |mouse-using|. Also see |'clipboard'|.

    Note: When enabling the mouse in a terminal, copy/paste will use the
    "* register if there is access to an X-server. The xterm handling of
    the mouse buttons can still be used by keeping the shift key pressed.
    Also see the 'clipboard' option.





    share|improve this answer



















    • 1




      Thanks for contributing that reference, but, does it answer the question? If so, can you identify the part of the quote that does so, presenting a summary of the actual answer?
      – G-Man
      Feb 23 '15 at 18:36



















    3














    Had the same problem: could not highlight using the mouse so could not copy and paste from VIM in a terminal session to Windows document and browser:
    Did the following and it now works:



    : set clipboard=unnamedplus
    : set mouse=r





    share|improve this answer































      0














      As for the second part of your question where in you specified that when pasting from other applications to vim it adds tabs/spaces. Try adding this to your ~/.vimrc
      set paste
      or in vim before pasting in normal mode
      press "shift" + ":" and type "set paste"






      share|improve this answer































        0














        Use these two lines below in your ~./vimrc to use all nice features of a gui-mouse and paste into system clipboard using y (yank key) if you don't really need any additional clipboard buffers:



        set mouse=a
        set clipboard=unnamed





        share|improve this answer





























          0














          You can use y to copy(yank) and p to paste even with :set mouse=a set in ~/.vimrc. Use v+arrow keys to highlight the text. To copy an entire line quickly, use shift+y.






          share|improve this answer





























            0














            @bgrif Changing mouse=a to mouse=v in ~/.vimrc worked for me.






            share|improve this answer





















              Your Answer








              StackExchange.ready(function() {
              var channelOptions = {
              tags: "".split(" "),
              id: "106"
              };
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function() {
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled) {
              StackExchange.using("snippets", function() {
              createEditor();
              });
              }
              else {
              createEditor();
              }
              });

              function createEditor() {
              StackExchange.prepareEditor({
              heartbeatType: 'answer',
              autoActivateHeartbeat: false,
              convertImagesToLinks: false,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: null,
              bindNavPrevention: true,
              postfix: "",
              imageUploader: {
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              },
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              });


              }
              });














              draft saved

              draft discarded


















              StackExchange.ready(
              function () {
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f139578%2fcopy-paste-for-vim-is-not-working-when-mouse-set-mouse-a-is-on%23new-answer', 'question_page');
              }
              );

              Post as a guest















              Required, but never shown

























              10 Answers
              10






              active

              oldest

              votes








              10 Answers
              10






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              52





              +25









              mouse=a prevents the ability of copying and pasting out of vim with readable characters.



              Change mouse=a to mouse=r and that should fix your issue with that.



              one thing I am wondering is, are you changing the config file for your vim with the mouse set to mouse=a?



              orignal answer ^



              If mouse=r doesn't give you all the copy past options change it to mouse=v



              Both mouse=r and mouse=v have the same functions you are needing, but depending on the vimrc you are using one will work better then the other.






              share|improve this answer























              • also have you tryed highlighting the the text and use you mouse middle button to past into another place. that tends to work better when tryng to Ctrl+v and Ctrl+c
                – bgrif
                Jul 3 '14 at 15:31










              • I don't know what your question means: one thing I am wondering is, are you changing the config file for your vim with the mouse set to mouse=a? You mean if I have :mouse=a on in my .vimrc file? I do have :mouse=a in my .vimrc file file.
                – Pinocchio
                Jul 3 '14 at 15:57












              • that is what I mean. That is my mistake on asking it like that. you need to change it to mouse=x.....
                – bgrif
                Jul 3 '14 at 16:10






              • 1




                just --with-x=yes? I do not need to put :set --with-x=yes mouse=a or something? Could you clarify what you mean?
                – Pinocchio
                Jul 7 '14 at 14:57






              • 1




                Let me research if you need to combine --with-x=yes to set mouse=a. When i was reading up on it all i saw was it was by itself in the config file. But it could be different so I want to make sure that I tell you the right thing that will work for you.
                – bgrif
                Jul 7 '14 at 15:06
















              52





              +25









              mouse=a prevents the ability of copying and pasting out of vim with readable characters.



              Change mouse=a to mouse=r and that should fix your issue with that.



              one thing I am wondering is, are you changing the config file for your vim with the mouse set to mouse=a?



              orignal answer ^



              If mouse=r doesn't give you all the copy past options change it to mouse=v



              Both mouse=r and mouse=v have the same functions you are needing, but depending on the vimrc you are using one will work better then the other.






              share|improve this answer























              • also have you tryed highlighting the the text and use you mouse middle button to past into another place. that tends to work better when tryng to Ctrl+v and Ctrl+c
                – bgrif
                Jul 3 '14 at 15:31










              • I don't know what your question means: one thing I am wondering is, are you changing the config file for your vim with the mouse set to mouse=a? You mean if I have :mouse=a on in my .vimrc file? I do have :mouse=a in my .vimrc file file.
                – Pinocchio
                Jul 3 '14 at 15:57












              • that is what I mean. That is my mistake on asking it like that. you need to change it to mouse=x.....
                – bgrif
                Jul 3 '14 at 16:10






              • 1




                just --with-x=yes? I do not need to put :set --with-x=yes mouse=a or something? Could you clarify what you mean?
                – Pinocchio
                Jul 7 '14 at 14:57






              • 1




                Let me research if you need to combine --with-x=yes to set mouse=a. When i was reading up on it all i saw was it was by itself in the config file. But it could be different so I want to make sure that I tell you the right thing that will work for you.
                – bgrif
                Jul 7 '14 at 15:06














              52





              +25







              52





              +25



              52




              +25




              mouse=a prevents the ability of copying and pasting out of vim with readable characters.



              Change mouse=a to mouse=r and that should fix your issue with that.



              one thing I am wondering is, are you changing the config file for your vim with the mouse set to mouse=a?



              orignal answer ^



              If mouse=r doesn't give you all the copy past options change it to mouse=v



              Both mouse=r and mouse=v have the same functions you are needing, but depending on the vimrc you are using one will work better then the other.






              share|improve this answer














              mouse=a prevents the ability of copying and pasting out of vim with readable characters.



              Change mouse=a to mouse=r and that should fix your issue with that.



              one thing I am wondering is, are you changing the config file for your vim with the mouse set to mouse=a?



              orignal answer ^



              If mouse=r doesn't give you all the copy past options change it to mouse=v



              Both mouse=r and mouse=v have the same functions you are needing, but depending on the vimrc you are using one will work better then the other.







              share|improve this answer














              share|improve this answer



              share|improve this answer








              edited Jul 11 '14 at 14:08

























              answered Jul 3 '14 at 15:24









              bgrif

              71349




              71349












              • also have you tryed highlighting the the text and use you mouse middle button to past into another place. that tends to work better when tryng to Ctrl+v and Ctrl+c
                – bgrif
                Jul 3 '14 at 15:31










              • I don't know what your question means: one thing I am wondering is, are you changing the config file for your vim with the mouse set to mouse=a? You mean if I have :mouse=a on in my .vimrc file? I do have :mouse=a in my .vimrc file file.
                – Pinocchio
                Jul 3 '14 at 15:57












              • that is what I mean. That is my mistake on asking it like that. you need to change it to mouse=x.....
                – bgrif
                Jul 3 '14 at 16:10






              • 1




                just --with-x=yes? I do not need to put :set --with-x=yes mouse=a or something? Could you clarify what you mean?
                – Pinocchio
                Jul 7 '14 at 14:57






              • 1




                Let me research if you need to combine --with-x=yes to set mouse=a. When i was reading up on it all i saw was it was by itself in the config file. But it could be different so I want to make sure that I tell you the right thing that will work for you.
                – bgrif
                Jul 7 '14 at 15:06


















              • also have you tryed highlighting the the text and use you mouse middle button to past into another place. that tends to work better when tryng to Ctrl+v and Ctrl+c
                – bgrif
                Jul 3 '14 at 15:31










              • I don't know what your question means: one thing I am wondering is, are you changing the config file for your vim with the mouse set to mouse=a? You mean if I have :mouse=a on in my .vimrc file? I do have :mouse=a in my .vimrc file file.
                – Pinocchio
                Jul 3 '14 at 15:57












              • that is what I mean. That is my mistake on asking it like that. you need to change it to mouse=x.....
                – bgrif
                Jul 3 '14 at 16:10






              • 1




                just --with-x=yes? I do not need to put :set --with-x=yes mouse=a or something? Could you clarify what you mean?
                – Pinocchio
                Jul 7 '14 at 14:57






              • 1




                Let me research if you need to combine --with-x=yes to set mouse=a. When i was reading up on it all i saw was it was by itself in the config file. But it could be different so I want to make sure that I tell you the right thing that will work for you.
                – bgrif
                Jul 7 '14 at 15:06
















              also have you tryed highlighting the the text and use you mouse middle button to past into another place. that tends to work better when tryng to Ctrl+v and Ctrl+c
              – bgrif
              Jul 3 '14 at 15:31




              also have you tryed highlighting the the text and use you mouse middle button to past into another place. that tends to work better when tryng to Ctrl+v and Ctrl+c
              – bgrif
              Jul 3 '14 at 15:31












              I don't know what your question means: one thing I am wondering is, are you changing the config file for your vim with the mouse set to mouse=a? You mean if I have :mouse=a on in my .vimrc file? I do have :mouse=a in my .vimrc file file.
              – Pinocchio
              Jul 3 '14 at 15:57






              I don't know what your question means: one thing I am wondering is, are you changing the config file for your vim with the mouse set to mouse=a? You mean if I have :mouse=a on in my .vimrc file? I do have :mouse=a in my .vimrc file file.
              – Pinocchio
              Jul 3 '14 at 15:57














              that is what I mean. That is my mistake on asking it like that. you need to change it to mouse=x.....
              – bgrif
              Jul 3 '14 at 16:10




              that is what I mean. That is my mistake on asking it like that. you need to change it to mouse=x.....
              – bgrif
              Jul 3 '14 at 16:10




              1




              1




              just --with-x=yes? I do not need to put :set --with-x=yes mouse=a or something? Could you clarify what you mean?
              – Pinocchio
              Jul 7 '14 at 14:57




              just --with-x=yes? I do not need to put :set --with-x=yes mouse=a or something? Could you clarify what you mean?
              – Pinocchio
              Jul 7 '14 at 14:57




              1




              1




              Let me research if you need to combine --with-x=yes to set mouse=a. When i was reading up on it all i saw was it was by itself in the config file. But it could be different so I want to make sure that I tell you the right thing that will work for you.
              – bgrif
              Jul 7 '14 at 15:06




              Let me research if you need to combine --with-x=yes to set mouse=a. When i was reading up on it all i saw was it was by itself in the config file. But it could be different so I want to make sure that I tell you the right thing that will work for you.
              – bgrif
              Jul 7 '14 at 15:06













              18














              For OS X users: To copy paste with mouse=a use alt instead of Shift to selec the text. Then cmd-c and cmd-v work as expected.



              Found this answer here https://stackoverflow.com/a/4608387/671639 after a lot of googling.






              share|improve this answer























              • You are God...... :')
                – omerjerk
                Dec 14 '16 at 6:54










              • the only thing that worked for me, thanks!
                – Don
                May 23 '17 at 15:10






              • 2




                For me on OSX works "fn" instead of "shift" or "alt".
                – ssasa
                Sep 10 '17 at 14:17


















              18














              For OS X users: To copy paste with mouse=a use alt instead of Shift to selec the text. Then cmd-c and cmd-v work as expected.



              Found this answer here https://stackoverflow.com/a/4608387/671639 after a lot of googling.






              share|improve this answer























              • You are God...... :')
                – omerjerk
                Dec 14 '16 at 6:54










              • the only thing that worked for me, thanks!
                – Don
                May 23 '17 at 15:10






              • 2




                For me on OSX works "fn" instead of "shift" or "alt".
                – ssasa
                Sep 10 '17 at 14:17
















              18












              18








              18






              For OS X users: To copy paste with mouse=a use alt instead of Shift to selec the text. Then cmd-c and cmd-v work as expected.



              Found this answer here https://stackoverflow.com/a/4608387/671639 after a lot of googling.






              share|improve this answer














              For OS X users: To copy paste with mouse=a use alt instead of Shift to selec the text. Then cmd-c and cmd-v work as expected.



              Found this answer here https://stackoverflow.com/a/4608387/671639 after a lot of googling.







              share|improve this answer














              share|improve this answer



              share|improve this answer








              edited May 23 '17 at 12:40









              Community

              1




              1










              answered Sep 15 '15 at 5:55









              BetaRide

              28124




              28124












              • You are God...... :')
                – omerjerk
                Dec 14 '16 at 6:54










              • the only thing that worked for me, thanks!
                – Don
                May 23 '17 at 15:10






              • 2




                For me on OSX works "fn" instead of "shift" or "alt".
                – ssasa
                Sep 10 '17 at 14:17




















              • You are God...... :')
                – omerjerk
                Dec 14 '16 at 6:54










              • the only thing that worked for me, thanks!
                – Don
                May 23 '17 at 15:10






              • 2




                For me on OSX works "fn" instead of "shift" or "alt".
                – ssasa
                Sep 10 '17 at 14:17


















              You are God...... :')
              – omerjerk
              Dec 14 '16 at 6:54




              You are God...... :')
              – omerjerk
              Dec 14 '16 at 6:54












              the only thing that worked for me, thanks!
              – Don
              May 23 '17 at 15:10




              the only thing that worked for me, thanks!
              – Don
              May 23 '17 at 15:10




              2




              2




              For me on OSX works "fn" instead of "shift" or "alt".
              – ssasa
              Sep 10 '17 at 14:17






              For me on OSX works "fn" instead of "shift" or "alt".
              – ssasa
              Sep 10 '17 at 14:17













              6














              From https://stackoverflow.com/questions/4608161/copy-text-out-of-vim-with-set-mouse-a-enabled/4608387



              Press 'shift' key while selecting with the mouse. This will make mouse selection behave as if mouse=a was not enabled.



              This works and has been verified by reviewers of stack-overflow who have accepted this as answer :)






              share|improve this answer


























                6














                From https://stackoverflow.com/questions/4608161/copy-text-out-of-vim-with-set-mouse-a-enabled/4608387



                Press 'shift' key while selecting with the mouse. This will make mouse selection behave as if mouse=a was not enabled.



                This works and has been verified by reviewers of stack-overflow who have accepted this as answer :)






                share|improve this answer
























                  6












                  6








                  6






                  From https://stackoverflow.com/questions/4608161/copy-text-out-of-vim-with-set-mouse-a-enabled/4608387



                  Press 'shift' key while selecting with the mouse. This will make mouse selection behave as if mouse=a was not enabled.



                  This works and has been verified by reviewers of stack-overflow who have accepted this as answer :)






                  share|improve this answer












                  From https://stackoverflow.com/questions/4608161/copy-text-out-of-vim-with-set-mouse-a-enabled/4608387



                  Press 'shift' key while selecting with the mouse. This will make mouse selection behave as if mouse=a was not enabled.



                  This works and has been verified by reviewers of stack-overflow who have accepted this as answer :)







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Feb 26 '15 at 6:36









                  BHS

                  17112




                  17112























                      6














                      Bharath's solution, pressing Shift while copying, will do it, but it will copy more than what you'd like to copy in-case of numbering or hash comments.



                      One way to do so even with mouse=a is use visual mode by pressing V for single cursor or Shift+V for full line highlight, and you can move up or down with arrows and use Y to copy or D to cut and that should work.






                      share|improve this answer























                      • @Anthon, Will do, Thanks for the clarification.
                        – amrx
                        Apr 2 '15 at 14:02






                      • 1




                        I rephrased your self-pronounced comment to make it more like an answer that way the mods will probably leave it as is (and you might gain some reputation on it so you can comment). If the original had been a more minor correction, commenting would have been more appropriate.
                        – Anthon
                        Apr 2 '15 at 14:15


















                      6














                      Bharath's solution, pressing Shift while copying, will do it, but it will copy more than what you'd like to copy in-case of numbering or hash comments.



                      One way to do so even with mouse=a is use visual mode by pressing V for single cursor or Shift+V for full line highlight, and you can move up or down with arrows and use Y to copy or D to cut and that should work.






                      share|improve this answer























                      • @Anthon, Will do, Thanks for the clarification.
                        – amrx
                        Apr 2 '15 at 14:02






                      • 1




                        I rephrased your self-pronounced comment to make it more like an answer that way the mods will probably leave it as is (and you might gain some reputation on it so you can comment). If the original had been a more minor correction, commenting would have been more appropriate.
                        – Anthon
                        Apr 2 '15 at 14:15
















                      6












                      6








                      6






                      Bharath's solution, pressing Shift while copying, will do it, but it will copy more than what you'd like to copy in-case of numbering or hash comments.



                      One way to do so even with mouse=a is use visual mode by pressing V for single cursor or Shift+V for full line highlight, and you can move up or down with arrows and use Y to copy or D to cut and that should work.






                      share|improve this answer














                      Bharath's solution, pressing Shift while copying, will do it, but it will copy more than what you'd like to copy in-case of numbering or hash comments.



                      One way to do so even with mouse=a is use visual mode by pressing V for single cursor or Shift+V for full line highlight, and you can move up or down with arrows and use Y to copy or D to cut and that should work.







                      share|improve this answer














                      share|improve this answer



                      share|improve this answer








                      edited Apr 13 '17 at 12:36









                      Community

                      1




                      1










                      answered Apr 2 '15 at 12:54









                      amrx

                      16114




                      16114












                      • @Anthon, Will do, Thanks for the clarification.
                        – amrx
                        Apr 2 '15 at 14:02






                      • 1




                        I rephrased your self-pronounced comment to make it more like an answer that way the mods will probably leave it as is (and you might gain some reputation on it so you can comment). If the original had been a more minor correction, commenting would have been more appropriate.
                        – Anthon
                        Apr 2 '15 at 14:15




















                      • @Anthon, Will do, Thanks for the clarification.
                        – amrx
                        Apr 2 '15 at 14:02






                      • 1




                        I rephrased your self-pronounced comment to make it more like an answer that way the mods will probably leave it as is (and you might gain some reputation on it so you can comment). If the original had been a more minor correction, commenting would have been more appropriate.
                        – Anthon
                        Apr 2 '15 at 14:15


















                      @Anthon, Will do, Thanks for the clarification.
                      – amrx
                      Apr 2 '15 at 14:02




                      @Anthon, Will do, Thanks for the clarification.
                      – amrx
                      Apr 2 '15 at 14:02




                      1




                      1




                      I rephrased your self-pronounced comment to make it more like an answer that way the mods will probably leave it as is (and you might gain some reputation on it so you can comment). If the original had been a more minor correction, commenting would have been more appropriate.
                      – Anthon
                      Apr 2 '15 at 14:15






                      I rephrased your self-pronounced comment to make it more like an answer that way the mods will probably leave it as is (and you might gain some reputation on it so you can comment). If the original had been a more minor correction, commenting would have been more appropriate.
                      – Anthon
                      Apr 2 '15 at 14:15













                      3














                      Refer: http://vimdoc.sourceforge.net/htmldoc/options.html



                      Look at Note section at the bottom of the reference:
                      When enabling the mouse, the mouse buttons can still be used by keeping the shift key pressed. This includes copy paste using mouse buttons.



                      *'mouse'* *E538*
                      'mouse' string (default "", "a" for GUI, MS-DOS and Win32)
                      global
                      {not in Vi}
                      Enable the use of the mouse. Only works for certain terminals
                      (xterm, MS-DOS, Win32 |win32-mouse|, QNX pterm, *BSD console with
                      sysmouse and Linux console with gpm). For using the mouse in the
                      GUI, see |gui-mouse|.
                      The mouse can be enabled for different modes:
                      n Normal mode
                      v Visual mode
                      i Insert mode
                      c Command-line mode
                      h all previous modes when editing a help file
                      a all previous modes
                      r for |hit-enter| and |more-prompt| prompt
                      Normally you would enable the mouse in all four modes with:
                      :set mouse=a
                      When the mouse is not enabled, the GUI will still use the mouse for
                      modeless selection. This doesn't move the text cursor.

                      See |mouse-using|. Also see |'clipboard'|.

                      Note: When enabling the mouse in a terminal, copy/paste will use the
                      "* register if there is access to an X-server. The xterm handling of
                      the mouse buttons can still be used by keeping the shift key pressed.
                      Also see the 'clipboard' option.





                      share|improve this answer



















                      • 1




                        Thanks for contributing that reference, but, does it answer the question? If so, can you identify the part of the quote that does so, presenting a summary of the actual answer?
                        – G-Man
                        Feb 23 '15 at 18:36
















                      3














                      Refer: http://vimdoc.sourceforge.net/htmldoc/options.html



                      Look at Note section at the bottom of the reference:
                      When enabling the mouse, the mouse buttons can still be used by keeping the shift key pressed. This includes copy paste using mouse buttons.



                      *'mouse'* *E538*
                      'mouse' string (default "", "a" for GUI, MS-DOS and Win32)
                      global
                      {not in Vi}
                      Enable the use of the mouse. Only works for certain terminals
                      (xterm, MS-DOS, Win32 |win32-mouse|, QNX pterm, *BSD console with
                      sysmouse and Linux console with gpm). For using the mouse in the
                      GUI, see |gui-mouse|.
                      The mouse can be enabled for different modes:
                      n Normal mode
                      v Visual mode
                      i Insert mode
                      c Command-line mode
                      h all previous modes when editing a help file
                      a all previous modes
                      r for |hit-enter| and |more-prompt| prompt
                      Normally you would enable the mouse in all four modes with:
                      :set mouse=a
                      When the mouse is not enabled, the GUI will still use the mouse for
                      modeless selection. This doesn't move the text cursor.

                      See |mouse-using|. Also see |'clipboard'|.

                      Note: When enabling the mouse in a terminal, copy/paste will use the
                      "* register if there is access to an X-server. The xterm handling of
                      the mouse buttons can still be used by keeping the shift key pressed.
                      Also see the 'clipboard' option.





                      share|improve this answer



















                      • 1




                        Thanks for contributing that reference, but, does it answer the question? If so, can you identify the part of the quote that does so, presenting a summary of the actual answer?
                        – G-Man
                        Feb 23 '15 at 18:36














                      3












                      3








                      3






                      Refer: http://vimdoc.sourceforge.net/htmldoc/options.html



                      Look at Note section at the bottom of the reference:
                      When enabling the mouse, the mouse buttons can still be used by keeping the shift key pressed. This includes copy paste using mouse buttons.



                      *'mouse'* *E538*
                      'mouse' string (default "", "a" for GUI, MS-DOS and Win32)
                      global
                      {not in Vi}
                      Enable the use of the mouse. Only works for certain terminals
                      (xterm, MS-DOS, Win32 |win32-mouse|, QNX pterm, *BSD console with
                      sysmouse and Linux console with gpm). For using the mouse in the
                      GUI, see |gui-mouse|.
                      The mouse can be enabled for different modes:
                      n Normal mode
                      v Visual mode
                      i Insert mode
                      c Command-line mode
                      h all previous modes when editing a help file
                      a all previous modes
                      r for |hit-enter| and |more-prompt| prompt
                      Normally you would enable the mouse in all four modes with:
                      :set mouse=a
                      When the mouse is not enabled, the GUI will still use the mouse for
                      modeless selection. This doesn't move the text cursor.

                      See |mouse-using|. Also see |'clipboard'|.

                      Note: When enabling the mouse in a terminal, copy/paste will use the
                      "* register if there is access to an X-server. The xterm handling of
                      the mouse buttons can still be used by keeping the shift key pressed.
                      Also see the 'clipboard' option.





                      share|improve this answer














                      Refer: http://vimdoc.sourceforge.net/htmldoc/options.html



                      Look at Note section at the bottom of the reference:
                      When enabling the mouse, the mouse buttons can still be used by keeping the shift key pressed. This includes copy paste using mouse buttons.



                      *'mouse'* *E538*
                      'mouse' string (default "", "a" for GUI, MS-DOS and Win32)
                      global
                      {not in Vi}
                      Enable the use of the mouse. Only works for certain terminals
                      (xterm, MS-DOS, Win32 |win32-mouse|, QNX pterm, *BSD console with
                      sysmouse and Linux console with gpm). For using the mouse in the
                      GUI, see |gui-mouse|.
                      The mouse can be enabled for different modes:
                      n Normal mode
                      v Visual mode
                      i Insert mode
                      c Command-line mode
                      h all previous modes when editing a help file
                      a all previous modes
                      r for |hit-enter| and |more-prompt| prompt
                      Normally you would enable the mouse in all four modes with:
                      :set mouse=a
                      When the mouse is not enabled, the GUI will still use the mouse for
                      modeless selection. This doesn't move the text cursor.

                      See |mouse-using|. Also see |'clipboard'|.

                      Note: When enabling the mouse in a terminal, copy/paste will use the
                      "* register if there is access to an X-server. The xterm handling of
                      the mouse buttons can still be used by keeping the shift key pressed.
                      Also see the 'clipboard' option.






                      share|improve this answer














                      share|improve this answer



                      share|improve this answer








                      edited Feb 24 '15 at 22:38

























                      answered Feb 23 '15 at 18:18









                      rabin utam

                      1392




                      1392








                      • 1




                        Thanks for contributing that reference, but, does it answer the question? If so, can you identify the part of the quote that does so, presenting a summary of the actual answer?
                        – G-Man
                        Feb 23 '15 at 18:36














                      • 1




                        Thanks for contributing that reference, but, does it answer the question? If so, can you identify the part of the quote that does so, presenting a summary of the actual answer?
                        – G-Man
                        Feb 23 '15 at 18:36








                      1




                      1




                      Thanks for contributing that reference, but, does it answer the question? If so, can you identify the part of the quote that does so, presenting a summary of the actual answer?
                      – G-Man
                      Feb 23 '15 at 18:36




                      Thanks for contributing that reference, but, does it answer the question? If so, can you identify the part of the quote that does so, presenting a summary of the actual answer?
                      – G-Man
                      Feb 23 '15 at 18:36











                      3














                      Had the same problem: could not highlight using the mouse so could not copy and paste from VIM in a terminal session to Windows document and browser:
                      Did the following and it now works:



                      : set clipboard=unnamedplus
                      : set mouse=r





                      share|improve this answer




























                        3














                        Had the same problem: could not highlight using the mouse so could not copy and paste from VIM in a terminal session to Windows document and browser:
                        Did the following and it now works:



                        : set clipboard=unnamedplus
                        : set mouse=r





                        share|improve this answer


























                          3












                          3








                          3






                          Had the same problem: could not highlight using the mouse so could not copy and paste from VIM in a terminal session to Windows document and browser:
                          Did the following and it now works:



                          : set clipboard=unnamedplus
                          : set mouse=r





                          share|improve this answer














                          Had the same problem: could not highlight using the mouse so could not copy and paste from VIM in a terminal session to Windows document and browser:
                          Did the following and it now works:



                          : set clipboard=unnamedplus
                          : set mouse=r






                          share|improve this answer














                          share|improve this answer



                          share|improve this answer








                          edited Sep 27 '17 at 18:01









                          Scott

                          6,83152750




                          6,83152750










                          answered Sep 27 '17 at 17:59









                          Bob

                          311




                          311























                              0














                              As for the second part of your question where in you specified that when pasting from other applications to vim it adds tabs/spaces. Try adding this to your ~/.vimrc
                              set paste
                              or in vim before pasting in normal mode
                              press "shift" + ":" and type "set paste"






                              share|improve this answer




























                                0














                                As for the second part of your question where in you specified that when pasting from other applications to vim it adds tabs/spaces. Try adding this to your ~/.vimrc
                                set paste
                                or in vim before pasting in normal mode
                                press "shift" + ":" and type "set paste"






                                share|improve this answer


























                                  0












                                  0








                                  0






                                  As for the second part of your question where in you specified that when pasting from other applications to vim it adds tabs/spaces. Try adding this to your ~/.vimrc
                                  set paste
                                  or in vim before pasting in normal mode
                                  press "shift" + ":" and type "set paste"






                                  share|improve this answer














                                  As for the second part of your question where in you specified that when pasting from other applications to vim it adds tabs/spaces. Try adding this to your ~/.vimrc
                                  set paste
                                  or in vim before pasting in normal mode
                                  press "shift" + ":" and type "set paste"







                                  share|improve this answer














                                  share|improve this answer



                                  share|improve this answer








                                  edited Jul 11 '14 at 18:42

























                                  answered Jul 11 '14 at 16:43









                                  abhixec

                                  40137




                                  40137























                                      0














                                      Use these two lines below in your ~./vimrc to use all nice features of a gui-mouse and paste into system clipboard using y (yank key) if you don't really need any additional clipboard buffers:



                                      set mouse=a
                                      set clipboard=unnamed





                                      share|improve this answer


























                                        0














                                        Use these two lines below in your ~./vimrc to use all nice features of a gui-mouse and paste into system clipboard using y (yank key) if you don't really need any additional clipboard buffers:



                                        set mouse=a
                                        set clipboard=unnamed





                                        share|improve this answer
























                                          0












                                          0








                                          0






                                          Use these two lines below in your ~./vimrc to use all nice features of a gui-mouse and paste into system clipboard using y (yank key) if you don't really need any additional clipboard buffers:



                                          set mouse=a
                                          set clipboard=unnamed





                                          share|improve this answer












                                          Use these two lines below in your ~./vimrc to use all nice features of a gui-mouse and paste into system clipboard using y (yank key) if you don't really need any additional clipboard buffers:



                                          set mouse=a
                                          set clipboard=unnamed






                                          share|improve this answer












                                          share|improve this answer



                                          share|improve this answer










                                          answered Jun 27 at 17:24









                                          CeDeROM

                                          493




                                          493























                                              0














                                              You can use y to copy(yank) and p to paste even with :set mouse=a set in ~/.vimrc. Use v+arrow keys to highlight the text. To copy an entire line quickly, use shift+y.






                                              share|improve this answer


























                                                0














                                                You can use y to copy(yank) and p to paste even with :set mouse=a set in ~/.vimrc. Use v+arrow keys to highlight the text. To copy an entire line quickly, use shift+y.






                                                share|improve this answer
























                                                  0












                                                  0








                                                  0






                                                  You can use y to copy(yank) and p to paste even with :set mouse=a set in ~/.vimrc. Use v+arrow keys to highlight the text. To copy an entire line quickly, use shift+y.






                                                  share|improve this answer












                                                  You can use y to copy(yank) and p to paste even with :set mouse=a set in ~/.vimrc. Use v+arrow keys to highlight the text. To copy an entire line quickly, use shift+y.







                                                  share|improve this answer












                                                  share|improve this answer



                                                  share|improve this answer










                                                  answered Aug 23 at 1:01









                                                  Myna Martin

                                                  1




                                                  1























                                                      0














                                                      @bgrif Changing mouse=a to mouse=v in ~/.vimrc worked for me.






                                                      share|improve this answer


























                                                        0














                                                        @bgrif Changing mouse=a to mouse=v in ~/.vimrc worked for me.






                                                        share|improve this answer
























                                                          0












                                                          0








                                                          0






                                                          @bgrif Changing mouse=a to mouse=v in ~/.vimrc worked for me.






                                                          share|improve this answer












                                                          @bgrif Changing mouse=a to mouse=v in ~/.vimrc worked for me.







                                                          share|improve this answer












                                                          share|improve this answer



                                                          share|improve this answer










                                                          answered 12 mins ago









                                                          vineeshvs

                                                          32




                                                          32






























                                                              draft saved

                                                              draft discarded




















































                                                              Thanks for contributing an answer to Unix & Linux Stack Exchange!


                                                              • Please be sure to answer the question. Provide details and share your research!

                                                              But avoid



                                                              • Asking for help, clarification, or responding to other answers.

                                                              • Making statements based on opinion; back them up with references or personal experience.


                                                              To learn more, see our tips on writing great answers.





                                                              Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                                                              Please pay close attention to the following guidance:


                                                              • Please be sure to answer the question. Provide details and share your research!

                                                              But avoid



                                                              • Asking for help, clarification, or responding to other answers.

                                                              • Making statements based on opinion; back them up with references or personal experience.


                                                              To learn more, see our tips on writing great answers.




                                                              draft saved


                                                              draft discarded














                                                              StackExchange.ready(
                                                              function () {
                                                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f139578%2fcopy-paste-for-vim-is-not-working-when-mouse-set-mouse-a-is-on%23new-answer', 'question_page');
                                                              }
                                                              );

                                                              Post as a guest















                                                              Required, but never shown





















































                                                              Required, but never shown














                                                              Required, but never shown












                                                              Required, but never shown







                                                              Required, but never shown

































                                                              Required, but never shown














                                                              Required, but never shown












                                                              Required, but never shown







                                                              Required, but never shown







                                                              Popular posts from this blog

                                                              サソリ

                                                              広島県道265号伴広島線

                                                              Setup Asymptote in Texstudio