I use VimNotes to take notes, but the capital “N” in Note command is really annoying me. Yes, I always have to use Shift to type “:” but still don’t want to type capital “N”.
The :command seems like a viable option at first:
*E174* *E182* :com[mand][!] [{attr}...] {cmd} {rep} Define a user command. The name of the command is {cmd} and its replacement text is {rep}. The command's attributes (see below) are {attr}. If the command already exists, an error is reported, unless a ! is specified, in which case the command is redefined.
However, there is a restriction on user-defined function naming:
:command Note note E183: User defined commands must start with an uppercase letter
But there is another way, abbreviation:
*:ca* *:cabbrev* :ca[bbrev] [<expr>] [<buffer>] [lhs] [rhs] same as ":ab", but for Command-line mode only. {not in Vi}
When you type in like (underscore indicates the cursor):
:note<space>_
It will then be replaced with, as soon as the Space hit:
:Note _
Note that tab-completion with commands will not work, :note<tab> does nothing. You will need to press space for the real command replacing, then Backspace and Tab in order to get the completion working.
This is the only way that I know how to have close to command aliasing, if you know a better way, please do share.
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.