# In Vim regex, Is there an abbreviation for the pattern dot followed by plus sign?

Given that the pattern .\+ is frequently used, is there an abbreviated way of specifying it in Vim Regex?

• If you preface your regex with \v, you don't have to escape that +. e.g., /\v.+. You can put this in your .vimrc file to always use it: nnoremap / /\v – Daniel Kaplan Nov 21 '17 at 18:29

When you type / you're in command mode. You can remap this by putting this in your .vimrc file:
cnoremap .+ .\+

This means, if you type .+ in command mode, replace it with .\+. You can replace the .+ on the left with anything you want.
• @Sabuncu Well there are lots of mappings. You can change what happens when you're in insert mode, normal mode, command mode, operator-pending mode, etc. I expected that when you typed / you're in normal mode because you type the / in normal mode. But I was surprised to learn that when you type / you're in command mode. The same mode that you're in when you type :. Therefore, you change this with a command mode mapping, not a normal mode mapping. Type :help map.txt to learn more. – Daniel Kaplan Nov 21 '17 at 20:23
• Could not get it to work. I am using Vim 7.4 gvim on Windows 10. I ran your cnoremap command in command mode (i.e. I did :cnoremap...). Then tried using the mapping, and it did not work. – Sabuncu Nov 21 '17 at 20:29
• Be warned: 1) this may add a delay when typing . when in command line mode 2) This will expand in other places e.g. :grep '.+'. This may not be as you want. Might be able to limit this via cnoremap <expr> .+ getcmdtype() =~ '[/?]' ? '.\+' : '.+'. 3) This could get award if you want to use very magic mode, e.g. \v – Peter Rincker Nov 21 '17 at 21:31