alt.hn

5/18/2025 at 12:08:52 PM

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

https://github.com/m4xshen/hardtime.nvim

by m4xshen

5/18/2025 at 5:36:32 PM

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.

by BrouteMinou

5/18/2025 at 5:41:43 PM

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

by skydhash

5/19/2025 at 3:12:43 PM

I used to be a big fan of easymotion until I discovered that / is also a motion and that with inline search enabled you can use CTRL-G to cycle through results.

Example: d / foo, first foo will be highlighted, use CTRL-G to select the next one if not correct (repeat if necessary; CTRL-T cycles backwards), ENTER to delete until highlighted section.

Unfortunately CTRL-G is not implemented in IdeaVIM.

by brewmarche

5/18/2025 at 8:37:08 PM

TIL! `f` looks really useful, thanks.

by WhyNotHugo

5/20/2025 at 2:46:26 AM

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.

by nocman

5/18/2025 at 5:50:02 PM

That's the point of this plugin - holding "wwwwwwww..." is a bad habit, because it's very likely there is an objectively better way of getting there. Not necessarily "142l" but "/<piece of word><ENTER>" or "f,;;".

by mystifyingpoi

5/18/2025 at 8:34:41 PM

At first I had to count characters. Over time, it becomes intuitive. In the same way that if someone holds up three fingers you don't count "one, two, three", you immediately perceive that they are holding up three fingers.

For numbers under 10, I usually hit the right amount. For numbers around 30, I might be off by one to five, but move on from then. When I want to remove similar prefixes from multiple non-consecutive lines, I might use things like 31x, go to the next instance (maybe continuing a search with n), and press period.

Honestly though, if you're moving forward 31 characters, there's often an easier approach, like 4w (move forward three Words). Again, at first I had to consciously think about which combination to use. Over time it becomes second nature.

I still use jjjj sometimes. It's imperfect, but at least it's the human that's the limiting factor, and not the software.

by WhyNotHugo

5/19/2025 at 1:32:39 AM

A big help for me is H/M/L - mnemonic high/middle/low.

Moves to the top/bottom/middle of the viewport, and the. I'll jjjj/kkkk away! (or probably just search, mostly).

by ramses0

5/18/2025 at 9:13:19 PM

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

by suprjami

5/18/2025 at 11:31:29 PM

That seems reasonable, I will definitely test that out.

Thank you.

by BrouteMinou

5/18/2025 at 8:23:25 PM

`set relativenumber` to see where you’re jumping

by jackhalford

5/19/2025 at 1:25:28 AM

There was a guide that mentioned "scrabble tile" movement. `fj` is quicker than `fe` because J is way less common than E.

Once you get "near", then zeroing in on your target (eg: `fj`, `Fa` for "adjacent") can be the fastest/most accurate way to get to where you want to go.

by ramses0

5/19/2025 at 12:10:22 AM

I always use f-F, t-T to move within lines, have found that to be the quickest.

by sureglymop

5/18/2025 at 7:52:41 PM

>No way I am starting to count how many characters there are

You don't have to. There are many ways to do a jump without counting. Some of the require plugins like flash.nvim, some do require pressing `;` multiple times

by konart

5/19/2025 at 12:38:01 AM

Relative line numbers can help with j and k.

by Xerox9213

5/18/2025 at 10:26:37 PM

Do you even `%` to navigate to matching ()[]{}? Often useful to jump straight to function end from signature, lispy paran-nests, and so on.

by baobun

5/19/2025 at 2:05:39 AM

llllllllllllllllllllllllllllllllllllllllllllllllllll

by moistoreos

5/18/2025 at 3:07:03 PM

