Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
vimL errors, inconsistent result, etc
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  3 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
ping  
View profile  
 More options Aug 27 2012, 5:37 pm
From: ping <songpingem...@gmail.com>
Date: Mon, 27 Aug 2012 17:37:50 -0400
Local: Mon, Aug 27 2012 5:37 pm
Subject: vimL errors, inconsistent result, etc
I have a function (poorly implemented, I'm learning ...):

714 command! Log2Asciidoc :call Log2Asciidoc()<CR>

715 function! Log2Asciidoc()

716     "remove some special CH, like ^M

717     :%s#\r\|\s\=\(^G\|^M\)##

718     "turn ^H into delete

719     :g/^H/while getline('.') =~ '[^^H]^H' | s/[^^H]^H//g | endwhile

720     "add asciidoc markup == and <<top>> for every command

721     :%s/^\(\S\S\+.\{0,40}\S#\s*[^:^H^G]\+\|slot
\d\d\=->\S\+.*\|->.*\|\*-\*-\*-\*-\*-\)$/\r== \1\r\r<<top>>\r\r/
722     ":set foldmethod=expr

723     "skip the 1st comand

724     :execute "normal! gg" . '/^\(\S\S\+.\{0,40}\S#\s*[^:]\+\|slot
\d\d\=->\S\+.*\|->.*\|\*-\*-\*-\*-\*-\)' . "\<cr>" ."j"
725     "indent between <<top>> and next command

726     :g/<<top>>/+1,/^== \(\S\S\+.\{0,40}\S#\s*[^:^H^G]\+\|slot
\d\d\=->\S\+\|->.\+\|\*-\*-\*-\*-\*-\)/-1 >
727     "add ---- below <<top>>

728     :%s@\(<<top>>\)@\1\r----\r@

729     "skip first command

730     :execute "normal! gg" .
'/^\(\S\S\+.\{0,40}\S#\s*[^:^H^G]\+\|slot
\d\d\=->\S\+.*\|->.*\|\*-\*-\*-\*-\*-\)' . "\<cr>" ."j"
731     "start from 2nd command, add ---- before command

732     :.,$s@^\(\S\S\+.\{0,40}\S#\s*[^:^H^G]\+\|slot
\d\d\=->\S\+.*\|->.*\|\*-\*-\*-\*-\*-\)$@\r----\r\1\r@
733     "add one more last asciidoc delimitor to end of file

734     :execute "normal! Go----" . "\<cr>\<esc>"

735

736 endfunc

I got errors:

<snipped a lot>
......
25 lines >ed 1 time
Error detected while processing function Log2Asciidoc:
line   11:
E385: search hit BOTTOM without match for: ^==
\(\S\S\+.\{0,40}\S#\s*[^:^H^G]\+\|slot
\d\d\=->\S\+\|->.\+\|\*-\*-\*-\*-\*-\)
/^\(\S\S\+.\{0,40}\S#\s*[^^G]\+\|slot
\d\d\=->\S\+.*\|->.*\|\*-\*-\*-\*-\*-\)

E488: Trailing characters

which one is line 11?
I guess it started counting from the "function()" line and skipping the
comments?
and, which line contains trailing CH?
got crazy for the whole afternoon on this ...  I kind of started to hate
vimL now...
how you guys normally debug a function ?
and, I know this "simply put Ex cmds together" way is not good to write
a script, any experts points me how to improve it?
and, regardless of the script errors, sometime it does what I wanted,
but sometime doesn't, same code...is it all because of the :g magic?


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Marc Weber  
View profile  
 More options Aug 27 2012, 5:57 pm
From: Marc Weber <marco-owe...@gmx.de>
Date: Mon, 27 Aug 2012 23:56:50 +0200
Local: Mon, Aug 27 2012 5:56 pm
Subject: Re: vimL errors, inconsistent result, etc
> which one is line 11?

Exactly: 11 means 11th line of the function listed above.
https://github.com/c9s/vim-dev-plugin

has some hints about how to debug viml.

It also provides a VimLGotoLastError which often suceeds in such (line
11) cases.

We all know that viml sucks - it still often gets the job done.
Don't forgett how old vim is - and how much ahead of the time viml was
that time. No python/ruby/js/ ... existed back in time.

Today you can choose from any :h if_<tab> language implementation if you
don't like viml.

Marc Weber


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
ping  
View profile  
 More options Aug 28 2012, 10:42 am
From: ping <songpingem...@gmail.com>
Date: Tue, 28 Aug 2012 10:41:57 -0400
Local: Tues, Aug 28 2012 10:41 am
Subject: Re: vimL errors, inconsistent result, etc

On 08/27/2012 05:56 PM, Marc Weber wrote:

thanks, guess I need invest more test to learn...

regards
ping


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »