Credits to Ingo Karkat, you just need to set foldcolumn for using the mouse to open and close folds. From :he fold-foldcolumn:
'foldcolumn' is a number, which sets the width for a column on the side of the
window to indicate folds. When it is zero, there is no foldcolumn. A normal
You don't need anything that complex
You can even define your command to be
:command! ToggleMouse exe 'set mouse='.(empty(&mouse)?'a':'')
" Here I use `:exe` because I didn't want to use `:if` in a command definition which would look like:
:command! ToggleMouse if empty(&mouse) | set mouse=a | else | set ...
I'm not aware of any Vim feature or even plugin that does that; in fact, up until recently it would be rather hard to display it like that, but with Vim 8.2's popup windows it wouldn't be too hard; you just have to loop over all visible windows and create a new popup window displaying the window number.
The closest thing you can get, which may actually be ...
Note: I have not tested this with gvim, only with normal vim
This piece of code allows me to scroll instead of selecting text when I drag using my mouse.
"mark b is the current cursor position
"mark a is the previous cursor position
Your examples work fine for me on Vim 7.4.1689 and Neovim.
The following didn't work at first:
Then I read the following in :h 'mouse'
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).
I use tmux a lot, so $TERM is set ...
I've released a vim plugin that pretty closely matches this behavior.
Instead of scrolling by exactly N lines, this maps <C-u>, <C-d> (half window) and <C-j>, <C-k> (quarter window) to scroll as close to N lines as possible due to the wrapped lines, then moves the cursor back to the original relative line position in the Vim window. ...
I want to take a shot at answering my first question on this forum. If I understand your question right, you are referring to concepts of "clipboard" and "primary". If not - sorry, I am wrong.
Note: After the comment by @jjaderberg below, I decided to clarify why I assumed that xterm_clipboard in vim is Primary. To be sure I looked up Clipboard definition ...
I understand that you are set up with the features necessary for copy and pasting with the system clipboard, but I want to be a tad redundant as those registers can be a tad challenging to set up. It's all about the features that are enabled with your install of Vim. In OS X and Linux, the clipboard feature needs to be enabled, and Linux usually also ...
The trick is to enable the mouse with :set mouse=a.
By default, Vim doesn't handle the mouse; the terminal emulator does, and from the terminal emulator's perspective "it's all text", it can't distinguish between your "number" or gutter.
gVim "emulates" a terminal emulator in many ways, and acts in the same way.
Then enabling the mouse, it's Vim that does ...
A good general rule when using Vim is to not use the mouse—Vim is designed from the ground up to be used with keyboard commands. In order to copy text, you can use the y command to yank a particular selection or chunk of text. Like all other Vim commands, you can think of y as a verb and give it modifiers, like y2j to yank the current line and the next ...
I figured out a way to do that with Hammerspoon
and clever usage of mapping.
The first part is configuring Shift + ScrollUp and
Shift + ScrollDown to scroll horizontally. In
order to do that, you have put the following code snippet in your .vimrc:
nnoremap <S-ScrollWheelUp> <ScrollWheelLeft>
nnoremap <S-2-ScrollWheelUp> <2-...
According to :help scroll-mouse-wheel the answer is no if you are using the Win32 GUI.
On the other hand, using X11 GUI or console vim with mouse support, the wheel sends key presses that you can remap.
So, you could get the behaviour you describe by
:nmap <ScrollWheelUp> h
:nmap <ScrollWheelDown> l
Note that I'm using nmap for mapping in ...
It works for me. I have ForwardX11 yes in my ~/.ssh/config file, which should have the same effect as running ssh with -X, and I started vim on the remote machine as vim -N -u NONE -i NONE to make sure my configuration wasn't affecting anything, then executed :set mouse=a. I entered some text into vim, then selected some of it with the mouse, then pasted it ...
You can use fn to bypass Mouse Reporting for programs like vim. (i.e. do fn+left-mouse button to clear the selection.)
(If you are not using a Mac and you are having a similar issue, you can use ctrl-z to suspend vim. Once you are done doing whatever, execute the ...
I guess mouse clicks don't update the jump list. (:help jump-motions seems to confirm this is the case.)
Try this, for the async solution:
autocmd FocusLost * set mouse=
autocmd FocusGained * call timer_start(200, 'ReenableMouse')
Note that this ...
This appears to be a genuine bug in vim, which was fixed by the patch 8.2.2428. Both the Arch and Debian packages have now been updated to include this patch, so pacman -Syu or apt-get upgrade (respectively) will fix the problem.
The escape sequence terminal emulators send when they gain focus is \<Esc>[I. When the ttymouse vim option has been cleared, ...
OK. So this does not use the mouse.
But that's the whole point of vim (not needing to use the mouse).
You can use the vim normal copy command (which will not select the line numbers). To get it into the system clipboard just use the buffer *
"*<Normal Yank Command>
You have now yanked the text you want into the system clipboard and it can be pasted ...
From Vim Tips Wiki:
When you are using another application and select go back to Vim by
clicking inside Vim's text area, it not only switches application
focus to Vim, but it also moves the cursor to that location. If you
don't want the cursor to move, put the following in your vimrc:
au FocusLost * let g:...
Here's a heavy solution:
nnoremap <LeftMouse> ma<LeftMouse>`a
It will let the click go through (thus changing the focus), but make sure the cursor always goes back to where it was before the click was initiated.