A somewhat more “complete” solution that doesn’t give you hints (thus doesn’t rely on the plugin support for all of vim’s vast functionalities), but conditions your instincts to get better: increase the latency of my whole terminal (c.f. https://unix.stackexchange.com/questions/778196/how-to-add-d...) (also see the comment) by running my terminal session on a ssh session into my own machine through a ProxyCommand of the command delay.

by qazxcvbnm

5/18/2025 at 6:29:11 PM

see I just run emacs to get the same effect

by mercer

5/18/2025 at 3:40:47 PM

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

by blahgeek

5/18/2025 at 5:24:10 PM

I was the exact same until I started using relative line numbers. Then I can just look at a line and see that it's N lines down and jump there immediately. With j or k repeat I'll often over shoot and then have to go back which is kind of annoying.

by kiaofz

5/19/2025 at 1:51:59 AM

How is this easier than jumping straight to the line with absolute numbers?

by codr7

5/19/2025 at 2:09:15 AM

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

by hellcow

5/19/2025 at 4:54:44 AM

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.

by lblume

5/19/2025 at 5:39:44 PM

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.

by perrygeo

5/18/2025 at 9:07:23 PM

Did you get better in maths?

by 3abiton

5/19/2025 at 5:56:24 PM

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.

by perrygeo

5/18/2025 at 4:03:31 PM

Agreed. I wonder if this is somewhat revealing of the mental processes of the creators.

To me, if my cursor is a few lines away from another line, the easiest way for me to get there is by either using h/j a few times, or looking at the absolute line number and doing that with gg.

Relative jumps are only useful to me in macros. Calculating a relative jump myself would 100% pull me out of the flow state where I just want to go up/down a few rows.

I have no proof of this, but I’d guess that the creator of this pattern didn’t feel the same way.

by rybosome

5/18/2025 at 4:20:17 PM

The best tip I got, was to rely more on search instead of other kind of movement. Especially when doing a bunch of editing. Things like easymotion/sneak/avy works best when reading/reviewing.

While I loved multi cursor with sublime. After I moved to Vim, I’ve never needed it. It’s either search~repeat or a macro. Now I’m using emacs, and it’s mostly occur-mode and macro. Grep edit is nice for bigger refactoring.

by skydhash

5/18/2025 at 9:06:32 PM

I really, really like flash/easymotion/etc because I effectively also use the same jump motions all the time in my browser (with vimium/tridactyl). So I have double the muscle memory, and I context-switch less between my browser and neovim, compared to if I was primarily using relative line jumps in neovim

by umbra07

5/18/2025 at 4:22:49 PM

Why’d you switch to emacs, and do you use evil mode?

by christophilus

5/18/2025 at 4:48:47 PM

Vim is a fine editor, but emacs has better tooling. I got in touch with Emacs while learning Common Lisp, and I got hooked by the extensive capabilities and customization available. Vim is fine for extension, but you have to build most of them yourself.

I tried evil mode, but it clashes with other keybinding in some places and I got unhappy with it. There's a philosophy conflict there. With vim, you're expected to have a command for an action and then bind it to a key. Your editing workflow is to compose those keys.

But with emacs, you're more expected to have a view and then a set of actions for that view. The power of emacs comes with how easy it is to integrate all those views together. For a programming workflow, you have the file explorer, the symbol explorer, the search result (single file and all files), the version control, the docs, the compilation|build window, the shell, the project tasks,... all together in the same place and linked to each other. With vim, you have to compose all those with a multiplexer and other tools (with conflicting bindings) to get there. Vim is still better for editing, but Emacs is better for workflows.

by skydhash

5/18/2025 at 7:00:21 PM

Why would you ever calculate relative jump yourself instead of having relative line numbers in the gutter?

And yes, for a few lines it's fine, the plugin has this number configurable.

by eviks

5/18/2025 at 8:58:24 PM

Thanks for letting me know, I wasn’t aware that was possible!

by rybosome

5/18/2025 at 9:17:18 PM

Getting used to thinking about multi-line motions via 5j helped me train to visualise lines that way.

Over time, I started using things like 13dd or 7yy with more ease.

Of course, `set relativenumber` is always recommended.

> Calculating a relative jump myself would 100% pull me out of the flow state where I just want to go up/down a few rows.

Yeah, you can't be a purist about it. If you're hard-focused and jjjjj is the first thing that comes to mind, then that's fine. When you're doing lighter work is when you have the spare mental capacity to train and improve on your workflow.

by WhyNotHugo

5/19/2025 at 12:17:59 AM

There are countless more convenient keys that you can use to navigate up and down without counting. Basic ones are /, *, n, N, H, M, L, {, }, %, ctrl-]. ]c, [c when you're in a diff buffer or have a Git plugin that offers this key. ]d, [d, [q, ]q, ]l, [l if you use Neovim.

by soraminazuki

5/18/2025 at 3:56:04 PM

It's nice to have good tools that are practical for navigating around the text.

For jumping around what's on screen, I think 'easymotion' ("jump anywhere on screen by pressing two characters") & variations are best in terms of how quickly they let you navigate for how easy it is to use.

by rgoulter

5/20/2025 at 1:38:37 PM

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

by mvieira38

5/18/2025 at 6:57:38 PM

You don't need to use the upper row, bind numbers to right thumb modifier + numpad-like uio jkl m,.

Or instead of 15j use another jump to command that accepts those letters as numbers

Or have some jump type of command that displays a-z labels 1 per row in the middle and you can jump without numbers and without shifting focus to the gutter

But yes, the most basic motion will still be more "intuitive"

by eviks

5/18/2025 at 3:55:43 PM

Huh, I don't find the number row very difficult to touch type. But then again, I do have long fingers.

by fwip

5/18/2025 at 3:42:54 PM

I've pretty much always struggled with this too. I have a numpad that I can touchtype easily but if I'm taking my hands off homerow I may as well use a mouse at that point.

by ryanmcbride

5/18/2025 at 5:09:58 PM

Also gives me time to plan what I'm going to do once I get there. Or I spot a bug/relevant code snippet along the way.

by mathstuf

5/18/2025 at 3:16:32 PM

I use it and helped me greatly! Thanks a lot for putting this together.

There are few minor things I don't agree as bad habits. For instance, Home/End should be allowed at least when you are in edit mode as they armonize with almost any other text input (not just editors, but also the text inputs/areas on websites).

by marcyb5st

5/18/2025 at 3:19:42 PM

Thank you! Home/End are actually allowed in Hardtime default config. I'm guessing that you are using AstroNvim since its community default config disables them: https://github.com/AstroNvim/astrocommunity/blob/main/lua/as...

by m4xshen

5/18/2025 at 4:27:16 PM

Correct! Thanks for pointing that out. I never investigated and just rolled with it :)

