On 6/1/06, Johannes Schwarz <[EMAIL PROTECTED]> wrote:
Hello,

I'm trying to write my first vim-plugin, but I got stucked.

I managed to execute an external command, which gives me back a list of
filenames.

You need to say exactly how you executed the command, since that will
define how the lines were acquired, whether they went from the file
into a buffer correctly, etc.

One filename per line.

For each of the filenames I want to execute another command.
I tried it with code:


let j = 1
1

let line=getline(".")
while (strlen(line)!=0)

This loop is best done comparing line(".") <= line("$")

  "do sth. here -- construct the external command and so on
  j

'j' is incrementing, right?

  let line=getline(".")
endwhile

When I execute the code, it runns into an infinite loop, because the
lines are joined together with each loop

The infinite loop is probably due to other reasons, ie. above.

file:
text1.txt
text2.txt
text3.txt

Is the file (disk) or file loaded into a Vim buffer window?


after interrupting the loop the looks like
text1.txt text2.txt text3.txt

Not enough code examples to understand why it would be like this.

it seems j is interpreted as a J (join line) here.
And by the way, I think this is a bad solution anyway.
Can someone give me a hint how to do it in a clean way?

If it's simple enough, you can use global commands

:g/.*/commands

Reply via email to