Hacker News new | past | comments | ask | show | jobs | submit login

I usually record my throwaway macros to q (because hitting qq is so easy), so I've bound Q to 'call the most recently defined macro'. I would post something to put in your .vimrc, but I use the vim emulator evil-mode in Emacs.

This way, I can skip the awkward @q step, and keep hitting Q instead of @@ to re-run the macro.




I use <space> for this. It's very gratifying, mashing the spacebar to repeat a macro.


using space for the leader is one thing that I absolutely love... I was using , for it but space is so much easier and nicer to use. you are not limited to one finger to start the leader command so it makes both sides of the keyboard nice to use for leader chords.

it only took about a week to retrain myself for it.

here's the command... put it at the top of your vimrc before anything else so it works with your plugins.

let mapleader=" "


See space.vim for another cool use for the spacebar. https://github.com/spiiph/vim-space


I have mapleader set to ",", which has served me well.

I just realized I only use my left thumb with the spacebar, so the ambidextrous argument doesn't fly for me.

But I did realize space currently does nothing for me in normal mode. So I made it work like less/more, i.e., it pages the screen down:

nnoremap <space> <C-d> nnoremap <S-space> <C-u>


even if you only use your left thumb to hit space it's still faster than using , for your leader as the thumb really only hits the space key, command(if you are on a mac)/alt(windows) and maybe option/alt if you are on a mac. and it's natural to use the left keys after hitting space. whereas using any key on the right side of the keyboard after a leader press is awkward and slower because the , key is pressed with your middle finger. it's also a smaller target so it's harder to hit.


Should just be:

nnoremap <space> <C-d>

The shift-space doesn't work.


Hm, this is actually a really neat idea. I'm going to try this!


It was painful for a few days but after that I can't imagine going back to , especially since that is actually a useful default binding.


How do you call the most recently defined macro? I just have Q bound to @q, but if I could make it more general that would be awesome.


@@ re-runs the last macro.


that is a great idea!




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: