Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to find and replace pattern containing floating point numbers using vim. I found this nice regular expression for such numbers:


This expression makes any regex it appears in quite long and confusing. Also I would probably want to use it quite often.

Is there some way that vim can learn this substring as an alias so that I can just search for something like Value: +[[:float:]] instead of Value: +[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)??

share|improve this question
up vote 2 down vote accepted

While I don't think what you want exists, abbreviations should help you, here.

cabbrev float [-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?

Practically, you'll use it like this:

share|improve this answer
Thank you! This is perfect for repeatedly using a longer regexp. The only thing that is missing would be that the abbreviation is not resolved before adding the command to the history, but this seems not possible. Even without this it helps a lot! – Tim Aug 27 '13 at 15:24

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.