How to select text with mouse scrolling in vim? - vim

Sometimes I want to copy some content on remote host in vim, which will last for more than 1 page. But when clicked by left-click of mouse, and scrolling down, I find I was stuck at the first page.
I know I can use scp or first cat file then select.
But is there a way to enable mouse scrolling to do such a selection in vim?

First, I'd avoid the problem entirely. Start a selection using v before you start scrolling. Then the start of the selection stays put and only the end of the selection moves as you scroll. Then make sure to Shift+click instead of just clicking to set the end position.
But if you really want to be able to scroll with the mouse while holding the button to select text, check your 'mouse' option to make sure it contains "a" or "v". It sounds like you may be using a "modeless selection" (:help gui-mouse-modeless) by mistake. A modeless selection only allows you to select text currently on the screen (it does not scroll), but it also lets you select non-text like line numbers.
Also check that you don't have any mappings defined for the scroll events documented in :help scroll-mouse-wheel. For me this feature "just works" in Windows gvim, so I'm not sure what would cause it to not work for you. But I had to try it out so see, since I almost never do that anyway.

If you are connecting from a system with an X11 server, use ssh -X to enable X11 forwarding. This will allow you to connect to the clipboard of your local machine from the remote vim.
For more information on how to use the X11 clipboard check vim's help for x11-selection.

Related

How to undo/redo user operations?

The situation is:
Open a file
Drag minimap to the middle of this long file
Click somewhere on the line I want to edit
Intend to press Home to go to the head of the line.
Accidentally press Ctrl + Home
Am taken to the head of the file.
QUESTION
Is there a shortcut to return to the line I want to edit?
From the creator of Sublime Text at https://forum.sublimetext.com/t/soft-undo/307
Undo/redo in Sublime Text normally only steps through actions that modify the buffer, skipping over those that simply modify the selection. Changes to the selection are still part of the undo history, and can be stepped through using Ctrl+U/Ctrl+Shift+U (softUndo/softRedo commands). These key bindings aren't displayed in the menu, and I'm wondering if anyone has discovered them on their own.
I rarely use them myself, but did today, so it got me wondering if anyone else does
Change Ctrl in the above to Cmd if using a Mac.

Moving between text and input and textarea areas without using mouse and closing panels

In the majority of programs and sites it is possible to switch between input and textarea fields by means of combinations of the Tab and Shift+Tab keys.
But in Sublime Text Tab — tabulation.
For example, for me open Goto Line Panel and console.
May I move between entry fields and my text also as in the majority of programs becomes by means of keyboard combinations of Tab and Shift+Tab? I know, what the Tab and Shift+Tab keys is needed for tabulation, but any combination of keys can be used to move between input and textarea fields.
Thanks.
TAB will not work but this can be achieved by series of shortcuts:
Opening line selector: Ctrl+G
Opening search: Ctrl+F
Going from search to founded string: Alt+Enter
Shortcuts above are available on Linux version. They may be different on Windows but they are there and can be found in online documentation.
With Sublime Text you can personalize your shortcut!
I found this guide on the official website and this "different but useful" question about it.
So you can create your own sort of switch with comfortable combination. Example:
alt+1 to go to search
alt+2 to go to the text
alt+3 to go to the bottom
...
this is also faster then the "tag way" because it is not cyclic!
i haven't tried it but as mentioned by Draco the commands to move exist so you can just make them more comfortable.

Keyboard shortcut for moving tabs in SublimeText3

Every time I open a new tab in SublimeText I have to take my hands off the keyboard and use the mouse to move the newly opened tab to the desired position among the existing tabs...
Surely there must be a keyboard shortcut for moving SublimeText Tabs left and/or right?
Please say yes...
Not by default unfortunately, but there are two awesome things about Sublime to be aware of:
This plugin https://github.com/SublimeText/MoveTab will let you move tabs with CTRL + Shift + page up/down
You can go to any tab by pressing ctrl+p and typing the name of the tab, so if your tabs are disorganized, you don't have to visually search for them or organize them as long as you know the name of the file you want (or a substring of it if it's unique enough)
It seems as if there are no shortcuts to do this.
You can see all actions and their shortcuts in the command palette (Ctrl+p on Windows). There is no such action as Move this tab to the left.
The good news, however, is that there is a plugin that does exactly this:
https://github.com/SublimeText/MoveTab
You can install it using Package Control.

Focus follow mouse in vim

I am aware that the mousefocus option is only supposed to work in gVim. But I was wondering, if it's possible to have the console Vim switch to different windows in response to mouse clicks, would it be not possible to easily add following mouse movement to it, too?
I'm an xmonad user, I love the focus following the pointer feature, I do a lot of pdf viewing and browsing while writing in Vim, and I'd be so much happier if I didn't have to keep mentally switching back and forth between two different types of focus changing.
If that's completely not possible, I guess opening new Vim windows (as with :split) in new instances of the terminal is no easier to do?
It would not be at all simple to add this. Using the mouse within the terminal works by vim sending control codes to the terminal requesting that mouse actions be sent as part of the input stream. Terminals only report clicks not changes in the pointer position, so vim has no way of knowing where the mouse is.
With major changes it would likely be possible for a vim with X support to get pointer activity directly from the X server, but that would likely be reported by pixel rather than by character so further work would need to be done before it could determine which vim window is currently under the pointer.
set mouse=a
should do the trick but it will probably depend on your terminal emulator. See :help 'mouse'.
This works for Windows 7/Cygwin 32bit mintty/vim 7.3: (I DO NOT use gvim!)
Having installed this: http://ehiti.de/katmouse/, I can scroll the window under my cursor without having to have clicked to select a window, click-selecting of single vim-windows works, too. It does not pull the vim window to the foreground, if another window overlaps it, if that is what you desire. Still it can be scrolled without click-selecting it first.
So:
Check if there exists a software paket for your distribution, that implements your desired mouse behavior on the OS level. When this works for my self-compiled vim in cygwin, it might very well work with console vim on linux, too.
This post here serves as evidence, that it is possible at all, that is the reason this was not made a comment. When I am on linux again I will investigate this further and update this post, but that might take a while.
On set mouse=a: The vim help states you a need a terminal capable of handling mouse inputs, further information can be found here. :help ttymouse might also be helpful, i.e. if you have a xterm-compliant console, but :help term is set to something else.
UPDATE: (Freshly installed Fedora 19 with packages, no self-compiled stuff.)
Fedora 19 + se mouse=a = scrolling in single console vim window with several buffers opened next to each other independently works, too. Window manager used is LXDE.

Elinks browser - howto paste without mouse?

Is it somehow possible to paste a URL in elinks?
I am connected per SSH and cannot use the mouse.
Very old question, I realise, but, comes up as the top result in google when searching for how to copy/paste in elinks - so as I have an answer, here it is, for the benefit of future searchers...
If connected via SSH and you are happy to use the mouse to copy/paste, but, it's not working as expected, you can just hold shift while clicking, e.g. using Putty for SSH, hold shift, left click and drag to select/copy and hold shift and right click to paste.
Source: http://elinks.or.cz/faq.html
I know that this is a few months old, but...
If you are using putty in windows, go to
Terminal > Features when configuring the connection.Then you need to check Disable xterm-style mouse reporting. This will allow you to right-click to paste in elinks (or any other program that blocks the mouse) just like you'd expect it to.

Resources