Re: [CentOS] Vim scripting - cursor motion

2011-06-13 Thread Kahlil Hodgson
On 11/06/11 19:03, Jussi Hirvi wrote: > Ok, that helped me along. For some reason the motions (like 1G0 for > beginning of file, or G$ for last char in file) work, when the script is > called from command-line with -s flag (vim -s myscript myfile). But they > don't work when the script is called

Re: [CentOS] Vim scripting - cursor motion

2011-06-11 Thread Jussi Hirvi
On 11.6.2011 19.08, Alain Péan wrote: > I hope not to begin a flame war, but I would recommend Python. It can do > the same things as Perl (regexp ansd so on), but is easier and faster to > learn, and the code is also much more readeable... In practice, any language you know well enough... This is

Re: [CentOS] Vim scripting - cursor motion

2011-06-11 Thread Alain Péan
Le 11/06/2011 18:22, Les Mikesell a écrit : > On 6/11/11 11:08 AM, Alain Péan wrote: So this was my first-ever vim script. So far I am not convinced about vim scripting (ok, I was warned, too)... Test cycle is slow (modify script, quit the realfile, open realfile again with vim -s sc

Re: [CentOS] Vim scripting - cursor motion

2011-06-11 Thread Les Mikesell
On 6/11/11 11:08 AM, Alain Péan wrote: > >>> So this was my first-ever vim script. So far I am not convinced about >>> vim scripting (ok, I was warned, too)... Test cycle is slow (modify >>> script, quit the realfile, open realfile again with vim -s script). >>> Verbal error messages would be usefu

Re: [CentOS] Vim scripting - cursor motion

2011-06-11 Thread Alain Péan
Le 11/06/2011 17:56, Les Mikesell a écrit : > On 6/11/11 4:03 AM, Jussi Hirvi wrote: >> So this was my first-ever vim script. So far I am not convinced about >> vim scripting (ok, I was warned, too)... Test cycle is slow (modify >> script, quit the realfile, open realfile again with vim -s script).

Re: [CentOS] Vim scripting - cursor motion

2011-06-11 Thread Les Mikesell
On 6/11/11 4:03 AM, Jussi Hirvi wrote: >> > So this was my first-ever vim script. So far I am not convinced about > vim scripting (ok, I was warned, too)... Test cycle is slow (modify > script, quit the realfile, open realfile again with vim -s script). > Verbal error messages would be useful. Ther

Re: [CentOS] Vim scripting - cursor motion

2011-06-11 Thread Jussi Hirvi
On 10.6.2011 21.42, Les Mikesell wrote: > I thought the point of using vim instead of something more appropriate > for scripting was that you already knew how to use it. I only wrote that I know vim *better* than sed, awk or perl. Obviously there is a lot about vim that I don't know. > Why not

Re: [CentOS] Vim scripting - cursor motion

2011-06-10 Thread flapeccino
Jussi I tried various ways but it seems the only way to insert a line from a script is to use the append() function (do help append) specifying the line number as a parameter. I tried it on with an example script "moo.vim" as shown below flapeccino@T4410 ~ $ cat moo.vim :1,$s/ /,/g :call appen

Re: [CentOS] Vim scripting - cursor motion

2011-06-10 Thread Les Mikesell
On 6/10/2011 1:03 PM, Jussi Hirvi wrote: > On 10.6.2011 18.39, flapecc...@gmail.com wrote: >> There is a good article on vimscript here: >> http://www.ibm.com/developerworks/linux/library/l-vimscript-1/index.html) > > Sorry there was a typo, the correct URL is: > http://www.ibm.com/developerworks/l

Re: [CentOS] Vim scripting - cursor motion

2011-06-10 Thread Jussi Hirvi
On 10.6.2011 18.39, flapecc...@gmail.com wrote: > There is a good article on vimscript here: > http://www.ibm.com/developerworks/linux/library/l-vimscript-1/index.html) Sorry there was a typo, the correct URL is: http://www.ibm.com/developerworks/linux/library/l-vim-script-1/index.html Thanks, I

Re: [CentOS] Vim scripting - cursor motion

2011-06-10 Thread flapeccino
ject: Re: [CentOS] Vim scripting - cursor motion Jussi There is a good article on vimscript here: http://www.ibm.com/developerworks/linux/library/l-vimscript-1/index.html) Sent via BlackBerry by AT&T ___ CentOS mailing list CentOS@centos.

Re: [CentOS] Vim scripting - cursor motion

2011-06-10 Thread flapeccino
Jussi There is a good article on vimscript here: http://www.ibm.com/developerworks/linux/library/l-vimscript-1/index.html) Sent via BlackBerry by AT&T ___ CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos

Re: [CentOS] Vim scripting - cursor motion

2011-06-10 Thread John Doe
From: Jussi Hirvi >     :% 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? echo "First Line" > NEWFILE

Re: [CentOS] Vim scripting - cursor motion

2011-06-09 Thread Aleksey Tsalolikhin
On Thu, Jun 9, 2011 at 11:03 AM, CS DBA wrote: > On 06/09/2011 08:48 AM, 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

Re: [CentOS] Vim scripting - cursor motion

2011-06-09 Thread CS DBA
On 06/09/2011 08:48 AM, 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-

Re: [CentOS] Vim scripting - cursor motion

2011-06-09 Thread Jerry Franz
On 06/09/2011 08:37 AM, Les Mikesell wrote: > > I'd highly recommend perl for this because it can also do the SQL part > directly via DBI without all of the intermediate contortions you'll have > to do in files otherwise. It should take about half a page of your own > code to connect to the DB, re

Re: [CentOS] Vim scripting - cursor motion

2011-06-09 Thread Les Mikesell
On 6/9/2011 10:07 AM, Jussi Hirvi wrote: > On 9.6.2011 18.01, m.r...@5-cent.us wrote: >> 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. > > Maybe just because I know vim better than sed, awk or perl, which

Re: [CentOS] Vim scripting - cursor motion

2011-06-09 Thread m . roth
Jussi Hirvi wrote: > On 9.6.2011 18.01, m.r...@5-cent.us wrote: >> 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. > > Maybe just because I know vim better than sed, awk or perl, which I > haven't used at a

Re: [CentOS] Vim scripting - cursor motion

2011-06-09 Thread Jussi Hirvi
On 9.6.2011 18.01, m.r...@5-cent.us wrote: > 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. Maybe just because I know vim better than sed, awk or perl, which I haven't used at all. :-) The practical purp

Re: [CentOS] Vim scripting - cursor motion

2011-06-09 Thread m . roth
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-s

[CentOS] Vim scripting - cursor motion

2011-06-09 Thread Jussi Hirvi
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 fou