Jean Johner
2010-03-12 14:05:01 UTC
Hello,
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.
Best regards.
Jean Johner
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.
Best regards.
Jean Johner
--
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
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