how to search with cscope ignoring case?

1,206 views
Skip to first unread message

Issac Liao

unread,
Apr 19, 2013, 1:56:16 AM4/19/13
to v...@vim.org
Hi:

  recently I fall in love with cscope in vim.
  this feature is awesome.
  but then I found that I could not search text ignoring letter case.

  eg.
  I type :cs f t logdisplayer
  vim will fail to find LogDisplayer.

  this has been really frustrating.
  so I look up the manual and search through the internet.
  but I can not find a way to fix my problem.
  
  I use cscope -CRbq to build the database for cscope as suggested.(-C will enable searching case-insensitive)
  but obviously vim does not work with that.
 
  I tried :cs add cscope.out -C  too . It doesn't work.

  so I wonder is there a way to make  :cs find  searching ignoring case?
  
  thank you in advance. :)

tooth pik

unread,
Apr 19, 2013, 11:28:50 AM4/19/13
to vim...@googlegroups.com
what happens when you

:set ignorecase

?

tw...@magicleap.com

unread,
Apr 3, 2019, 7:39:49 PM4/3/19
to vim_use
nope. `:set ignorecase` only tells vim to ignore case, not the cscope.

jreidthompson

unread,
Apr 4, 2019, 7:19:31 AM4/4/19
to vim_use

from https://sourceforge.net/p/cscope/bugs/253/

I concur with Hans. This isn't a cscope bug, and we're not here to pass on bug reportson your behalf. The cscope plugin is part of the vim project, so you need to go there. Also if you had bothered to
read the :cs help in vim, you would note that it doesn't pass options like that at all. In fact it doesn't support cscope option passing at all. The best you can do is to set the csprg option to a
wrapper script around cscope that sets the options for you there

Efraim Yawitz

unread,
Apr 4, 2019, 8:00:22 AM4/4/19
to vim_use
--
--
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+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

The help states that you can add an option to the 'add' command:

        :cscope add cscope.out /usr/local/vim -C

I haven't gotten this to work yet, though.

Tony Mechelynck

unread,
Apr 4, 2019, 8:12:37 AM4/4/19
to vim...@googlegroups.com
On Thu, Apr 4, 2019 at 2:00 PM Efraim Yawitz <efraim...@gmail.com> wrote:
> On Fri, 19 Apr 2013 at 12:16, Issac Liao <issac...@gmail.com> wrote:
>>
>> Hi:
>>
>> recently I fall in love with cscope in vim.
>> this feature is awesome.
>> but then I found that I could not search text ignoring letter case.
>>
>> eg.
>> I type :cs f t logdisplayer
>> vim will fail to find LogDisplayer.

Have you tried using :cs f e instead? I haven't, but I have a hunch
that if one of cscope's find options can handle caseless search, it's
that one (search for an egrep pattern).

Best regards,
Tony.

Efraim Yawitz

unread,
Apr 7, 2019, 8:33:03 AM4/7/19
to vim_use
If anyone is still paying attention, it does work just as stated in the help.  It wasn't working for me because I didn't realize the "pre-path" parameter ("/usr/local/vim" in the example) is obligatory

I was trying something like:

:cscope add cscope.out -C 

and the connection failed.

Tony Mechelynck

unread,
Apr 7, 2019, 11:16:47 AM4/7/19
to vim...@googlegroups.com
On Sun, Apr 7, 2019 at 2:32 PM Efraim Yawitz <efraim...@gmail.com> wrote:
> If anyone is still paying attention, it does work just as stated in the help. It wasn't working for me because I didn't realize the "pre-path" parameter ("/usr/local/vim" in the example) is obligatory
>
> I was trying something like:
>
> :cscope add cscope.out -C
>
> and the connection failed.

Good that you found out what was wrong.

FWIW, I have the following lines in my vimrc; I use cscope almost
exclusively to look at the Vim source, where case matters, so my use
case is not identical to yours, but maybe you could use some variation
of them, maybe with a directory argument instead of hardcoding
$VIMSRC.

The :cnoreabbrev commands are just typing shortcuts, but the :Cscope
command defined at the end makes sure that I run cscope to use its
database in the same src directory where I ran it (manually, and after
a cd command) to create its database. The autocommand defined before
that is probably not necessary but it looks "cleaner" to me than doing
nothing.

" define $VIMSRC as the src directory in our Vim source clone
let $VIMSRC = expand('~/.build/vim/vim-hg/src', ':p')

" settings for cscope
if has('cscope')
set csqf=s-,c-,d-,i-,t-,e-
set csre csverb

cnoreabbrev <expr> csa ((getcmdtype() == ':' && getcmdpos() <= 6)?
'cs add' : 'csa')
cnoreabbrev <expr> csf ((getcmdtype() == ':' && getcmdpos() <= 6)?
'cs find' : 'csf')
cnoreabbrev <expr> csfs ((getcmdtype() == ':' && getcmdpos() <= 7)?
'cs find s' : 'csfs')
cnoreabbrev <expr> csfg ((getcmdtype() == ':' && getcmdpos() <= 7)?
'cs find g' : 'csfg')
cnoreabbrev <expr> csfd ((getcmdtype() == ':' && getcmdpos() <= 7)?
'cs find d' : 'csfd')
cnoreabbrev <expr> csfc ((getcmdtype() == ':' && getcmdpos() <= 7)?
'cs find c' : 'csfc')
cnoreabbrev <expr> csft ((getcmdtype() == ':' && getcmdpos() <= 7)?
'cs find t' : 'csft')
cnoreabbrev <expr> csfe ((getcmdtype() == ':' && getcmdpos() <= 7)?
'cs find e' : 'csfe')
cnoreabbrev <expr> csff ((getcmdtype() == ':' && getcmdpos() <= 7)?
'cs find f' : 'csff')
cnoreabbrev <expr> csfi ((getcmdtype() == ':' && getcmdpos() <= 7)?
'cs find i' : 'csfi')
cnoreabbrev <expr> csh ((getcmdtype() == ':' && getcmdpos() <= 6)?
'cs help' : 'csh')
cnoreabbrev <expr> css ((getcmdtype() == ':' && getcmdpos() <= 6)?
'cs show' : 'css')

augroup cscope
au VimLeave * cs kill -1
augroup END

command -nargs=0 -bar Cscope cs add $VIMSRC/cscope.out $VIMSRC

endif



Best regards,
Tony.
Reply all
Reply to author
Forward
0 new messages