with your same mapping, I cannot get the Not an editor command: hsp
error message with my vim (v7.4).
Your mapping works fine, but you don't have <cr>
at the end, so when you press :hsp
in normal mode, your mapping will switch to commandline mode, and put the mapped command there, without executing it. You have to manually press Enter
.
@XZS's answer works, but keep in mind that it is an abbreviation(ab), not a mapping. ab is not command aliases, it is not exactly same as mapping. For example, you have to press another key (like space) after hsp
to trigger the ab. also, you cannot ab some special keys, this would be another limitation of ab.
There is c(nore)map
for command mapping.
e.g. you could have:
cnoremap hsp botright new
with above line, as same as your original one, you have to manually press Enter
, if you want it to be executed, you need add <CR>
at the end of the line.
I think if I do this, I would create mapping.