by marcyb5st

5/19/2025 at 12:42:23 AM

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 left hand; asd, with finding a character on the current line associated with f (and F for finding backward).

After those, other lesser used, but still very useful, commands are associated with the rows above and below the "home-row".

Finally, repeating any of these is bound to prefixed numbers, which are of course two rows above the "home-row" on a QWERTY keyboard.

Modifiers such as Shift, Ctrl, and others are approximately the same distance as the numeric row, unless one binds CapsLock to be Ctrl on most modern keyboards (note that Sun's keyboard got it right and had Ctrl in the position most keyboards now have CapsLock).

Interestingly enough, learning vim can often times follow the above distances from hjkl with great result.

by AdieuToLogic

5/19/2025 at 6:39:55 AM

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.

by xeyownt

5/19/2025 at 11:40:20 PM

> 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.

by AdieuToLogic

5/19/2025 at 2:45:26 PM

WASD is only lefty if you don't use the mouse. Otherwise, WASD really sucks when using a lefty mouse.

by nosioptar

5/18/2025 at 3:35:31 PM

Despite using vim and neovim for over 20 years, I'm still apparently a caveman when it comes to navigating. I both love and hate that this plugin calls me out for it. The "Hardtime Report" is a great feature, really shows just how pervasive my bad habits are. This could either help me improve - or force me to uninstall it in anger.

by perrygeo

5/18/2025 at 10:36:08 PM

This was the neovim plugin that really caused me to stick with it. I've been using this plugin for over a year, after the (short) initial period of frustration with the delays I was able to start really flying with vim motions. Now I can't imagine going back to a regular text editor.

by mnurzia

5/18/2025 at 8:38:11 PM

When I started using Vim many years ago, I mapped the arrow keys to no-op.

This made the biggest difference, more than anything else. It forced me to use hjkl and never the arrow keys.

Everything else is a bonus that comes by itself later.

by WhyNotHugo

5/18/2025 at 9:11:22 PM

That's a good start, but then you develop the same anti-pattern like typing jjjjj to go down 5 lines instead of 5j

That's what hardtime solves.

by suprjami

5/18/2025 at 2:50:28 PM

This looks awesome! Wonder if something like this could be turned into a generalized optimization engine of sorts? Ie if the problem could be generalized for a set of available movement commands relative to used commands, you could apply it to any underlying platform.

Which is to say, i'd love to see this in Helix. I also toy with custom editors, and observability of available commands is high priority for me, a generalized solution here would be an elegant solve for that. It would also adapt to new features nicely.

by unshavedyak

5/18/2025 at 3:31:05 PM

This is awesome. This might be the thing that gets me to stop being a dinosaur and switch to neovim.

by lylejantzi3rd

5/18/2025 at 6:48:02 PM

This is really cool, I would love something like this for the VS Code vim emulation. I’m constantly trying to improve my usage but bad habits are hard to break, especially when even the bad habits feel so productive compared to not having vim.

by n8cpdx

5/18/2025 at 2:18:40 PM

Love it! working on similar tool tips for my project:

https://vimgolf.ai

EDIT: thanks all for the feedback! Sorry there are not more levels, but if you check back in a week am adding a level editor!

by nickandbro

5/18/2025 at 3:06:46 PM

I signed up to give it a try, but when I click "Go to Levels" it takes me to https://vimgolf.ai/levels and I get a 404 error.

by foob

5/18/2025 at 4:16:13 PM

same

but clicking on the hamburger menu it shows a link to “Motions”, which seems to be the first level/demo of the game

by horsellama

5/18/2025 at 4:18:16 PM

Sorry, yeah I am adding more levels, and will fix that! Thanks for testing!

by nickandbro

5/18/2025 at 2:37:02 PM

This looks cool. Is it free?

by shlomo_z

5/18/2025 at 2:55:30 PM

Thanks, it is, right now! And will have a generous free tier once finished. The only big reason I am making a priced option is for users who want AI tips to be able to have that option. Right now, I do that by having reasoning models like o3 solve the levels and then provide tips or verifying a level can be solved with certain motions.

by nickandbro

5/18/2025 at 3:10:48 PM

I'm always hesitant about signing up for services. would be great if there was a demo that didn't require creating an account!

by linnnus

5/18/2025 at 3:36:35 PM

I wouldn’t mind signing up without a demo if there was more information about what this is exactly.

by JLO64

5/18/2025 at 3:46:24 PM

Great feedback! Will role out a update with that information

by nickandbro

5/18/2025 at 3:35:32 PM

Point taken! Right now I am exploring a way where users can test the service on the landing page, without signing up.

by nickandbro

5/18/2025 at 3:28:02 PM

I'm totally going to install it, thank you very much for developing it!

by darkwater

5/19/2025 at 9:18:03 AM

I love the fact that it provides hints for faster Vim motion, and you get a report of your most common bad habits. Is there anything like this for Vim?

by johnisgood

5/18/2025 at 4:40:20 PM

This looks great! Is it compatible with lazyvim's installations? Because I could not get it working and I suspect it is conflicting with some other plugin

by avinassh

5/19/2025 at 6:45:19 AM

There is a conflict with plugin "FastFold". But the easy fix is to disable the onoremap and xnoremap made in that plugin.

by xeyownt

5/18/2025 at 4:58:07 PM

Yeah it is compatible. You can open an issue with more detail if it is still not working.

by m4xshen

5/20/2025 at 1:42:54 PM

I didn't even realize I had these bad habits.

by hualaka

5/18/2025 at 4:55:12 PM

Been using this plugin for a while, really helped me kick a lot of bad habits. I enjoy how it lets you add custom rules. I really struggled to make myself use I and A, and kept doing ^i $i, so I told it to yell at me when I do that until I learned

by SuperManifolds

5/18/2025 at 5:56:52 PM

Repo name checks out.

Looks awesome, will not try!

by lherron

5/18/2025 at 3:47:26 PM

I'm a bit disappointed that this can only be used with NeoVim yet it claims to help you master Vim.

Sorry not meant to be a criticism. Maybe this is the last push for me to switch to using NeoVim.

by yegle

5/18/2025 at 4:14:34 PM

I waited as well long time, but after switching my tooling and usage has improved a lot since lot of progressive community around modern tools that NVim supports. So I encourage to take a look.

I still keep vim configuration around but I've never felt the need for going back.

by ilvez

5/18/2025 at 6:17:38 PM

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.

by mystifyingpoi

5/19/2025 at 6:43:23 AM

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.

by xeyownt

5/20/2025 at 8:35:38 PM

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.

by grep_name

5/22/2025 at 6:43:55 PM

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.

by mystifyingpoi

5/18/2025 at 4:13:22 PM

Not a criticism, just noting that it says it helps master Vim motions, not Vim

by drabbiticus

5/18/2025 at 2:31:59 PM

Great work.

by thdhhghgbhy

5/18/2025 at 2:16:12 PM

Very cool!

by alabhyajindal