Hacker News new | ask | show | jobs
by yarky 1347 days ago
I've been using nvim for around 5 years for everything I do on a computer other than web browsing. It feels like I'm missing something here, but why would you ever need a mouse within your terminal? I don't recall never ever needing it :/
8 comments

For me (Vim user for ~10 years, Kakoune user for ~3 years (iirc), and now Helix user for ~1yr), mouse just feels very natural to skimming. Scroll, scroll, jump, scroll, scroll, scroll, jump. etc

Something about jumping down pages via shortcuts just feels so clunky. I lose all visual sense of my position on the page.

I keep wanting an editor plugin to scroll the page down with a single keystroke. Ie give me the visual anchoring that a scroll wheel does, but with a single key press.

Either way generally i just tent to use my mouse when i'm lightly browsing. Skimming for some code, working through a thought, etc. Jumping down pages just snaps me outa my thought process a lot of the time, because i have no clue where i am, i gotta relearn my position; where my eyes are at. Likewise jumping half a page is a bit better, but still - that instant blink where the top half of the page is gone, the previous bottom is now the top, and the bottom is now entirely new.. it just feels too.. immediate.

Neovim has Neoscroll to replace jump scrolls with smooth scrolling:

https://github.com/karb94/neoscroll.nvim

There is a Helix issue (and poll, see last comment) requesting the same feature you could vote on:

https://github.com/helix-editor/helix/issues/1671

Not OP, but I've been using vim for 20+ years and I get enormous utility out of the mouse wheel for scrolling - especially with a trackpoint.

I spend an enormous amount of time _reading_ code and I want to move up and down quite a lot, but C-U/C-D move too fast (losing mental context) and C-E/C-Y are too slow and RSI-inducing; the wheel very easily allows you to encode an additional "velocity" dimension that the keyboard simply doesn't have.

When reading code, the mouse also allows you to navigate reasonably effectively using only one hand, leaving the other hand free for sipping coffee and taking notes.

May I suggest two things to make <C-U> and <C-D> more usable?

1. Set 'scroll' to a value you're comfortable with, so that <C-D> and <C-U> move fewer lines.

2. Use a plugin that shows a scrolling animation when you use <C-D>, <C-U>, <C-F> or <C-B>. I use vim-smoothie (https://github.com/psliwka/vim-smoothie).

Have you tried having N lines of context with C-D and C-U? I also found that (half-)page jumps make me lose context, but having some lines on the top or bottom help me keep it.
> leaving the other hand free for sipping coffee and taking notes.

That explains why my coffee ends up cold and abandoned most of the time!

It's not about necessity, it's about convenience. It could be argued that you don't need a mouse to navigate a web page either (there are VIM plugins for web browsers), but a mouse is much more user friendly and easier to use. Sure, you can practice for days with VIM and get really fast at selecting pieces of code in the screen and jumping around with just a few keystrokes... or you can use a mouse.

I like VIM, it is my favourite editor, but I can understand why some people just don't see the appeal. At least for me, the bottlenecks in productivity don't come with how fast I can type code.

I use the mouse all the time in tmux and nvim, especially for resizing splits, scrolling terminal output, selecting text from tmux, and navigating my nvim file browser. tmux actually has a right click menu that is nice to use occasionally.
I got stuck on a job in Dubai (Government client - they also had us work in trailers on-site - no remote access allowed) with a Remote Desktop jump host where the mouse didn't have any pass-through to my terminal session - which mean I had to work for 8 hours a day without any ability to select/copy/paste with a mouse. I had tmux-installed on the remote hosts and for the next three months, select/cut/copy/paste/resize panes/etc... were done without a mouse. Seven years later, I've never once used a mouse with tmux since then. https://github.com/schasse/tmux-jump is the equivalent plugin that lets you jump anywhere you want on the screen.
Funny, I use tmux all day long because it allows me to navigate out of vim without a mouse. So far I can handle most of my pane resizing needs with prefix + space bar. Otherwise I'll just launch a new window. Maybe I'm just allergic to the mouse.
I tend to have two modes, if I'm actively writing code I rarely use the mouse, but if I'm reading code, I'm mostly using the mouse.
Agreed on resizing. It's not worth it for me to remember those shortcuts when a mouse works faster.
It's really rewarding to set up tmux copy mode in a way that works for you imho.
You don't need a mouse, but it is by far the most ergonomic device we have for navigating to where your eyes are looking at on the screen. This is often useful for selecting text, usually in order to copy/paste or just to highlight.

Try playing some RTS games without a mouse if you want to understand why it's such a useful device in certain situations.

Text objects, especially those in neovim which are powered by treesitter, are much more precise than a mouse in a coding context. I can simply select a function, a block scope, a variable assignment, etc.
I use Emacs and occasionally paredit-mode for Lisp structured editing, so I know what you mean.

However, typing a few keys on the keyboard is still not as fast or as automatic as moving the mouse pointer to where your eyes are looking, IF your hand is already on the mouse (such as when scrolling around the code). Of course, if you have to move your hand from the keyboard to the mouse (such as when actively editing), the opposite is usually true.

I have seen vim gurus I absolutely bet can beat your mousing around every single time when it comes to text operations. I'm not saying I can but I am usually not in that big of a hurry when I'm coding, however I am not bad with navigating vi/evil-mode either.
Can the best vim gurus beat an average mouse user? I am certain they can.

Can they beat the best mouse+keyboard gurus? I very much doubt that.

Note again that I'm only talking about navigation - when you're actively editing, you're obviously going to lose too much time moving your hand between mouse and keyboard.

My biggest mouse use is copying text. Copying in vi is not that bad, but when selecting with the mouse, you don’t have to jump between copy and paste locations, which cuts the cursor navigation by more than half. Sort of like having dual cursors… which is an interesting idea, actually.
Dual cursors is a really good idea. Like, really good.
Yeah I forgot this is my workaround whenever I use vim through wsl2 to avoid handling the never ending display issues.
I use a mouse regularly for copying and pasting in the terminal (including in vim which I'm sure is sacrilege for some). I use vim almost exclusively as an editor, but I guess old habits die hard and I've always found highlighting and copying with the mouse, plus clicking and pasting to be more natural for me.
I also rely on it for copy pasting purposes but if you have :set number enabled you might, the numbers may get in your way. This is where I find myself using :set invnumber that I have mapped to F2 so I can quickly get rid of them.
Cut and paste.

I use tmux to do cut and paste, but should I ever need something out of the terminal/browser into the other, or don’t feel like C-b] ‘ing something, the mouse is great.

> Cut and paste

If your terminal supports it (iterm, kitty, later versions of gnome-terminal and others) this osc52 plugin is really sweet. It even works over ssh.

https://github.com/ojroques/vim-oscyank/