You are not logged in.

#1 2007-06-28 02:45:22

Snork
Member
Registered: 2007-06-28
Posts: 11

vim 7.1 problem with highlight/cut n paste figured out

I just spent some time struggling with a frustrating vim 7.1 problem.  Using the mouse to cut and paste within a vim session stopped working when upgraded from 7.0.  I don't use gvim, btw, nor do I have it loaded.

After downgrading to 7.0 and doing some detective work with ":set" I found that :set mouse= or :set mouse=v will give me the behavior I wanted.  For 7.1 the setting defaults to mouse=a.  With that setting I was being put in "(insert) visual" mode where the mouse was basically useless.  Since I also use vim for command line editing it really pissed me off!

Here is my .vimrc entry:

" Ref: http://vimdoc.sourceforge.net/htmldoc/options.html#'mouse'
" Ref: http://vimdoc.sourceforge.net/htmldoc/t … ouse-using
set mouse=v

I thought I'd share this in case anyone else had the same problem.

I saw a post in the forum from quite a while back that seemed to indicate having gvim installed may have something to do with maintaining the behaviour I wanted.  As I said, tho, I don't use it nor want it. 

Hope this helps someone!  And any comments by those more in the know about Arch and vim compilation would be helpful and educational to me.  I'm not new to Linux (a Slacker), but am fairly new to Arch.

Snork


I don't want to be the Go-To Guy.  I want to be the Go-Past Guy.  He's
        the guy you rush past on your way to bother the first guy.
                Me, 08/05

Offline

#2 2007-06-28 09:28:07

Pierluigi
Member
Registered: 2004-04-10
Posts: 90
Website

Re: vim 7.1 problem with highlight/cut n paste figured out

Snork wrote:

Hope this helps someone!

Oh yes big_smile

thank you, you saved my day

Offline

#3 2007-06-28 09:44:19

berbae
Member
From: France
Registered: 2007-02-12
Posts: 1,302

Re: vim 7.1 problem with highlight/cut n paste figured out

I encountered the same problem with copy/paste from the clipboard and the vim upgrade to 7.1
After searching in the vim tips pages, I found http://www.vim.org/tips/tip.php?tip_id=1065 which gives me the answer.
Now I have in the /etc/vimrc file :

" In many terminal emulators the mouse works just fine, thus enable it.
"set mouse=a

