I have the following options:
set ignorecase
set smartcase
set incsearch
set wrapscan
The first two options cause the searches to be case-insensitive if there is no uppercase letter in the pattern.
I want this option to be disabled for the gd functionality, and preferably its variants.
I wanted the same for :h star, too, and got it from a vi.SE answer. Sadly, this concept cannot be used to implement gd, because gd analyzes a few choices to guess where the declaration of the variable under cursor might be (details in :h gd). One needs to implement that with the query appended with \C to make the search case-sensitive.
Emulating the default implementation of gd is the real work here.
ignorecaseandsmartcasebefore doinggdand then reset them to their previous value? – romainl Oct 13 '22 at 14:03noicback toic, the matches/highlights will re-sync. – 3N4N Oct 13 '22 at 14:49