vim - How to create an alias for ctags in vimscript -
i have function invoked based on simple key mapping
function! jumptodefinition() let filetype=&ft if filetype == 'coffee' exe '<c-]>' endif endfunction
this works when manually <c-]>
when try "exe" above "trailing whitespace" error.
how can invoke in standalone function have above?
note :execute
runs resulting expression ex command, isn't want since there no <c-]>
ex command. should using :normal
.
however, able use these "special keys", instead of characters represent, have pay attention 3 things:
- the correct way represent them backslash
\<xxx>
. checkexpr-string
. - use double quotes, not single quotes
:normal
accepts commands, not expression:execute
so, items 1 , 2 above know "\<c-]>"
should used, can't put in front of :normal
. well, can, executed "quote, backslash, c, ...". solution go using :execute
, time build string visible "\<xxx>"
in front of :normal
, expanded actual character , executed.
:exe "norm \<c-]>"
Comments
Post a Comment