30

I recently started using <Space> as my mapleader, and I find it very comfortable and fast. I can slap that key with either thumb, freeing up whichever hand I need for the next keystroke, and even one-handed combos are pretty easy. I'm curious why I haven't heard more Vim users recommend this. Is there a downside I'm missing? I see a lot of people recommending , but that feels awkward to me for a lot of combos.

1

4 Answers 4

34

I use space as my leader and love it. I've found that for me, (with their default actions) , is occasionally useful and <space> is literally never useful.

I can't think of any downsides to the spacebar,* and likewise have no idea why , is so apparently common.

* Except for one easily-solvable one. Space doesn't appear for 'showcmd'. I work around this by using \ as my leader and mapping (must be :map, not :noremap) space to \.

9
  • Nice workaround! I'm going to try this.
    – ivan
    Dec 27, 2013 at 16:50
  • It's not working for me. The mapping works, but showcmd doesn't show ` when I hit <Space>`. Am I missing something?
    – ivan
    Dec 27, 2013 at 17:05
  • 2
    Found the tip for 'showcmd' helpful. One problem I ran into which I wasn't able to come up with a work around for was with that mapping it didn't seem possible to invoke keybindings mapped to <leader><leader>[key]
    – Mike S
    Aug 22, 2014 at 18:55
  • 2
    Space does appear as <20> in the "showcmd" for me. (I'm using gVim for Windows version 7.4, patches 1-1965) Aug 31, 2016 at 17:28
  • 1
    @rodarmor It was just an example for debugging ivan's problems.
    – Pandu
    Apr 25, 2017 at 18:53
5

It doesn't take long to get used to , (compared to the default \ anyway). However, given that most people map their leader-key to ,, some plugins (nerdcommenter for example) are written with this in mind and using <Space> may interfere with some functionality. If you can live with that, go for it.

1
  • 1
    When having space as the leader doing <space>c<space> still works for toggling the comments, so it doesn't seem like an issue.
    – fbence
    Nov 29, 2019 at 15:25
2

I have been comfortable using ; as the leader. It helps the fingers stay on the home row and has been easy enough to use. But now, space seems to be a good option too. It doesn't conflict with my workflow. I'll probably give it a try.

2
  • 5
    You should definitely ditch ; for space. ; is the command for "jump to next f/t-result. I find it very useful.
    – krystah
    Dec 27, 2013 at 5:36
  • 1
    I haven't used f or t a lot. So, ; has worked for me all along. Using space instead of ; will be the first thing I'll try after the holidays.
    – Sriharsha
    Dec 28, 2013 at 6:41
1

I don't know why I've never heard anyone else use <space> for mapleader. It makes sense to me as long as you don't use <space> for navigation, which I don't either. I can't think of any other disadvantage.

1
  • 3
    Insert mode mappings with leader will cause a delay on each space press. That's the only I have found as I had one insert mode mapping but as I can live without it I have simply removed it.
    – daliusd
    Dec 15, 2020 at 8:11

Not the answer you're looking for? Browse other questions tagged .