In both vim or gvim 7.3 I am having a problem when selecting lines from the buffer with my mouse when using vertical splits. If I select lines from one of the vertically split buffers I also end up selecting the lines from the other buffer.
In general I use the keyboard to perform selections but there are certain cases where I prefer the mouse (selecting from a VNC window to cut and paste into a windows ENV, etc.).
I have set mouse= in my .vimrc file so my mouse doesn't move the cursor when I click in a gvim window.
Is there a setting to prevent selections across buffers?
You've disabled the mouse in vim with set mouse= so the selection is being done by your terminal emulator and not by vim. The terminal emulator does not know about buffers or splits in vim and just selects the entire line across the screen being shown.
If you wish to only select from one buffer you will need to enable the mouse in vim but I'm not sure what else you will need to do.
Related
I'm relatively new to vim and I'm facing the issue on VMware(bionic).
I cannot switch to editor when splitting the view (:vspor :sp).
The cursors is placed in newly opened file, but the first file (from which :sp is called) is like frozen and also cannot be resized (dashed line between is not dragable). I'm using .vimrc. Any help would be appreciated.
Mouse user:
Add set mouse=a in your .vimrc. You will be able to switch focus with mouse click, and resize windows by dragging the dash line. See Focus follow mouse in vim.
Keyboard user:
You can type Ctrl-W two times to switch to the next window. Learn more in http://vimdoc.sourceforge.net/htmldoc/windows.html#window-move-cursor.
The way to resize window is less convenient as using the mouse. Ctrl-W > can increase current window width, and Ctrl-W + can increase current window height. See more in http://vimdoc.sourceforge.net/htmldoc/windows.html#window-resize
After using MacVim for a long time, I've switched to using VIM in Iterm2 directly. Although, I don't use the mouse often, when I do I miss MacVim's mouse cursor switching to Arrow when in normal mode, and to IBar when in insert mode and to Drag when moving the mouse over a split (to drag it).
Is it possible to configure the mouse cursor to react to the content that VIM presents and if so, how?
In using vim on Linux at the terminal I expect mouse selection to behave as (e.g.):
Start insert mode
Select some other text with left mouse button
Click middle button
Selected text gets pasted in where I was inserting
I think of this as "normal terminal mouse behaviour", and expect it to work like that for all programs, not just vim. However, something changed in the past few days and vim now acts differently:
Start insert mode
Select some other text with left mouse button
My insertion point now moves to the start of the selection
My mode is changed from "Insert" to "(insert) SELECT"
Click middle button
Looks like nothing happened, but I think it has actually pasted the selection on top of itself, because if I click again the selected text appears a second time after the selection.
One other symptom: The mouse cursor is now an arrow when pointing at a vim terminal window. Other terminal windows show an I beam, and vim used to do that too.
This is a problem with vim, not terminal because
It behaves the same in Gnome terminal, Konsole, and Terminator
Other programs at terminal behave the "normal" way
I have tried changing settings for :behave, :set selectmode and :set mouse, but this has not helped (maybe I just haven't found the right combo yet?).
This problem is recent (this week), but I have not changed my vim settings relevantly in that time.
Any ideas as to what's going on here?
The command :set mouse=a suggested should enable mouse integration in all modes but this is not what you want. To stop VIM messing with the mouse settings use :set mouse= (with no letters after the equals) to prevent it from changing the mouse in any mode.
I have the problem with splitting windows. If I open a file with :split the size of the new window includes only one line. I don't know why.
Is there a way to resize the window in vim as I need it?
jump into the window you want to resize (ctrl-w ctrl-w OR ctrl-w direction-arrow), then hit ctrl-w followed by [number followed by] + (or - if you want to decrease the size)
the number is optional and indicates how many "units" you want to enlarge the window by, defaults to 1 if not specified
Or just hit ^W= to make all windows roughly same-size.
Also, :se mouse+=a should enable you to just drag the dividers with the mouse, even on terminal emulators across a GNU screen session.
Im getting this sometimes when i scroll up the files im editing.
http://postimage.org/image/ajhrqm3ox/
As you can see the part above is not the file im editing, but the content of the terminal before running vim..:).
If you are attempting to scroll with the mouse wheel and the terminal is capturing it and scrolling back in its own buffer, enable mouse mode, enable the mouse:
set mouse=a
See :help mouse for an explanation of the mouse modes possible, and note that this will also enable positioning Vim's cursor with the mouse, making visual selections, and other expected mouse behaviors.