JSVI: Vi implemented in Javascript

2007-05-30 Thread Kevin Old

Not sure if everyone's seen this, but it's definitely cool and quite accurate.

http://ajaxian.com/archives/jsvi-you-love-vi-you-love-javascript-now-you-have-both

--
Kevin Old
[EMAIL PROTECTED]


Re: HTML and tidy

2007-03-10 Thread Kevin Old

On 3/9/07, Simon Jackson <[EMAIL PROTECTED]> wrote:

Is it possible to use tidy to clean up my html in the current document?



Hi Simon,

Yes, this can be done.  Here's a vim tip
(http://www.vim.org/tips/tip.php?tip_id=18) that explains the process.
Scroll to the bottom to the last comment that explains it the best.

HTH,
Kevin

--
Kevin Old
[EMAIL PROTECTED]


Re: Any way to have multiple setfiletype's?

2007-03-08 Thread Kevin Old

On 3/8/07, Kevin Old <[EMAIL PROTECTED]> wrote:

On 3/8/07, Kevin Old <[EMAIL PROTECTED]> wrote:
> Hello everyone,
>
> I've recently found the new HTML.zip
> (http://www.vim.org/scripts/script.php?script_id=453) utility and want
> to use it with my setup.  By itself HTML.zip works fine.
>
> Thing is, I use HTML::Mason as my template language for Perl and I
> have my setfiletype defined in filetypes.vim as:
>
> au! BufRead,BufNewFile *.htmlsetfiletype mason
>
> But, when it's defined this way, I'm not able to use the HTML.zip as
> it's not loaded.
>
> Is there any way I can have the best of both worlds and have my mason
> syntax highlighting and the usage of HTML.zip?
>
> Thanks for any help,
> Kevin
> --
> Kevin Old
> [EMAIL PROTECTED]
>

After reading this, I think I should ask it a different way.  I'll
want to set my filetype to html so that it gets the functionality from
HTML.zip, but would like to keep my mason syntax highlighting.  To get
this to work, each .html file I open I have to execute :set
syntax=mason and I get what I want.

I'd like to figure out a way to do this automatically.


For the archives, I did and here's how.  Hope this helps someone.

autocmd BufNewFile,BufRead *.{html} set syntax=mason

--
Kevin Old
[EMAIL PROTECTED]


Re: Any way to have multiple setfiletype's?

2007-03-08 Thread Kevin Old

On 3/8/07, Kevin Old <[EMAIL PROTECTED]> wrote:

Hello everyone,

I've recently found the new HTML.zip
(http://www.vim.org/scripts/script.php?script_id=453) utility and want
to use it with my setup.  By itself HTML.zip works fine.

Thing is, I use HTML::Mason as my template language for Perl and I
have my setfiletype defined in filetypes.vim as:

au! BufRead,BufNewFile *.htmlsetfiletype mason

But, when it's defined this way, I'm not able to use the HTML.zip as
it's not loaded.

Is there any way I can have the best of both worlds and have my mason
syntax highlighting and the usage of HTML.zip?

Thanks for any help,
Kevin
--
Kevin Old
[EMAIL PROTECTED]



After reading this, I think I should ask it a different way.  I'll
want to set my filetype to html so that it gets the functionality from
HTML.zip, but would like to keep my mason syntax highlighting.  To get
this to work, each .html file I open I have to execute :set
syntax=mason and I get what I want.

I'd like to figure out a way to do this automatically.

Thanks,
Kevin


--
Kevin Old
[EMAIL PROTECTED]


Any way to have multiple setfiletype's?

2007-03-08 Thread Kevin Old

Hello everyone,

I've recently found the new HTML.zip
(http://www.vim.org/scripts/script.php?script_id=453) utility and want
to use it with my setup.  By itself HTML.zip works fine.

Thing is, I use HTML::Mason as my template language for Perl and I
have my setfiletype defined in filetypes.vim as:

au! BufRead,BufNewFile *.htmlsetfiletype mason

But, when it's defined this way, I'm not able to use the HTML.zip as
it's not loaded.

Is there any way I can have the best of both worlds and have my mason
syntax highlighting and the usage of HTML.zip?

Thanks for any help,
Kevin
--
Kevin Old
[EMAIL PROTECTED]


Re: Execute command for current "block" of code

2006-11-22 Thread Kevin Old

Hi Tony,

Actually, I didn't know that highlighting visually and hitting the :
will give me the range.  That's half the battle for me on this.

I've tried putting that into a mapping like this:

map vti :'<,'> !perltidy

but when I visually select a chunk of code then type "vti" I get and
error saying:
"E492: Not an editor command '<,'> !perltidy"

Now my question is, how do I program a mapping so that I don't have to
type the !perltidy after I highlight the lines of code I need cleaned
up.

Thanks,
Kevin

On 11/22/06, A.J.Mechelynck <[EMAIL PROTECTED]> wrote:

Kevin Old wrote:
> Hello everyone,
>
> I have been thinking about implementing this little feature to help
> clean up my code.  Here's the scoop.  I'm a Perl programmer and I use
> a templating module called HTML::Mason which allows perl code within
> certain "tags".  Here's an example of the code:
>
> <% $tmpl->template_top()  %>
>
> % $m->call_next();
>
> <% $tmpl->template_bottom  %>
>
>
> <%init>
> use Myapp::HTML;
> use Myapp:Config qw(IMG_BASE_URL);
>
> my $tmpl = Myapp::HTML->new({
>title => 'Something',
>js => ['jquery.js'] },
>);
> 
>
> <%flags>
> inherit => undef
> 
>
>
> Between the <%init> tags is just straight Perl code.  I have two maps
> I've setup in vim that will run the contents of a file through an
> external program (perltidy) and clean up my code.  They are:
>
> map ti :%!perltidy " clean entire file
> map mt :.!perltidy " clean current line
>
> Just wondering if there'd be a way that I could write a map that would
> work for a current "block" of code.  Maybe autodetect what block I'm
> in?  In this case whatever block I'm in (init).  If I couldn't
> autodetect the block I'm in, that'd be ok cause I could just map the
> few types of blocks into separate map commands.
>
> Should I go about this with a regex and then pass that line range to
> the external command?
>
> Any help is greatly appreciated!
>
> Kevin

If you type : on a highlighted Visual area, you'll get :'<,'> as the range
(where '< means "the first line of the Visual area" and '> means "the last
line of the Visual area"). If you use that on an ex-command which accepts a
range (defined with the -range modifier) the range will be passed to the
command; otherwise it will be executed once for every line in the range.

v where  is a Normal-mode "object", will highlight the
concerned object. Example: vip for the "inner paragraph".


Best regards,
Tony.




--
Kevin Old
[EMAIL PROTECTED]


Execute command for current "block" of code

2006-11-22 Thread Kevin Old

Hello everyone,

I have been thinking about implementing this little feature to help
clean up my code.  Here's the scoop.  I'm a Perl programmer and I use
a templating module called HTML::Mason which allows perl code within
certain "tags".  Here's an example of the code:

<% $tmpl->template_top()  %>

% $m->call_next();

<% $tmpl->template_bottom  %>


<%init>
use Myapp::HTML;
use Myapp:Config qw(IMG_BASE_URL);

my $tmpl = Myapp::HTML->new({
   title => 'Something',
   js => ['jquery.js'] },
   );


<%flags>
inherit => undef



Between the <%init> tags is just straight Perl code.  I have two maps
I've setup in vim that will run the contents of a file through an
external program (perltidy) and clean up my code.  They are:

map ti :%!perltidy " clean entire file
map mt :.!perltidy " clean current line

Just wondering if there'd be a way that I could write a map that would
work for a current "block" of code.  Maybe autodetect what block I'm
in?  In this case whatever block I'm in (init).  If I couldn't
autodetect the block I'm in, that'd be ok cause I could just map the
few types of blocks into separate map commands.

Should I go about this with a regex and then pass that line range to
the external command?

Any help is greatly appreciated!

Kevin
--
Kevin Old
[EMAIL PROTECTED]


Re: Help with emptytags in xml.vim

2006-10-05 Thread Kevin Old

On 10/5/06, A.J.Mechelynck <[EMAIL PROTECTED]> wrote:

Kevin Old wrote:
> Hello all,
>
> I'm using the xml.vim plugin
> (http://www.vim.org/scripts/script.php?script_id=1397) and have it
> working well, but am trying to set a percent tag <% %> (used with
> HTML::Mason) as an emptytag.
>
> Here's the line in my .vimrc:
>
> let
> 
g:emptyTags='^\(img\|input\|param\|frame\|br\|hr\|meta\|link\|base\|area\|TMPL_VAR\|TMPL_INCLUDE\|%\)$'
>
>
> All of the tags act as they should and do not try to close except for
> some weird issue with the % tag.
>
> Here's what happens.  In HTML::Mason code I can print a variable like
> this <% $variable %>.  This works fine.  But if I try to use this with
> an object there is a problem.
>
> I type the following:
> <% $obj->
> but when I enter the ">" xml.vim adds a closing tag, so it now looks
> like this:
> <% $obj->
>
> It shouldn't add the  as % is in the emptytags definition above.
>
> I can't seem to figure out why this is happening.
>
> Any help is appreciated!
>
> Thanks,
> Kevin

The > of -> is seen as ending the (opening) <% tag, and since it is preceded
by neither / nor % the plugin thinks that a closing tag is missing.

Try using <% $obj-> instead (i.e. replacing > by >). Then you will enter
%> somewhat later on, to end the tag.


Best regards,
Tony.



Hi Tony,

I can't use > in place of the > - I'm writing perl, not html. The
<% %> tags basically do a "print $obj->obj_var" for me if I used it
like this <% $obj->obj_var %>.

Kevin
--
Kevin Old
[EMAIL PROTECTED]


Help with emptytags in xml.vim

2006-10-05 Thread Kevin Old

Hello all,

I'm using the xml.vim plugin
(http://www.vim.org/scripts/script.php?script_id=1397) and have it
working well, but am trying to set a percent tag <% %> (used with
HTML::Mason) as an emptytag.

Here's the line in my .vimrc:

let 
g:emptyTags='^\(img\|input\|param\|frame\|br\|hr\|meta\|link\|base\|area\|TMPL_VAR\|TMPL_INCLUDE\|%\)$'

All of the tags act as they should and do not try to close except for
some weird issue with the % tag.

Here's what happens.  In HTML::Mason code I can print a variable like
this <% $variable %>.  This works fine.  But if I try to use this with
an object there is a problem.

I type the following:
<% $obj->
but when I enter the ">" xml.vim adds a closing tag, so it now looks like this:
<% $obj->

It shouldn't add the  as % is in the emptytags definition above.

I can't seem to figure out why this is happening.

Any help is appreciated!

Thanks,
Kevin
--
Kevin Old
[EMAIL PROTECTED]


Re: Perl::Tags (Was: perlcomplete.vim -- anyone working on this?

2006-09-28 Thread Kevin Old

I've installed Perl::Tags from cpan and setup ftplugin/perl.vim like
the docs.  I loaded a perl script to see how Perl::Tags worked and
nothing happened.  I verified it was being loaded by :scriptnames and
it was.  I started writing some perl code and nothing happened.

How do I execute the tags?  There's no docs on "How to use it".

Any help is appreciated!

Kevin

On 7/27/06, Dr Bean <[EMAIL PROTECTED]> wrote:

On Fri, 21 Jul 2006, Hakim Cassimally wrote:

> Have you got PERL5LIB set to look in lib/ and t/ ?
> Module::Locate defaults to looking at @INC.
> You could set this in your environment variables.

Rather than this alternative, I like the next one:

> Of course, it would be nice if Perl::Tags would look at:
>   use lib qw(  );
> declarations and add those to where it looks for modules...

I was able to do this with a parser in a subclass of
Perl::Tags::Naive, but it just rewrites @INC.

> By the way, Dr Bean, if you'd like commit access to the
> repo at http://greenokapi.net/svn/code/Perl-Tags/ just
> email me the output of htpasswd and I'll add to the
> auth file :-)

I subclassed Naive with some parsers to tag some Spiffy
things.

What else would it nice to be able to tag? Sometimes I find
myself wanting to know where a method is invoked.

> On 21/07/06, Dr Bean <[EMAIL PROTECTED]> wrote:
> >On Wed, 12 Jul 2006, Dr Bean wrote:

> >This autocommand refreshes the tags file when you write, but the
> >tags you have last written are the last ones you want to jump
> >to, so I don't think it is much use.

> >augroup perltags
> >au!

> >autocmd BufWritePost *.pm,*.pl call s:do_tags(expand('%'))

autocmd BufRead,BufWritePost *.pm,*.pl call s:do_tags(expand('%'))

This is more important, because when you start editing another
file in another buffer you want tags to be created for it.

> >augroup END

--
Dr Bean  Experience is the best teacher because it
 gives the test first & the lesson after.
 --From Martin Pauly




--
Kevin Old
[EMAIL PROTECTED]


Re: Restore cursor to last line not working in Vim 7

2006-06-09 Thread Kevin Old

On 6/7/06, Charles E Campbell Jr <[EMAIL PROTECTED]> wrote:

Kevin Old wrote:

> On 6/7/06, Charles E Campbell Jr <[EMAIL PROTECTED]> wrote:
>
>> Check out tip http://vim.sourceforge.net/tips/tip.php?tip_id=80 --
>> perhaps that'll help.
>
>
> Thanks for this, but I still don't understand.
>
> I've set my viminfo in .vimrc to:
>
> viminfo='20,"50
>
> and it doesn't take me back to the line.  This is exactly how it was
> set agains Vim 6.3.
>
>
>
> I've read all the docs, but still for some weird reason, don't get why
> it's not doing what I want it to.

The viminfo setting is not the only thing it says to do!  Quoting the
first example:

|  set viminfo='10,\"100,:20,%,n~/.viminfo
  au BufReadPost * if line("'\"") > 0|if line("'\"") <=
line("$")|exe("norm '\"")|else|exe "norm $"|endif|endif

|
|That autocmd is needed!


Thanks Chip!  Please disregard my last post.  I applied the autocmd
and it worked like it should.

Thanks again for all your help,
Kevin
--
Kevin Old
[EMAIL PROTECTED]


Re: Restore cursor to last line not working in Vim 7

2006-06-09 Thread Kevin Old

On 6/7/06, Benji Fisher <[EMAIL PROTECTED]> wrote:

On Wed, Jun 07, 2006 at 11:53:40AM -0700, Yegappan Lakshmanan wrote:
>
> In Vim 6.3, either you sourced the vimrc_example.vim file or the
> system vimrc file in your system was defining the autocmd.

 I suspect that Yegappan and Tony are right.  I will go further and
guess that you installed Vim 6.3 from an RPM or some other binary
distribution, but compiled vim 7.0 yourself.


Hi Benji,

Yes, you are correct.  However, I have a very thorough vimrc file and
have added the following to try and restore this functionality:

set viminfo='20,\"50

Yes, it is being loaded, and I've verified by running :set viminfo
that it is set to what is defined in my local vimrc file.

Even though my file position info is saved in my viminfo file it does
not restore my cursor position to anywhere but the first line.

Thanks for your help,
Kevin
--
Kevin Old
[EMAIL PROTECTED]


Re: Restore cursor to last line not working in Vim 7

2006-06-07 Thread Kevin Old

On 6/7/06, Charles E Campbell Jr <[EMAIL PROTECTED]> wrote:

Kevin Old wrote:

> In version 6.3 (and as far as I can remember in Vim versions) it would
> return my cursor to the line I was at when I saved a file the next
> time I opened that file.
>
> It now returns me to the beginning of the file in Vim 7.


Check out tip http://vim.sourceforge.net/tips/tip.php?tip_id=80 --
perhaps that'll help.

Regards,
Chip Campbell




Hi Charles,

Thanks for this, but I still don't understand.

I've set my viminfo in .vimrc to:

viminfo='20,"50

and it doesn't take me back to the line.  This is exactly how it was
set agains Vim 6.3.

I've read all the docs, but still for some weird reason, don't get why
it's not doing what I want it to.

Any help is appreciated,
Kevin
--
Kevin Old
[EMAIL PROTECTED]


Re: Restore cursor to last line not working in Vim 7

2006-06-07 Thread Kevin Old

On 6/7/06, Tim Chase <[EMAIL PROTECTED]> wrote:

> Thanks Tim.  I've never edited settings for viminfo, but I've attached

:set viminfo


Sorry, had never needed to look at my viminfo settings until now.

Here's the options running under 6.3:
viminfo='20,"50

Here's the options running under 7:
viminfo='20,<50,s10,h

I see the differences (obviously), but don't understand what they mean.

Thanks for your help,
Kevin
--
Kevin Old
[EMAIL PROTECTED]


Re: Restore cursor to last line not working in Vim 7

2006-06-07 Thread Kevin Old

On 6/7/06, Tim Chase <[EMAIL PROTECTED]> wrote:

This would be where I'd start...comparing your old 'viminfo'
setting with your new one.


Thanks Tim.  I've never edited settings for viminfo, but I've attached
my viminfo's for both 6.3 and 7.  There are File marks in the viminfo
7 file, but it's not using them.  Read the stuff in :help viminfo, but
am unclear on what I need to set in .vimrc to get it to use them?

Any help is appreicated,
Kevin
--
Kevin Old
[EMAIL PROTECTED]
# This viminfo file was generated by Vim 7.0.
# You may edit it if you're careful!

# Value of 'encoding' when this file was written
*encoding=utf-8


# hlsearch on (H) or off (h):
~h
# Last Search Pattern:
~MSle0~/createTextNode

# Last Substitute Search Pattern:
~MSle0&\]

# Last Substitute String:
$

# Command Line History (newest to oldest):
:q!
:help viminfo
:viminfo
:w
:help cursor
:help restore
:help restore-cursor
:q
:help 
:q!\
:!
:help http
:help url
:q!~
:set ruler
:.
:help
:help line
:help column
:q!i

# Search String History (newest to oldest):
? ^\d\{3}\/
?/>
?/col:q!
? ^\d\{-}\/
?/createTextNode
?/added
?/ips
?/UPDATE
?/U
? \]
? \[
? [//g
? [A-Z]
?/\"dbo\"\.
?/Selection
?/ClassName
?/libmad
?/loaded
? ^"=
?/init

# Expression History (newest to oldest):

# Input Line History (newest to oldest):
@pre
@test
@textarea
@textarea id="thetest" cols="80"

# Input Line History (newest to oldest):

# Registers:
"0  LINE0

""1 LINE0

"2  LINE0

"3  LINE0
:help  -:go up dir  D:delete  R:rename  s:sort-by  
x:exec
" 

../
./
DBICSchemamodel.pm
"-  CHAR0
e

# File marks:
'0  1  0  ~/.viminfo
'1  127  4  ~/.viminfo
'2  17  0  ~/jsprettyprinter.html
'3  16  0  ~/jsprettyprinter.html
'4  68  0  ~/projects/encmymsg/lib/encmymsg/C/Root.pm
'5  1  0  ~/projects/encmymsg/lib/encmymsg/C/Root.pm
'6  40  0  ~/projects/encmymsg/lib/encmymsg.pm
'7  7  77  ~/projects/encmymsg/lib/encmymsg
'8  7  6  ~/projects/encmymsg/root/static/index.html
'9  18  0  /tmp/BIOAdmin/script/bioadmin_cgi.pl

# Jumplist (newest first):
-'  1  0  ~/.viminfo
-'  127  4  ~/.viminfo
-'  320  0  ~/.viminfo
-'  17  0  ~/jsprettyprinter.html
-'  16  0  ~/jsprettyprinter.html
-'  1  0  ~/jsprettyprinter.html
-'  68  0  ~/projects/encmymsg/lib/encmymsg/C/Root.pm
-'  1  0  ~/projects/encmymsg/lib/encmymsg/C/Root.pm
-'  40  0  ~/projects/encmymsg/lib/encmymsg.pm
-'  1  0  ~/projects/encmymsg/lib/encmymsg.pm
-'  7  77  ~/projects/encmymsg/lib/encmymsg
-'  8  0  ~/projects/encmymsg/lib/encmymsg
-'  1  0  ~/projects/encmymsg/lib/encmymsg
-'  7  6  ~/projects/encmymsg/root/static/index.html
-'  5  10  ~/projects/encmymsg/root/static/index.html
-'  2  0  ~/projects/encmymsg/root/static/index.html
-'  1  0  ~/projects/encmymsg/root/static/index.html
-'  18  0  /tmp/BIOAdmin/script/bioadmin_cgi.pl
-'  1  0  /tmp/BIOAdmin/script/bioadmin_cgi.pl
-'  1  0  ~/projects/testicrud/lib/DBSchema.pm
-'  8  0  ~/projects/testicrud/lib/DBSchema
-'  1  0  ~/projects/testicrud/lib/DBSchema
-'  1  0  /usr/local/tt2/examples/lib/menu
-'  1  0  /usr/local/tt2/examples/ttree.cfg
-'  1  0  /usr/local/tt2/templates/html/menu
-'  1  0  /usr/local/tt2/templates/html/html
-'  1  0  ~/projects/testapp/script/lighttpd.conf
-'  2  0  ~/projects/BIOAdmin/script/cd
-'  1  0  ~/projects/BIOAdmin/script/cd
-'  1  0  ~/projects/kdorails/Rakefile
-'  1  0  ~/tmpscripts/testdateregex.pl
-'  10  36  ~/tmpscripts/testdateregex.pl
-'  12  6  ~/tmpscripts/testdateregex.pl
-'  5  51  ~/tmpscripts/testdateregex.pl
-'  24  0  ~/bizjdocs/mysql_samples.sql
-'  1  0  ~/bizjdocs/mysql_samples.sql
-'  50  0  ~/qref.txt
-'  1  0  ~/qref.txt
-'  39  0  ~/.vimrc
-'  29  0  ~/.vimrc
-'  60  0  ~/.vimrc
-'  1  0  ~/.vimrc
-'  5  0  ~/July06Web.csv
-'  1  0  ~/July06Web.csv
-'  1  0  ~/bin/mk
-'  1  0  ~/projects/mpr/Makefile.PL
-'  1  0  ~/projects/mpr/Changes
-'  1  0  ~/projects/mpr/README
-'  11  0  ~/projects/mpr/lib/mpr/C/Root.pm
-'  1  0  ~/projects/mpr/lib/mpr/C/Root.pm
-'  40  0  ~/projects/mpr/lib/mpr.pm
-'  1  0  ~/projects/mpr/lib/mpr.pm
-'  1  0  ~/projects/mpr/mpr.yml
-'  21  0  ~/projects/testicrud/lib/testicrud/Model/DBICSchemamodel.pm
-'  1  0  ~/projects/testicrud/lib/testicrud/Model/DBICSchemamodel.pm
-'  1  0  ~/projects/testicrud/lib/testicrud/View/TT.pm
-'  100  0  ~/projects/testicrud/lib/testicrud/Controller/User.pm
-'  1  0  ~/projects/testicrud/lib/testicr

Restore cursor to last line not working in Vim 7

2006-06-07 Thread Kevin Old

Hello everyone,

In version 6.3 (and as far as I can remember in Vim versions) it would
return my cursor to the line I was at when I saved a file the next
time I opened that file.

It now returns me to the beginning of the file in Vim 7.

I looked at :help restore-position, but that doesn't do it by default.

The weird thing is that before I never had to set anything special for
it to do it.  It even worked if I didn't have a .vimrc.

Anyone else experiencing this?  Any ideas how to fix it?

Thanks,
Kevin
--
Kevin Old
[EMAIL PROTECTED]


perlcomplete.vim -- anyone working on this?

2006-05-09 Thread Kevin Old

Hello,

I was shocked that there wasn't a perlcomplete.vim in the source and
would like to create one or help someone who's writing one.

Contact me if I an be of help,
Kevin
--
Kevin Old
[EMAIL PROTECTED]