News for hackers. Stuff that matters.
Re:I've been writing TILs for 5 years by noisy_boy on Sunday April 19, 2020 @06:21AM (#22914781)
I tried this in vim but didn't work. TIL "set mouse=a" enables moving cursor by mouse click in vim.
Re:I've been writing TILs for 5 years by wabain on Sunday April 19, 2020 @09:20AM (#22915697)
To add what was an essential follow-up for me when I discovered this: Once you’ve enabled mouse=a, use the alt key to select text in vim for your system clipboard, rather than vim’s visual mode.
Re:I've been writing TILs for 5 years by wazoox on Friday April 24, 2020 @12:46PM (#22970118)
I don't understand this part. How do you select using Alt?

Typically with mouse enabled, you can select text with the mouse, but this doesn't go to the X clipboard. While with mouse disabled, text selected with the mouse goes to the X clipboard.

Re:I've been writing TILs for 5 years by wabain on Sunday April 26, 2020 @04:07PM (#22989776)
What I had meant was that when using vim configured with mouse=a, selecting with the mouse while holding down the Alt key would disable the terminal emulator's mouse reporting and allow the selection to be copied to the system clipboard.

But actually this depends entirely on the terminal emulator. The Alt/Option key works with the default preferences for iTerm2 on MacOS, but with GNOME terminal I reproduced the same behavior using Shift instead.

Re:I've been writing TILs for 5 years by noisy_boy on Monday April 20, 2020 @04:27AM (#22922145)
Found another interesting problem. mouse=a works great on my Ubuntu laptop; however, it has no impact when connected to Linux servers via Putty - when I click somewhere in the vim window, the cursor doesn't jump to that spot.
Re:I've been writing TILs for 5 years by wabain on Sunday April 26, 2020 @04:10PM (#22989804)
You might need something beyond mouse=a to get Putty to report the mouse through to vim—maybe this option? https://superuser.com/questions/513014/moving-cursor-in-putt...