Yes, but you need to build the intelligence into the mapping. This can be done via a :help :map-expr
:
nnoremap <expr> C 'vi' . (getline('.') =~ '"' ? '"' : "'")
This simplistic example will check whether the current line contains a double quote, and then select those, else single quotes. For a useful mapping, you probably need to ensure surrounding quotes on both sides (using search()
), and if both types match select the "closer" one. With a :function
, you can make that as complex as you like...