Show HN: Hardtime.nvim – break bad habits and master Vim motions
Link: https://github.com/m4xshen/hardtime.nvim
Discussion: https://news.ycombinator.com/item?id=44020734

Show HN: Hardtime.nvim – break bad habits and master Vim motions
Link: https://github.com/m4xshen/hardtime.nvim
Discussion: https://news.ycombinator.com/item?id=44020734
Hardtime.nvim – break bad habits and master Vim motions
https://github.com/m4xshen/hardtime.nvim
#HackerNews #Hardtime.nvim #Vim #Motions #Break #Bad #Habits #Productivity
"Why Vim Is More than Just an Editor – Vim Language, Motions, and Modes Explained"
https://www.ssp.sh/blog/why-using-neovim-data-engineer-and-writer-2023/
So, hier hat der Regen jetzt Scheinbar aufgehört. Den Rest #refactoring mache ich morgen. Interessanterweise ist jetzt passiert, was wir alle schon lange befürchtet haben: ich will morgen mein erstes eigenes #vimscript für #vim und #neovim #nvim versuchen zu schreiben!
I always have two terminals open. One for #vim and one for `killall -9 vim`
For what it's worth, with the exception of the little inefficiency mentioned in previous toot, this is what I wanted to achieve. Enjoy.
For anything edited being on the remote filesystem mounted by rclone, keep the swapfile local.
It needs some cleanup, but you have the gist here.
" findmnt is available in util-linux package.
if executable("findmnt")
function DetectFileSystem(filepath)
let l:cmd="findmnt --noheadings --raw --target " .escape(a:filepath," \\")
let l:result=system(l:cmd)
let l:resarr=split(l:result, " ")
let l:resdict={"type":"unknown"}
let l:resdict={"mountpoint": l:resarr[0], "device": l:resarr[1], "type": l:resarr[2], "options": l:resarr[3]}
return l:resdict
endfunction
function SetLocalSwapForRemoteFilesystems(filepath)
let l:result=DetectFileSystem(a:filepath)
if l:result["type"]=="fuse.rclone"
setlocal directory=~/.vim/swapfiles//
setlocal noswapfile " The only known to me way to enforce creatio of the swapfile is to remove swapfile...
setlocal swapfile " ... and create it again.
endif
endfunction
augroup FileSystemDetect
autocmd!
autocmd BufRead * call SetLocalSwapForRemoteFilesystems(expand("<afile>"))
augroup END
endif
I need help again with #vim scripting.
Edit: I have a workaround for the main problem, details in the thread. However, I am still curious about why the BufReadPre does not work at all in this context.
For some particular files (you can probably guess it from the minimal example to reproduce the problem) I want to set swap directory (the vim directory setting) to a particular location.
So, I have a function:
function SetLocalSwapForRemoteFilesystems()
call mkdir("/tmp/swapfiles","p","0o700")
setlocal directory=/tmp/swapfiles//
echo "Swapdir: " . &directory
endfunction
which I call from autocommand:
autocmd BufRead * call SetLocalSwapForRemoteFilesystems()
The function is being called, as for any existing file being opened, I see the message:
Swapdir: /tmp/swapfiles//
but the swapfile is still created in the . directory, which is based on the original (default) version of swapfile setting.
I thought, that perhaps the swapfile location is being established before BufRead event, so I've tried to replace the autocommand with:
autocmd BufReadPre * call SetLocalSwapForRemoteFilesystems()
But right now my function is not even being called.
Any idea where is the problem and how to solve it?
#vim protip: when using Treesitter, use `syntax off` to disable basic syntax highlighting, that way you will notice if you need to install a treesitter parser you don't already have.
Have you ever heard of foreground and background jobs in a GNU/Linux or Unix context?
If not:
1. jump into your favorite shell
2. start e.g. vim with `vim foo.rs`
3. now press <CTRL> z
4. go to another directory and do an `ls` or so
5. and now run `fg`
(6. Works in an SSH session too)
Wow. It's crazy that I used this for the first time today after all these years of using Linux. You just never stop learning.
Good morning SMARTYPANTSES
If you haven’t voted in the text editor poll to which this toot is a reply, please weigh in. Have a wonderful day.
@gsthnz @noboilerplate I've heard many times about #vim, and I've seen a lot of people talk about how they love it. And I've honestly never doubted them about that!
Because I'm already strapped for time, I never really looked into how it worked (even from a basic explanation)... Because ... "When the f would I have time to learn that anyway."
That's why I'm really glad that Tris makes these videos because now at least I kind of understand the basic concept!
I hope I find the time to learn it
White (neo)vim themes
I finally found two color schemes (aka "themes") for (neo)vim that do have a white background. Because yes, sometimes, somewhere you may just need a white background. White like paper. Here they are:
https://github.com/habamax/vim-polar
https://github.com/habamax/vim-psionic
https://monodes.com/predaelli/2025/05/13/white-neovim-themes/
#Themes #vim
Had to screen share with the entire engineering org at work while editing with #vim and 90% of the “comments” were “but how do you exit ahahahahaHAHAHAHA”
Damn vscode whippersnappers
The speedometer on my car goes up to 200 kmph. Speed limits near me range from 10 to 110. I see the power potential daily on my dashboard and sometimes I watch what formula 1 drivers can do at high speeds, but I don’t go there. I could, but I don’t.
It’s okay to drive a vehicle without ever pushing it to its limits.
I recently stumbled across vim's `norm` on Sylvan Franklin's YouTube video - what a great feature!
For example, converting PHP object initialisation to method chaining:
`:'<,'>norm 0dt-f;x==`
For most of the cases where I use `norm` now, I used to type macros. Really a game changer.