[prev in list] [next in list] [prev in thread] [next in thread] 

List:       vim
Subject:    Re: Custom function
From:       Benji Fisher <benji () member ! AMS ! org>
Date:       2004-01-31 4:32:46
Message-ID: 20040131043246.GC12226 () localhost ! localdomain
[Download RAW message or body]

On Fri, Jan 30, 2004 at 10:31:31PM -0500, Michael Metzger wrote:
> Vim experts,
> 
> I am trying to make a custom function in my _gvimrc file that will insert \
> pre-defined text somehow into the current buffer on the current line. 
> I have tried something like this
> > function newScript()
> > append 1, "Text blah <CR> . <CR>"
> > endfunction
> 
> I know to stop a normal append command I need to place a dot on a single line by \
> itself and hit enter, hence the <CR>'s above. 
> Can anyone tell me how I should go about making this work for my function?

     First of all, start your function name with a capital letter.

     I am guessing that you put in the 1 to append after Line 1.  If so,
then this works for me:

function NewScript()
  1 append
  Text blah
  .
endfunction

Some other methods, without the function wrapper:

> 1 put='any text that does not contain a single quote'
> 1 put=\"This is how to deal with a ' character.\"
> call append(1, "any 'string' that" . '\you/like')

> help 41.7
> help :append
> help :put
> help append()

HTH					--Benji Fisher


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic