I like to define some abbreviations like:cabbr csf cscope findI thought cabbr would just be interpreted in the : command line. However, when I entered the search mode \, I found that \csf would still be expanded to \cscope find, which definitely was not what I want.So how to deal with this situation? If I do want to search csf, what should I do? Or there is another kind of abbreviation other than cabbr intended to be valid just in the : command line?Thanks very much!
cabbr definitions disturb searching in Vim
command line;abbreviations
What you can do is use an expression abbreviation. This will allow you to use any Vim expression on the right-hand side, instead of just a static string. With getcmdtype() we can check if we're doing a normal Ex command or something else.cabbr <expr> csf getcmdtype() == ':' ? 'cscope find' : 'csf'See :help :map-<expr> for the documentation.