Tuesday, January 14, 2014

Re: cstag change "find g"

On 2014-01-14, David Fishburn wrote:
>
> ...
>
> I think this will do it, but I haven't tested for interactions with
> any cscope options.
>
>     nmap <silent> <C-]> :cs find s <C-R><C-W><CR>
>
>
> Thanks Gary.
>
> :cstag does some additional things.
>
> If first checks your cscope database (:cs find g), and if not found, it then
> does the usual :tag to find your matches.
>
> Now, I would only enable this for a given buffer when cscopetag is set.
>
> So I wonder if something like:
>
>     nmap <silent> <C-]> if &l:cscopetag== 1 \| :cs find s <C-R><C-W><CR> \|
> else \| :tag <C-R><C-W><CR> \| endif
>
> That probably gets a bit closer, but I am not sure if it possible to check if
> :cs find s comes back with zero results or not (especially if the quickfix
> window is enabled) and then run the :tag command.

I use both tags and cscope, but separately.

Even with the quickfix window is open, a ":cs find s" of a
non-existent symbol generates error E259, so I bet you could put
that command in a :try block and catch the error.

Regards,
Gary

--
--
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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment