My space bar no longer works unless I lean my weight on it. The chances of getting the laptop replaced in a timely manner is close no nil.

I mostly use vim or vi, even from the bash command line. With combinations of the commands below, I've been able to replace <Space> with <C-j> in Normal and Insert modes, and even in Command-Line mode:

nmap <C-J> <Space>
map! <C-J> <Space>
omap <C-J> <Space>
map <C-J> <Space>
lmap <C-J> <Space>
omap <C-J> <Space>

I haven't been able to create the mapping in the mode in which I press f/F to move forward/backward to the character that is typed next.

What mode would that be?

Is there a way to map <C-J> to <Space> in that mode?

I would have thought that falls under Operator-pending mode, which falls under the map command.

1 Answer 1


If you look at :h f you'll see

|:lmap| mappings apply to {char}

(as in f{char})

Go to :h mapmode-l:

":lmap" defines a mapping that applies to:
- the argument of the commands that accept a text character, such as "r" and "f"

So lmap <c-j> <space> ... note, though, that you may need to explicitly enable lmap mappings by typing Ctrl+^ while in Insert mode. Alternatively, ensure that 'iminsert' is set to 1.

(The docs are misleading about this, btw. What I'm reading is that this setting only applies to use of lmap mappings used in Insert mode. But a simple test reveals that it applies to the f family of Normal mode commands. Anyone have a different interpretation of :h 'imi' and :h mapmode-l? Am I insane?)

FYI: you can also solve your problem by brute forcing it with :nnoremap f<c-j> f<space> and for F,t,T.

  • Sorry! I forgot to mention, I tried that too. Based on the help tables of what commands work in which modes. I will update the question to reflect this. Dec 6, 2019 at 2:20
  • Would you be able to elaborate, pleaes? I am literally using the 7 characters <Space> in the lmap command. I tried the lmap command using literal space character preceded by Ctrl+^ for the RHS. Also tried <C-^><C-J> as the RHS. Also tried invoking the mapping by typing <C-^><C-J> after a f/F command, but again no joy. Your nnoremap f<c-j> f<space> worked. Dec 6, 2019 at 2:40
  • I do issue the lmap command exactly as you show. In normal mode, I also enter F<C-^><C-J>. I get an error "bong" when the <C-^> key is pressed. Dec 6, 2019 at 4:58
  • <c-^> shouldn't be anywhere near your mapping! Not when you create the mapping and not when you utilize the mapping. You use <c-^> one time, alone, in Insert mode, to toggle the functionality. It's a setting. Just like 'iminsert' is.
    – B Layer
    Dec 6, 2019 at 5:10
  • 2
    Even better: They replaced the laptop. And better still, it's the same model, with the HDD from ye olde laptop swapped in, i.e., no customization or configuration needed, as it comes with along with the HDD. Dec 7, 2019 at 1:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.