Live data from Hacker News

Show HN: Hardtime.nvim – break bad habits and master Vim motions

github.com

81–89 of 89 posts

Re: Show HN: Hardtime.nvim – break bad habits and master Vim motions

#81
post #71
post #70

Earlier quoted context omitted.

15j is easier than 4879gg. It’s a little bit quicker on big files—not a huge difference.

The information is also more relevant. How many lines a function or block has might make a difference, but the absolute file position is, more often than not, irrelevant.

Funny, I was thinking exactly the opposite. Stack traces, logs, test failures, warning, etc will always reference an absolute number. If you want to tell a coworker where to find a section of code, you use the absolute number.

Relative numbers are useful to save a few keystrokes. But in every other context, absolute numbers are what's relevant.

Re: Show HN: Hardtime.nvim – break bad habits and master Vim motions

#82

I’ve been using vim for 10+ years. However I honestly don’t see the downside of repeating h or j to move up/down (with the key repeat delay adjusted to a small value). It’s more intuitive than using say 15j, which involves recognizing some number in the screen and then look at the keyboard to type because the upper number row cannot be easily touch typed

Exactly. h or j repeated is widely dismissed as inefficient. But that ignores two important things:

First, you can hold down h or j and use visual clues to know when to stop. It's one keypress on the homerow, no reason to even glance at the keyboard. Eyes on the monitor = better focus. One keystroke.

Second, thinking in line numbers is one more piece of context to load up into your brain (find the line number), then act on (type out incantation), then context switch back to whatever you were doing before. By contrast, holding j until you're in the spot takes up almost zero working memory. You can think while it's happening! It's a small and subtle difference but that 200ms pause in thought process really does add up - not in wall time (jumping by line is probably "faster") but in contiguous focus time. Having to invoke any multi-part command is a distraction from your core work. Again, one lazy keystroke with immediate visual feedback > some complex combination of keystrokes.

An one small pitch for treesitter - rather than use j/k to navigate by line, set up some keybindings to jump by treesitter element (functions, methods, etc). I've got mine set to +/-. This lets you move in the same "dumb scrolling" way but by jumping to semantically-relevant parts automatically rather than line by line.

Re: Show HN: Hardtime.nvim – break bad habits and master Vim motions

#83
post #73

The way I like to explain vim to people new to it is; start from "the inside out" on a QWERTY keyboard and assume most people are right-handed. By that, I mean the hjkl navigation keys are the first kind of navigation people want to do and are conveniently easily typed with the right hand in a traditional "home-row" position. Next, very common editing commands are associated with home-row keys associated with the lef…

Interestingly enough, many games on PC standardized the WASD keys for moving, which might be seen as "left-handed". However when touch-typing, there isn't really a difference between left and right hands.

> Interestingly enough, many games on PC standardized the WASD keys for moving, which might be seen as "left-handed".

To me, WASD for avatar movement makes sense even in the context of "right-handed bias" in that if a gamer is using a mouse, odds are they are right-handed and the mouse is positioned to the right of their keyboard.

And if a gamer is left handed, it's a minor inconvenience to shift the chair position such that their right hand manipulates WASD and their dominant left hand uses a mouse on the left side of their keyboard.

Of course, many modern games allow custom key bindings, so a left-handed gamer could use IJKL instead of WASD if they so chose.

Re: Show HN: Hardtime.nvim – break bad habits and master Vim motions

#84

I always find it funny when people say to not repeat h-l, w-W keys for horizontal movement. No way I am starting to count how many characters there are in front of my cursor just to have the satisfaction of typing "31-l"... I am totally going to spam some 2w 3w llll until I reach the desired position.

I think it's more about getting used to f-F,t-T,A,I, and which can be quicker especially with code. You can also add easymotion or similar plugins for the powered version of those.

Well over 20 years of vim use, and I had to look up what f/F and t/T do. I'm pretty sure I've seen them before years ago, but I never use them. It's always interesting what others find invaluable that I try out and think "meh" afterward.

Re: Show HN: Hardtime.nvim – break bad habits and master Vim motions

#85

I’ve been using vim for 10+ years. However I honestly don’t see the downside of repeating h or j to move up/down (with the key repeat delay adjusted to a small value). It’s more intuitive than using say 15j, which involves recognizing some number in the screen and then look at the keyboard to type because the upper number row cannot be easily touch typed

C-d, C-u, {}, () and searches are better anyway. You should also be using g, so say you are defining a function and need to check where it's going to be used on main. For optimal usage you should always have main marked as something, so you would exit insert mode, gm, look around in main, gi to go back to where you were typing last

Re: Show HN: Hardtime.nvim – break bad habits and master Vim motions

#87
post #74

Earlier quoted context omitted.

I'm making my (probably) 4th attempt in migrating from regular Vim to NeoVim, and while it's better now, the learning curve is still steep as hell. Going the kickstart.nvim route this time and boy, half of the stuff there is pure magic. Honestly feels like reading Nix incantations. Dynamic nature of Lua makes it even harder. Thankfully ChatGPT is pretty good in generating configs.

What's the difficulty to switch from Vim to Neovim? I switched few years ago, and the switch was instant. Afaik Neovim is fully backward compatible, unless maybe for some obscure features.

Not the parent, but I also tried to switch around two or three years ago and was very frustrated. The draw was the 'built-in LSP' with all these new features, along with treesitter.

'Built-in LSP' turned out to mean installing and configuring three pretty involved lua plugins at the time iirc. The experience really highlighted for me how un-seamless lua was in the project compared to vimscript. I found it to be a nightmare to configure and get used to. I came away wondering how it could possibly be such a pain, and baffled as to why it was claimed to be 'built-in' when getting ALE to work on vanilla vim took way less time, and felt way more in line with the rest of the program. Ironically it actually gave me an appreciation for vimscript that wasn't there before.

Eventually issues continued to kind of build up for me until I decided to just cut it. Everywhere I encountered lua felt crufty and difficult to work with, and those integrations made the concise, tight vim I'd gotten used to feel really nebulous and unweildy. I never quite got the treesitter syntax highlight to work correctly, and even when it did work having the highlighting dynamically change while typing frustrated me. I ended up slowly switching back to my old vim-compatible plugins one by one, until eventually I just went back to vim, since a lot of the neovim features that diverged from the original design philosophy bugged me and since I'd developed a strong aversion to anything involving lua in the program I wasn't getting anything out of using neovim.

Re: Show HN: Hardtime.nvim – break bad habits and master Vim motions

#88

I always find it funny when people say to not repeat h-l, w-W keys for horizontal movement. No way I am starting to count how many characters there are in front of my cursor just to have the satisfaction of typing "31-l"... I am totally going to spam some 2w 3w llll until I reach the desired position.

Agree. vim-sneak is the answer to this, you can reach anywhere with maximum 3 key presses. It's very intuitive and easy to pick up. If I had to pick only one Vim plugin it would be sneak. https://github.com/justinmk/vim-sneak

Adding flash.nvim to the list here, super convenient search labels.

https://github.com/folke/flash.nvim

Re: Show HN: Hardtime.nvim – break bad habits and master Vim motions

#89
post #74

Earlier quoted context omitted.

What's the difficulty to switch from Vim to Neovim? I switched few years ago, and the switch was instant. Afaik Neovim is fully backward compatible, unless maybe for some obscure features.

Not the parent, but I also tried to switch around two or three years ago and was very frustrated. The draw was the 'built-in LSP' with all these new features, along with treesitter. 'Built-in LSP' turned out to mean installing and configuring three pretty involved lua plugins at the time iirc. The experience really highlighted for me how un-seamless lua was in the project compared to vimscript. I found it to be a nig…

It took me a dozen hours over few days, but I think I've finally made it. Aliased vim to nvim to force myself to use it.

However, this took way too long, and I've already deleted everything related to LSP and IDE-like features from kickstart, since I have IntelliJ for this, and I want to start fast. This might be totally missing the point of Neovim, so maybe I'm stubborn.

To be honest - mixed feelings. Everything works great after some effort, Telescope is cool, plugin ecosystem is amazing and active. But it is the small papercuts in the process that ruined the fun for me. It doesn't support 16-color terminals, so needs custom themes always. There is a Selenized theme available, but it fails to load as the main theme, I need to load another theme first and then reload that one, no idea why. Some of the colors don't load anyway (probably due to plugin load order), so I had to add an ugly `vim.defer_fn` to re-call highlights 1000ms after startup. What more, Telescope uses fzf for files but not for live grep, contrary how it works for Vim.

Also, there is a huge culture of not providing any keybinds by default, and instead configuring them manually, probably due to sheer amount of keyboard real estate already required by Vim, not to mention any of the LSP features or possible plugin conflicts. So many great plugins are useless with stock config (like blame.nvim) and really require forward thinking, how to put them under your keyboard.

I'll spend a few weeks there and see. Hopefully it gets better and better.

Post reply on HN