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:

  1. the correct way represent them backslash \<xxx>. check expr-string.
  2. use double quotes, not single quotes
  3. :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

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -