the project is filled with codes like this:
struct ngx_pool_s
{
....
};
typdef struct ngx_pool_s ngx_pool_t;
ngx_pool_t *p;
so, if cursor is under ngx_pool_t, my script is expected to jump directly to
the definition of ngx_pool_s instead of the "typedef" line.
my script is: (it has a problem when passing variable to cscope, please help
me.)
"function:
"move cursor to ngx_pool_t and press shift+F
"we can goto the defition of ngx_pool_s
function! Dachuan_nginx()
let w = expand("<cword>")
if -1 == match(w, '_t$')
return
endif
let w = substitute(w, '_t$', '_s', "g")
cs find g <C-R>=substitute(expand("<cword>", '_t$', '_s', "g")<CR><CR>
"cs find g <C-R>=substitute(w, '_t$', '_s', "g")<CR><CR>
"cs find g w (I CAN'T USE VARIABLE w DIRECTLY HERE, HOW TO DO IT?)
endfunction
nmap F :call Dachuan_nginx()<CR>
and by the way, I have already solve this problem using another method,
nmap F :cs find g <C-R>=substitute(expand("<cword>"),'_t$', '_s',
"g")<CR><CR>
but I still want to know the previous problem for future use.
--
View this message in context: http://vim.1045645.n5.nabble.com/error-while-vim-script-variable-pass-to-cscope-cmd-tp4438051p4438051.html
Sent from the Vim - General mailing list archive at Nabble.com.
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
No comments:
Post a Comment