The 'smartcase' option does not work with '*', '#', 'gd' etc.
Adding following maps into vimrc will solve this problem.
map * *N/<up><CR> map # #n/<up><CR> map gd gdN/<up><CR>
Comments
That option does not work for * and # by design. Otherwise, you wouldn't be able to repeat the command to jump to the next occurrence: Depending on the case of the current <cword>, the next jump would either continue to be case-insensitive, or (once a <cword> with uppercase letters is encountered), the jump would suddenly stop being case-insensitive. So though the given mappings probably work, why would you want to do this? -- Inkarkat 13:22, 27 August 2009 (UTC)
For * and #, I think we could get around some of the issues by using /\<<C-R>w\><CR> instead of *N/<up><CR>. I agree with Inkarkat, when using *, #, gd, etc. I'm looking for an EXACT match, not a case-insensitive one. But, I'm usually editing code. Perhaps when editing prose or html smartcase would be nice to apply to such things. Actually, ignorecase would make more sense, but I'm sure there are uses. I would probably map something different like <leader>* for example for a case-insensitive or smartcase search for the word under the cursor, but keep the default behavior for the actual commands. --Fritzophrenic 14:42, 27 August 2009 (UTC)
- For prose (including HTML), what might make sense would be to search for a copy of the current word, obeying 'ignorecase' but ignoring 'smartcase'. Easier said than done, I suppose. --Tonymec 16:01, 27 August 2009 (UTC)