set nopaste
if has("gui_running")
  "mouse visual block (ala MS Word)
  nmap <A-LeftMouse> ms<LeftMouse><C-v>`so
  imap <A-LeftMouse> <Esc><C-v>`^ms<Esc>gi<LeftMouse><C-o><C-v>`so
  vmap <A-LeftDrag>  <LeftDrag>
  vmap <A-LeftMouse> <C-v><LeftMouse>msgv`s
  vmap <S-LeftMouse> v<LeftMouse>msgv`s
  set mouse=ra
else
  "paste toggle
  nmap <F7>      :set paste! paste?<CR>
  imap <F7> <C-o>:set paste!<CR>
  vmap <F7> <Esc>:set paste!<CR>gv
  "xterm mouse with middleclick paste
  nnoremap <MiddleMouse> i<MiddleMouse>
  vnoremap <MiddleMouse> s<MiddleMouse>
  set pastetoggle=<F7> mouse=rnv
endif

This works for me.

Last edited by berbae (2007-06-28 09:45:09)

Offline

#4 2007-06-28 17:07:50

Jansson
Member
From: Sweden
Registered: 2006-09-10
Posts: 106

Re: vim 7.1 problem with highlight/cut n paste figured out

Thanks Snork:) Have to say my temporary solution realy starded at my nerves...:P
cat >> tempfile
paste everything and exit cat
back to vim and :read tempfile

Offline

#5 2007-06-28 22:18:39

Snork
Member
Registered: 2007-06-28
Posts: 11

Re: vim 7.1 problem with highlight/cut n paste figured out

You guys are welcome!  I figured if I was cussin' up a blue streak about this, many others also were.  Just sharin' the wealth.


I don't want to be the Go-To Guy.  I want to be the Go-Past Guy.  He's
        the guy you rush past on your way to bother the first guy.
                Me, 08/05

Offline

#6 2007-06-29 13:19:50

Jacek Poplawski
Member
From: Poland
Registered: 2006-01-10
Posts: 736
Website

Re: vim 7.1 problem with highlight/cut n paste figured out

I just found the same after few days of making tricks with the mouse. Isn't a bug? Should it work this way in default mode?

Offline

#7 2007-06-29 14:06:43

LiFo2
Member
From: France
Registered: 2007-03-29
Posts: 25
Website

Re: vim 7.1 problem with highlight/cut n paste figured out

I agree this is not a bug, but this is a very bad default configuration !
Thanks for the info big_smile I was really annoyed too

Last edited by LiFo2 (2007-06-29 14:07:14)

Offline

#8 2007-07-01 18:01:29

tranxene
Member
From: France
Registered: 2005-02-26
Posts: 13

Re: vim 7.1 problem with highlight/cut n paste figured out

Yes, thank you for this invaluable piece of advice! You also saved my day roll

Offline

#9 2007-07-01 18:38:16

cactus
Taco Eater
From: t͈̫̹ͨa͖͕͎̱͈ͨ͆ć̥̖̝o̫̫̼s͈̭̱̞͍̃!̰
Registered: 2004-05-25
Posts: 4,622
Website

Re: vim 7.1 problem with highlight/cut n paste figured out

fyi. holding shift down and then clicking the mouse button you want works too.


"Be conservative in what you send; be liberal in what you accept." -- Postel's Law
"tacos" -- Cactus' Law
"t̥͍͎̪̪͗a̴̻̩͈͚ͨc̠o̩̙͈ͫͅs͙͎̙͊ ͔͇̫̜t͎̳̀a̜̞̗ͩc̗͍͚o̲̯̿s̖̣̤̙͌ ̖̜̈ț̰̫͓ạ̪͖̳c̲͎͕̰̯̃̈o͉ͅs̪ͪ ̜̻̖̜͕" -- -̖͚̫̙̓-̺̠͇ͤ̃ ̜̪̜ͯZ͔̗̭̞ͪA̝͈̙͖̩L͉̠̺͓G̙̞̦͖O̳̗͍

Offline

#10 2007-07-04 22:32:31

pheeror
Member
Registered: 2007-02-10
Posts: 3

Re: vim 7.1 problem with highlight/cut n paste figured out

thanks

Offline

#11 2008-11-10 22:38:23

john_schaf
Member
From: France
Registered: 2007-02-24
Posts: 104

Re: vim 7.1 problem with highlight/cut n paste figured out

Hello,

Seems that problem is back again.
I also changed my virc to 'set mouse = v' to be able to use the copy/paste stuff.
So thanks for the tip. They also told that on the bug-reports :
http://bugs.archlinux.org/task/12051
and
http://bugs.archlinux.org/task/7534

But does anybody knows why is the default to 'set mouse = a' ?

Offline

#12 2009-05-22 15:09:55

nblock
Member
From: Austria
Registered: 2008-08-06
Posts: 123
Website

Re: vim 7.1 problem with highlight/cut n paste figured out

thank you very much for sharing this tip!

Offline

#13 2009-08-18 06:18:12

stickyboy
Member
From: София
Registered: 2009-08-18
Posts: 7
Website

Re: vim 7.1 problem with highlight/cut n paste figured out

Saved the day.  I was so thankful I registered just to say, "Thanks!"

Offline

#14 2009-08-18 17:40:55

Gen2ly
Member
From: Sevierville, TN
Registered: 2009-03-06
Posts: 1,529
Website

Re: vim 7.1 problem with highlight/cut n paste figured out

From my experience it all depends on what terminal I use.  With konsole, no problems pasting in 'mouse=ni' mode, in stjerm, pasting isn't allowed.  I've mapped to F7 and F8:

map <F7> <Esc>:set mouse=<CR>
map <F8> <Esc>:set mouse=ni<CR>     " Mouse navigation

The first allows me to paste from the x clipboard in insert mode.  Or if xclip is installed I use F9 and F10 (pasting only works when not in insert mode):

vmap <F9> :!xclip -f -sel clip<CR>          " Copy to X clipboard
map <F10> mz:-1r !xclip -o -sel clip<CR>`z  " Paste X clipboard

Setting Up a Scripting Environment | Proud donor to wikipedia - link

Offline

Board footer

Powered by FluxBB