On Tue, Dec 21, 2010 at 12:09 PM, Phani Deepak Parasuramuni <[email protected]> wrote: > Hi, > Is there anyway I can insert some text(say "Phani%d",count) into the buffer > at cursor position? > This is my use case. > I have a code where in at specific places I have some text like "// PLT". > Now I want to append a serial number to this 'PLT' every where. So that all > the lines with PLT will now become "// PLT1", "// PLT2" etc., > This is the way I am thinking of doing this. > 1. Maintain the count in global variable say PLT_count > 2. First search for "// PLT" > 3. Now record a macro(a) with these commands > a. qa ; record the macro to register a > b. call MyFunc which appends the PLT_count to "PLT" > c. n ; so that I 'll move cursor to the next PLT line. > d. q ; stop recording > Now since I know that I have 55 occurrences of PLT > I 'll do 5...@a > Now, the problem is how to write MyFunc, where I specifically need to insert > text( "%d",PLT_count) at the cursor position. With the cursor on 'P' of PLT, you can execute: :execute 'normal ' . 'RPLT' . PLT_count
-- 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
