On Fri, Mar 12, 2010 at 15:05, Jean Johner <[email protected]> wrote: > I would like to add a "c" (c character) at the beginning of a line (or > of a range) for any character already present at column 1. This means > that if "c" is the first character of the line, I want to get "cc". If > it is "a", I want to get "ca". > Using > :s/a*/c/ > works because * can be zero so that *a can be an empty string. > Unfortunately, if "a" is the first character of the line, the command > results in c replacing a (not inserting before a). > > Is there a way to solve this problem, for example by representing an > empty string in an absolute manner. > I tried /.*/ but it replaces the whole line. > I tried // but it represents the last search string.
Not sure I really understood what you need, but here's a try: %s/^\(.*\)$/c\1/ -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
