(Move categories to tip template) |
(Remove html character entities) |
||
Line 13: | Line 13: | ||
When writing/debugging code you often want to jump from where a subroutine/function is called to where it actually is . Hitting the "*" key is frustrating if the sub/func is called many times. The following mapping solves the problem. (Notice how it can be altered for other lanaguages) |
When writing/debugging code you often want to jump from where a subroutine/function is called to where it actually is . Hitting the "*" key is frustrating if the sub/func is called many times. The following mapping solves the problem. (Notice how it can be altered for other lanaguages) |
||
− | nmap gx yiw/^\(sub\ |
+ | nmap gx yiw/^\(sub\<Bar>function\)\s\+<C-R>"<CR> |
Instructions: Place cursor over called function (normal mode) and type <tt>gx</tt> |
Instructions: Place cursor over called function (normal mode) and type <tt>gx</tt> |
||
Line 20: | Line 20: | ||
;yiw : Yank inner work to un-named register |
;yiw : Yank inner work to un-named register |
||
− | ;/^\(sub\ |
+ | ;/^\(sub\<Bar>function\)\s\+ : search for sub or function followed by 1 or more spaces |
− | ; |
+ | ;<C-R>" : Retrieve un-named register |
− | ; |
+ | ;<CR> : Start Search |
Information also included in [[VimTip305]]. |
Information also included in [[VimTip305]]. |
Revision as of 05:42, 29 September 2008
Tip 383 Printable Monobook Previous Next
created December 6, 2002 · complexity basic · author zzapper · version 6.0
When writing/debugging code you often want to jump from where a subroutine/function is called to where it actually is . Hitting the "*" key is frustrating if the sub/func is called many times. The following mapping solves the problem. (Notice how it can be altered for other lanaguages)
nmap gx yiw/^\(sub\<Bar>function\)\s\+<C-R>"<CR>
Instructions: Place cursor over called function (normal mode) and type gx
How it works
- yiw
- Yank inner work to un-named register
- /^\(sub\<Bar>function\)\s\+
- search for sub or function followed by 1 or more spaces
- <C-R>"
- Retrieve un-named register
- <CR>
- Start Search
Information also included in VimTip305.
References
Comments
What language is this supposed to work in? Basic??
- Probably perl, which also uses sub for functions