On 22/05/10 12:46, ranjith kumar wrote:
Hi
  Can someone tell me how add blow 2 lines at the begining of a file
using vim substitution command (like ....1s/*/namespace f/ or
%s/*/namespace f/)'
line 1:  namespace family
line 2 : {


also at the end of the file I have to add  a new line containing '}]
at the end of the file.

Thanks in advance.


To insert full lines with fixed contents at beginning and end of file, I would recommend to use :pu[t] rather than :s[ubstitute]:

        :0put ="namespace family\n{"
        :$put ='}'

see
        :help :put
        :help quote=

and note that the :put command is one of those commands where a range of zero (literally, "after line zero") is used to mean "before line 1".


Best regards,
Tony.
--
In Riemann, Hilbert or in Banach space
Let superscripts and subscripts go their ways.
Our asymptotes no longer out of phase,
We shall encounter, counting, face to face.
                -- Stanislaw Lem, "Cyberiad"

--
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

Reply via email to