Re: Vim scripting - cursor motion

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



Jussi Hirvi wrote:
> I am working on my first vim script. The script is supposed to do some
> find/replace on a file, then save the file with a new name and quit vim.
>
> I will save the script in a file and then call it from a bash script
> like this:
>
> 	vim path-to-the-file -s path-to-my-script
>
> Maybe I have not found the right resources. I can find/replace with
> expressions that are similar to those I use manually, for example:
>
> 	:% s/\t/","/g
>
> Then I should add something to the beginning of file (line 1, char 1).
> And append something to the end of the file (last line, last char). But
> I cannot find a way to do this. Should I move the cursor (and how?), or
> what?

Why do vim scripting? That's what sed, or awk, or perl, are for. The
latter two, of course, are much easier to comprehend the logic, too.

    mark

_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
http://lists.centos.org/mailman/listinfo/centos


[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux