Re: OT: Vi in a browser... && Re: VimWiki

2007-06-05 Thread Ben Kim



Just stumbled across this link:
http://gpl.internetconnection.net/vi/
for a basic implementation of Vi, authored in JavaScript.


With no desire to rekindle the debate, I just thought they might make a 
good match. In fact I could also use it for 
my wiki sites... if available. 
Just a quick thought.



Regards,

Ben K.
Developer
http://benix.tamu.edu


RE: OT: Vi in a browser...

2007-06-04 Thread Hari Krishna Dara

On Mon, 4 Jun 2007 at 11:27am, Gene Kwiecinski wrote:

> Just getting to email now, so this is essentially a consolidated reply
> to all who answered...
>
>
>>> Speaking of which, is there any quicker way to visually select the
>>> entire file, analogous to ^A in other systems?
>
>> To copy the entire file to the system clipboard, you can do:
>>  :%y+
>> Rpelace y with d if you want to cut instead of copy.
>> Replace + with * if you want to use middle-click to paste (on X11.)
>
> That's about the shortest I could come up with, ":%d+", to do what I
> want, but still not quite what I was looking for.  I was kindasorta
> expecting a normal-mode solution, like 'gg*V' or something, to avoid
> even toggling the shift key all that much (think "baud" vs "bps").
>
> The only thing I really use it for is to c&p from LookOut's email to
> 'vim', then back again.  So I ^A the entire reply, dump it into a new
> 'vim' window, edit it to insert a new quotelevel, etc., then want to
> "^A" it to get it back into LO.  But it's repetitive/frequent enough to
> make me want to shorten the command further.
>
> Ain't "hung up" on visual mode or anything (hi Tim!), it's just that
> when I don't want headers at the top, I can start from the bottom ('G'),
> make my way to the top in visual ('1G'), then down my way past the
> headers to *not* grab them when putting it all back.  Or v/v if I want
> to skip the signature.  Etc.
>
> The 'vim' instance used to do the editing is going to disappear
> immediately after, so I'm not concerned about cut vs copy, etc.
> Everything goes into the "clipboard", then dumped back into LO's reply
> window, so a plain ':%d' won't work.
>
>
> In a similar vein, I was never much on "visual" vs *real* 'vi' commands,
> but it does come in handy to delete subroutines, etc.  Eg, for the
> format
>
>   sub sub1(){
>   ...
>   }
>
>   sub sub2(){
>   ...
>   }
>
> all you need to do it find the initial "sub", then "V$%jj" to grab the
> whole thing, and delete it, copy it, cut it, etc.  Go into visual,
> end-of-line (for the leading '{'), '%' (for the matching '}'), down a
> coupla lines to grab trailing whitespace, then bam!, it's gone.  And
> it's a visual confirmation to make sure you don't go nuts and delete
> more than you intended.
>
> Point being that for some operations, visual mode is a lot more
> reassuring.

Have you looked at the below Vim tip?
http://www.vim.org/tips/tip.php?tip_id=805

Read through the comments as well as the original tip has been improved
over a few iterations in the comments.

-- 
Hari


   
Ready
 for the edge of your seat? 
Check out tonight's top picks on Yahoo! TV. 
http://tv.yahoo.com/


RE: OT: Vi in a browser...

2007-06-04 Thread Gene Kwiecinski
Just getting to email now, so this is essentially a consolidated reply
to all who answered...


>>Speaking of which, is there any quicker way to visually select the
>>entire file, analogous to ^A in other systems?

>To copy the entire file to the system clipboard, you can do:
>   :%y+
>Rpelace y with d if you want to cut instead of copy.
>Replace + with * if you want to use middle-click to paste (on X11.)

That's about the shortest I could come up with, ":%d+", to do what I
want, but still not quite what I was looking for.  I was kindasorta
expecting a normal-mode solution, like 'gg*V' or something, to avoid
even toggling the shift key all that much (think "baud" vs "bps").

The only thing I really use it for is to c&p from LookOut's email to
'vim', then back again.  So I ^A the entire reply, dump it into a new
'vim' window, edit it to insert a new quotelevel, etc., then want to
"^A" it to get it back into LO.  But it's repetitive/frequent enough to
make me want to shorten the command further.

Ain't "hung up" on visual mode or anything (hi Tim!), it's just that
when I don't want headers at the top, I can start from the bottom ('G'),
make my way to the top in visual ('1G'), then down my way past the
headers to *not* grab them when putting it all back.  Or v/v if I want
to skip the signature.  Etc.

The 'vim' instance used to do the editing is going to disappear
immediately after, so I'm not concerned about cut vs copy, etc.
Everything goes into the "clipboard", then dumped back into LO's reply
window, so a plain ':%d' won't work.


In a similar vein, I was never much on "visual" vs *real* 'vi' commands,
but it does come in handy to delete subroutines, etc.  Eg, for the
format

sub sub1(){
...
}

sub sub2(){
...
}

all you need to do it find the initial "sub", then "V$%jj" to grab the
whole thing, and delete it, copy it, cut it, etc.  Go into visual,
end-of-line (for the leading '{'), '%' (for the matching '}'), down a
coupla lines to grab trailing whitespace, then bam!, it's gone.  And
it's a visual confirmation to make sure you don't go nuts and delete
more than you intended.

Point being that for some operations, visual mode is a lot more
reassuring.


Re: OT: Vi in a browser...

2007-06-03 Thread panshizhu
"Edward L. Fox" <[EMAIL PROTECTED]> 写于 2007-06-04 10:38:30:
> Hi Pan,
> On 6/4/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> > [...]
> > When this is just a pain, why not just map ^A to your 1GVG ?
> >
>
> Well, personally I think the thing you should do is getting familiar
> with Vi-like editing styles, not mapping Vim to adapter your existing
> editing styles.
This is just an example, since the "Gene Kwiecinski" feels selete all a
pain. You may say he should not use "select-all", but it is very likely
that the similar senaro occurs for other keystrokes. I had many other
examples for that.

> but to me, combination keys with Ctrl is much more
> difficult to press than combination keys with Shift only.
Your mind may vary, but I feel no difference between press Shift, Alt and
Ctrl. I feel better only when I don't have to press any "chord" keys like
"ctrl,alt,shift" at all.

So what I had do is:
nnoremap ; :

With this map, I will not have to press the "Shift+:" to enter
command-mode, just the ";", and this saves me "thousands of keystrokes" and
I can use vim at least 30% faster.

You may say: "you should not use semicolon for entering command-mode, you
should follow the vi-way to entering command-mode by shift-colon."  But
frankly speaking I don't think there's any sensible reason not using
semicolon as the shortcut of entering command-mode.  In this case,
following the vi rule has no advantage and use shift-colon is solely
inefficient.

Everyone may have a completely different set of preferences on using vim,
since vim is designed to be a fullly-cumstomizable editor, if the
user-preferences such as .vimrc and plugins and color-schemes are not
loaded, chances are that the re-invented vi-clone inside browser has few
supporters.

--
Sincerely, Pan, Shi Zhu. ext: 2606

Re: OT: Vi in a browser...

2007-06-03 Thread Edward L. Fox

Hi Pan,

On 6/4/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:

[...]
When this is just a pain, why not just map ^A to your 1GVG ?

So this come back to the topic:

If anyone approaching to emulate vim in a browser without actually calling
vim, will it reads your .vimrc and to know you had mapped ^A to
1GVG ? unlikely.


Well, personally I think the thing you should do is getting familiar
with Vi-like editing styles, not mapping Vim to adapter your existing
editing styles.

For example, in the other editors, if you want to copy the whole
article into the clipboard, you should first select all, then copy the
selected text into the clipboard. In Vim, "select all" is a pain.  So
you mapped it to an easier shortcut.

But... But do we really need to select all first before copying the
text into the clipboard? Of course not. You can use "yank + motion" to
do it, like this: gg"+yG, it only costs 6 keystrokes. You can also use
ex command to do it, like this: :%y+, it only costs 4 keystrokes.

Well, maybe you would say, in the other editor,  is only 2
keystrokes. Yes, but to me, combination keys with Ctrl is much more
difficult to press than combination keys with Shift only. So I prefer
:%y+ to . By the way, that's the primary reason that I
dislike Emacs.


Then I don't think it makes too much sense reinventing a vi-like inside
javascript.

—— After all, javascript *is* slow and I cannot afford to pay the overhead
in any serious application. In most web-sites, disabling javascript is just
something like upgrade my CPU from P4 to Core 2 Duo.


As an experienced AJAX developer (:-P), I would responsibly tell you,
update a few fields inside a web page with AJAX is much much faster
than entirely refresh the page, especially when this refreshing
happens frequently.


--
Sincerely, Pan, Shi Zhu. ext: 2606


Regards,

Edward L. Fox


RE: OT: Vi in a browser...

2007-06-03 Thread panshizhu
"Gene Kwiecinski" <[EMAIL PROTECTED]> 写于 2007-06-02 00:01:21:
> >Personally, I don't agree with you. When editing short text
> >items on web pages, I feel that the overhead of copying/pasting
> >back and forth from vim is too much. I am currently using the
>
> Speaking of which, is there any quicker way to visually select the
> entire file, analogous to ^A in other systems?  I have to essentially do
>
>1GVG
>
> to stick everything into the scratchpad/clipboard/whatever to dump it
> back into the item from whence it originally came, and that's just a
> pain.  Well, not so much a pain as an annoying itch I can't quite reach.

When this is just a pain, why not just map ^A to your 1GVG ?

So this come back to the topic:

If anyone approaching to emulate vim in a browser without actually calling
vim, will it reads your .vimrc and to know you had mapped ^A to
1GVG ? unlikely.

Then I don't think it makes too much sense reinventing a vi-like inside
javascript.

―― After all, javascript *is* slow and I cannot afford to pay the overhead
in any serious application. In most web-sites, disabling javascript is just
something like upgrade my CPU from P4 to Core 2 Duo.
--
Sincerely, Pan, Shi Zhu. ext: 2606

Re: OT: Vi in a browser...

2007-06-01 Thread Yakov Lerner

On 5/30/07, Tim Chase <[EMAIL PROTECTED]> wrote:

Just stumbled across this link:

http://gpl.internetconnection.net/vi/

for a basic implementation of Vi, authored in JavaScript.  Sick,
sick, sick.  So just in case you're on a foreign computer that
doesn't have vi/vim installed, and you need a fix, you can get it
via the web. :)


But you can't read/save disk files out of javascript, can you ?
I thought javascript can't.

Yakov


Re: OT: Vi in a browser...

2007-06-01 Thread fREW

On 6/1/07, Tim Chase <[EMAIL PROTECTED]> wrote:

> Speaking of which, is there any quicker way to visually select the
> entire file, analogous to ^A in other systems?  I have to essentially do
>
>   1GVG
>
> to stick everything into the scratchpad/clipboard/whatever to dump it
> back into the item from whence it originally came, and that's just a
> pain.  Well, not so much a pain as an annoying itch I can't quite reach.
>
> I was thinking something along the lines of
>
>   %V
>
> but that obviously won't work.  :)

You're so close, it could bite you :)  It looks like you're
getting hung up on expecting the solution to need visual mode
rather than just using Ex commands.

I frequently use

:%d

or if I need it to go to the system clipboard,

:%d*
:%d+

I use these (and their "y"anking counterparts, ":%y") so
regularly that they're ingrained muscle-memory.

Because the y/d Ex command takes any range, I also regularly use

:.,$d

to do just from my current line to the EOF, or

:1,.d

to pull from the first line through the current line.

-tim







Awesome.  Tim is our ex friend.  Or something?

--
-fREW


Re: OT: Vi in a browser...

2007-06-01 Thread A.J.Mechelynck

Gene Kwiecinski wrote:

Personally, I don't agree with you. When editing short text
items on web pages, I feel that the overhead of copying/pasting
back and forth from vim is too much. I am currently using the


Speaking of which, is there any quicker way to visually select the
entire file, analogous to ^A in other systems?  I have to essentially do

1GVG

to stick everything into the scratchpad/clipboard/whatever to dump it
back into the item from whence it originally came, and that's just a
pain.  Well, not so much a pain as an annoying itch I can't quite reach.

I was thinking something along the lines of

%V

but that obviously won't work.  :)




It may depend on what you want to do with the selection: see the commands 
":yank", ":put", "delete", all of which accept a range and a register:


To copy the whole file to the clipboard:

:%y+

To cut (delete) the whole file to the clipboard (not very useful for the whole 
file, but it may be interesting for a different range):


:%d+

To paste the clipboard after the last line:

:$put+

To paste the clipboard before the first line:

:0put+

To paste the clipboard linewise after the current line:

:put+

Without the + at the end, all these act on the default ("unnamed") register.


Best regards,
Tony.
--
   Bravely bold Sir Robin, rode forth from Camelot,
   He was not afraid to die, Oh Brave Sir Robin,
   He was not at all afraid to be killed in nasty ways
   Brave, brave, brave, brave Sir Robin.
 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD


Re: OT: Vi in a browser...

2007-06-01 Thread Tobia
Gene Kwiecinski wrote:
> Speaking of which, is there any quicker way to visually select the
> entire file, analogous to ^A in other systems?

To copy the entire file to the system clipboard, you can do:

:%y+

Rpelace y with d if you want to cut instead of copy.
Replace + with * if you want to use middle-click to paste (on X11.)


Tobia


Re: OT: Vi in a browser...

2007-06-01 Thread Tim Chase
> Speaking of which, is there any quicker way to visually select the
> entire file, analogous to ^A in other systems?  I have to essentially do
> 
>   1GVG
> 
> to stick everything into the scratchpad/clipboard/whatever to dump it
> back into the item from whence it originally came, and that's just a
> pain.  Well, not so much a pain as an annoying itch I can't quite reach.
> 
> I was thinking something along the lines of
> 
>   %V
> 
> but that obviously won't work.  :)

You're so close, it could bite you :)  It looks like you're
getting hung up on expecting the solution to need visual mode
rather than just using Ex commands.

I frequently use

:%d

or if I need it to go to the system clipboard,

:%d*
:%d+

I use these (and their "y"anking counterparts, ":%y") so
regularly that they're ingrained muscle-memory.

Because the y/d Ex command takes any range, I also regularly use

:.,$d

to do just from my current line to the EOF, or

:1,.d

to pull from the first line through the current line.

-tim






RE: OT: Vi in a browser...

2007-06-01 Thread Gene Kwiecinski
>Personally, I don't agree with you. When editing short text
>items on web pages, I feel that the overhead of copying/pasting
>back and forth from vim is too much. I am currently using the

Speaking of which, is there any quicker way to visually select the
entire file, analogous to ^A in other systems?  I have to essentially do

1GVG

to stick everything into the scratchpad/clipboard/whatever to dump it
back into the item from whence it originally came, and that's just a
pain.  Well, not so much a pain as an annoying itch I can't quite reach.

I was thinking something along the lines of

%V

but that obviously won't work.  :)


Re: OT: Vi in a browser...

2007-06-01 Thread Yongwei Wu

Hi Thomas,

On 01/06/07, Thomas Svensen <[EMAIL PROTECTED]> wrote:

> -Original Message-
> From: Yongwei Wu [mailto:[EMAIL PROTECTED]
> Sent: 1. juni 2007 07:32
> To: vim@vim.org
> Subject: Re: OT: Vi in a browser...
>
> On 31/05/07, A.J.Mechelynck <[EMAIL PROTECTED]> wrote:
> > Edward L. Fox wrote:
> > [...]
> > > A friend told me that he is developing a Firefox addon to emulate
the
> > > Vi/Vim behaviors in all text areas in Firefox, without launching
> > > external applications. I'm looking forward to it.
> > [...]
> >
> > I don't think any "Vim extension" aiming at reproducing Vim's
behaviour
> > without actually calling it, will be able to come near the result of
the
> > gazillions of man-hours Bram (with a few others) has put and is
still
> putting
> > into it. Many browsers are able to interact with "any external
editor"
> (such
> > as true-blue Vim) these days, which also means that any bugfix or
> improvement
> > to Vim gets reflected in the editing behaviour of the browser. Or
you
> could
> > always write the text in Vim, then use the clipboard to paste it
into
> the
> > browser, even with no special "external editor" function.
>
> Agreed. Maybe Edward should persuade his friend to use the OLE
> interface of Vim instead.
>
> Yongwei
>
> --
> Wu Yongwei
> URL: http://wyw.dcweb.cn/

Personally, I don't agree with you. When editing short text items on web
pages, I feel that the overhead of copying/pasting back and forth from
vim is too much. I am currently using the "View Source With"-addon,
which is great, but I would actually prefer a limited vi-implementation
for use inside Firefox.


I must have been unclear. I meant to agree with the part `I don't
think any "Vim extension" aiming at reproducing Vim's behaviour
without actually calling it, will be able to come near the result of
the gazillions of man-hours Bram (with a few others) has put and is
still putting into it'. So I suggested some embedded Vim inside
Firefox using an add-on.



So, Edward, please post to this list if/when your friend has something
that we may try out :-)


Best regards,

Yongwei

--
Wu Yongwei
URL: http://wyw.dcweb.cn/


RE: OT: Vi in a browser...

2007-06-01 Thread Thomas Svensen
> -Original Message-
> From: Yongwei Wu [mailto:[EMAIL PROTECTED]
> Sent: 1. juni 2007 07:32
> To: vim@vim.org
> Subject: Re: OT: Vi in a browser...
> 
> On 31/05/07, A.J.Mechelynck <[EMAIL PROTECTED]> wrote:
> > Edward L. Fox wrote:
> > [...]
> > > A friend told me that he is developing a Firefox addon to emulate
the
> > > Vi/Vim behaviors in all text areas in Firefox, without launching
> > > external applications. I'm looking forward to it.
> > [...]
> >
> > I don't think any "Vim extension" aiming at reproducing Vim's
behaviour
> > without actually calling it, will be able to come near the result of
the
> > gazillions of man-hours Bram (with a few others) has put and is
still
> putting
> > into it. Many browsers are able to interact with "any external
editor"
> (such
> > as true-blue Vim) these days, which also means that any bugfix or
> improvement
> > to Vim gets reflected in the editing behaviour of the browser. Or
you
> could
> > always write the text in Vim, then use the clipboard to paste it
into
> the
> > browser, even with no special "external editor" function.
> 
> Agreed. Maybe Edward should persuade his friend to use the OLE
> interface of Vim instead.
> 
> Yongwei
> 
> --
> Wu Yongwei
> URL: http://wyw.dcweb.cn/

Personally, I don't agree with you. When editing short text items on web
pages, I feel that the overhead of copying/pasting back and forth from
vim is too much. I am currently using the "View Source With"-addon,
which is great, but I would actually prefer a limited vi-implementation
for use inside Firefox.

So, Edward, please post to this list if/when your friend has something
that we may try out :-)

Thomas Svensen
Senior Solutions Engineer
FAST


Re: OT: Vi in a browser...

2007-05-31 Thread Yongwei Wu

On 31/05/07, A.J.Mechelynck <[EMAIL PROTECTED]> wrote:

Edward L. Fox wrote:
[...]
> A friend told me that he is developing a Firefox addon to emulate the
> Vi/Vim behaviors in all text areas in Firefox, without launching
> external applications. I'm looking forward to it.
[...]

I don't think any "Vim extension" aiming at reproducing Vim's behaviour
without actually calling it, will be able to come near the result of the
gazillions of man-hours Bram (with a few others) has put and is still putting
into it. Many browsers are able to interact with "any external editor" (such
as true-blue Vim) these days, which also means that any bugfix or improvement
to Vim gets reflected in the editing behaviour of the browser. Or you could
always write the text in Vim, then use the clipboard to paste it into the
browser, even with no special "external editor" function.


Agreed. Maybe Edward should persuade his friend to use the OLE
interface of Vim instead.

Yongwei

--
Wu Yongwei
URL: http://wyw.dcweb.cn/


Re: OT: Vi in a browser...

2007-05-31 Thread A.J.Mechelynck

Edward L. Fox wrote:
[...]

A friend told me that he is developing a Firefox addon to emulate the
Vi/Vim behaviors in all text areas in Firefox, without launching
external applications. I'm looking forward to it.

[...]

I don't think any "Vim extension" aiming at reproducing Vim's behaviour 
without actually calling it, will be able to come near the result of the 
gazillions of man-hours Bram (with a few others) has put and is still putting 
into it. Many browsers are able to interact with "any external editor" (such 
as true-blue Vim) these days, which also means that any bugfix or improvement 
to Vim gets reflected in the editing behaviour of the browser. Or you could 
always write the text in Vim, then use the clipboard to paste it into the 
browser, even with no special "external editor" function.


YMMV.


Best regards,
Tony.
--
   A cow comes flying over the battlements,  lowing aggressively.  The cow
   lands on GALAHAD'S PAGE, squashing him completely.
 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD


Re: OT: Vi in a browser...

2007-05-30 Thread Edward L. Fox

On 5/30/07, Tobias Klausmann <[EMAIL PROTECTED]> wrote:

[...]
as for the classic use case of wanting to edit textfields
vim-style (longer blog posts come to mind), I usually use MozEx,
an extension to FF, which allows to use any editor for such
things. It has more features but I don't use any of them.


Most of my Vimmers workmates recommend "It's All Text!" to me. So I
just gave up MozEx before I had a try on it.

A friend told me that he is developing a Firefox addon to emulate the
Vi/Vim behaviors in all text areas in Firefox, without launching
external applications. I'm looking forward to it.



I can definitely recommend it. Especially considering the
"splendid" UI of the ticket system I'm forced to use.

Regards,
Tobias


--
In the future, everyone will be anonymous for 15 minutes.



Shalom,

Edward L. Fox


Re: OT: Vi in a browser...

2007-05-30 Thread Tobias Klausmann
Hi! 

On Wed, 30 May 2007, Tim Chase wrote:
>  Just stumbled across this link:
> 
>  http://gpl.internetconnection.net/vi/
> 
>  for a basic implementation of Vi, authored in JavaScript.
>  Sick, sick, sick.  So just in case you're on a foreign
>  computer that doesn't have vi/vim installed, and you need a
>  fix, you can get it via the web. :)

as for the classic use case of wanting to edit textfields
vim-style (longer blog posts come to mind), I usually use MozEx,
an extension to FF, which allows to use any editor for such
things. It has more features but I don't use any of them.

I can definitely recommend it. Especially considering the
"splendid" UI of the ticket system I'm forced to use.

Regards,
Tobias


-- 
In the future, everyone will be anonymous for 15 minutes.