unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Viper: replacing text?
@ 2009-09-03 14:11 Elena
  2009-09-03 15:05 ` Lennart Borgman
                   ` (3 more replies)
  0 siblings, 4 replies; 17+ messages in thread
From: Elena @ 2009-09-03 14:11 UTC (permalink / raw)
  To: help-gnu-emacs

Hello,

how do I replace text with previous kill?

That is: I kill (or copy) a word, then travel to another word and I'd
like to replace the latter with the former. Currently I paste the
first word, move a character to the right and kill the second word,
but I don't think that's the faster way to do it.

Of course, I'm not talking about replacing text in the context of
search and replace.

Thanks.


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Viper: replacing text?
  2009-09-03 14:11 Viper: replacing text? Elena
@ 2009-09-03 15:05 ` Lennart Borgman
       [not found] ` <mailman.5945.1251990364.2239.help-gnu-emacs@gnu.org>
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 17+ messages in thread
From: Lennart Borgman @ 2009-09-03 15:05 UTC (permalink / raw)
  To: Elena; +Cc: help-gnu-emacs

On Thu, Sep 3, 2009 at 4:11 PM, Elena<egarrulo@gmail.com> wrote:
> Hello,
>
> how do I replace text with previous kill?
>
> That is: I kill (or copy) a word, then travel to another word and I'd
> like to replace the latter with the former. Currently I paste the
> first word, move a character to the right and kill the second word,
> but I don't think that's the faster way to do it.

It probably is since you have to tell Viper somehow what you want to replace.

However if you want to do it many times you may want to define a macro
or even a function for doing this.




^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Viper: replacing text?
       [not found] ` <mailman.5945.1251990364.2239.help-gnu-emacs@gnu.org>
@ 2009-09-03 15:21   ` Elena
  0 siblings, 0 replies; 17+ messages in thread
From: Elena @ 2009-09-03 15:21 UTC (permalink / raw)
  To: help-gnu-emacs

On 3 Set, 15:05, Lennart Borgman <lennart.borg...@gmail.com> wrote:
> On Thu, Sep 3, 2009 at 4:11 PM, Elena<egarr...@gmail.com> wrote:
> > Hello,
>
> > how do I replace text with previous kill?
>
> > That is: I kill (or copy) a word, then travel to another word and I'd
> > like to replace the latter with the former. Currently I paste the
> > first word, move a character to the right and kill the second word,
> > but I don't think that's the faster way to do it.
>
> It probably is since you have to tell Viper somehow what you want to replace.
>
> However if you want to do it many times you may want to define a macro
> or even a function for doing this.

Yes. I thought there was a way to tell Viper to replace movement
region with last killed or yanked text. Kinda like delete command
works ('dw', 'de', 'dG', etc.).



^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Viper: replacing text?
  2009-09-03 14:11 Viper: replacing text? Elena
  2009-09-03 15:05 ` Lennart Borgman
       [not found] ` <mailman.5945.1251990364.2239.help-gnu-emacs@gnu.org>
@ 2009-09-03 15:40 ` Sean Sieger
  2009-09-03 16:13   ` Lennart Borgman
       [not found] ` <mailman.5946.1251992506.2239.help-gnu-emacs@gnu.org>
  3 siblings, 1 reply; 17+ messages in thread
From: Sean Sieger @ 2009-09-03 15:40 UTC (permalink / raw)
  To: help-gnu-emacs

Elena <egarrulo@gmail.com> writes:

    That is: I kill (or copy) a word, then travel to another word and I'd
    like to replace the latter with the former. Currently I paste the
    first word, move a character to the right and kill the second word,
    but I don't think that's the faster way to do it.

You mean you can't
M-d
C-f (or wherever)
M-d
C-u 2 C-y
in Viper?

With all due respect, why do people use GNU/Emacs to imitate Vi?  I've
never understood it.  The original post seems to point to how Viper
diminishes the power of the Emacs environment.





^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Viper: replacing text?
       [not found] ` <mailman.5946.1251992506.2239.help-gnu-emacs@gnu.org>
@ 2009-09-03 15:58   ` Elena
  2009-09-03 17:00     ` Sean Sieger
  2009-09-03 17:01     ` Sean Sieger
  0 siblings, 2 replies; 17+ messages in thread
From: Elena @ 2009-09-03 15:58 UTC (permalink / raw)
  To: help-gnu-emacs

On 3 Set, 15:40, Sean Sieger <sean.sie...@gmail.com> wrote:
> Elena <egarr...@gmail.com> writes:
>
>     That is: I kill (or copy) a word, then travel to another word and I'd
>     like to replace the latter with the former. Currently I paste the
>     first word, move a character to the right and kill the second word,
>     but I don't think that's the faster way to do it.
>
> You mean you can't
> M-d
> C-f (or wherever)
> M-d
> C-u 2 C-y
> in Viper?
>
> With all due respect, why do people use GNU/Emacs to imitate Vi?  I've
> never understood it.  The original post seems to point to how Viper
> diminishes the power of the Emacs environment.

Oh, no! I just prefer modal editing.

Thank you for posting the command sequence, I'll bind it to an
available Viper mode sequence.



^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Viper: replacing text?
  2009-09-03 15:40 ` Sean Sieger
@ 2009-09-03 16:13   ` Lennart Borgman
  2009-09-03 16:38     ` Sean Sieger
       [not found]     ` <mailman.5955.1251995918.2239.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 17+ messages in thread
From: Lennart Borgman @ 2009-09-03 16:13 UTC (permalink / raw)
  To: Sean Sieger; +Cc: help-gnu-emacs

On Thu, Sep 3, 2009 at 5:40 PM, Sean Sieger<sean.sieger@gmail.com> wrote:
> Elena <egarrulo@gmail.com> writes:
>
>    That is: I kill (or copy) a word, then travel to another word and I'd
>    like to replace the latter with the former. Currently I paste the
>    first word, move a character to the right and kill the second word,
>    but I don't think that's the faster way to do it.
>
> You mean you can't
> M-d
> C-f (or wherever)
> M-d
> C-u 2 C-y
> in Viper?
>
> With all due respect, why do people use GNU/Emacs to imitate Vi?  I've
> never understood it.  The original post seems to point to how Viper
> diminishes the power of the Emacs environment.


Do you mean you want us to explain how this is done in Viper so you
can understand why we are using Viper?




^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Viper: replacing text?
  2009-09-03 16:13   ` Lennart Borgman
@ 2009-09-03 16:38     ` Sean Sieger
       [not found]     ` <mailman.5955.1251995918.2239.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 17+ messages in thread
From: Sean Sieger @ 2009-09-03 16:38 UTC (permalink / raw)
  To: help-gnu-emacs

Lennart Borgman <lennart.borgman@gmail.com> writes:

    Do you mean you want us to explain how this is done in Viper so you
    can understand why we are using Viper?

Not originally, but if that would help me understand, yes thank you.

But I guess where I'm coming from is the `GNU/Emacs v Vi' thing (I've
used Vi, and it seems like a cool text editor) and personally preferring
GNU/Emacs and then wondering why on Earth I would then want it to behave
like Vi.

Essentially.

Not dissimilar to why (?) why I wouldn't blend coffee beans when I want
to really know ... taste ... the difference in taste between coffee from
Sumatra and coffee from Puerto Rico.

Especially when I would lose a sequence like the one used in GNU/Emacs
to do what the original post was asking about.

Maybe, this is just one of those itches ... questions ... that can't be
scratched at the moment.





^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Viper: replacing text?
  2009-09-03 15:58   ` Elena
@ 2009-09-03 17:00     ` Sean Sieger
  2009-09-03 17:01     ` Sean Sieger
  1 sibling, 0 replies; 17+ messages in thread
From: Sean Sieger @ 2009-09-03 17:00 UTC (permalink / raw)
  To: help-gnu-emacs

Elena <egarrulo@gmail.com> writes:

    Oh, no! I just prefer modal editing.

Well now, I've never heard that phrase, `modal editing' (which may not
surprise you).





^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Viper: replacing text?
  2009-09-03 15:58   ` Elena
  2009-09-03 17:00     ` Sean Sieger
@ 2009-09-03 17:01     ` Sean Sieger
  1 sibling, 0 replies; 17+ messages in thread
From: Sean Sieger @ 2009-09-03 17:01 UTC (permalink / raw)
  To: help-gnu-emacs

Elena <egarrulo@gmail.com> writes:

    Thank you for posting the command sequence, I'll bind it to an
    available Viper mode sequence.

Shoot, I meant to say, `You're welcome,' in me previous post.  You're
welcome, Elena.





^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Viper: replacing text?
       [not found]     ` <mailman.5955.1251995918.2239.help-gnu-emacs@gnu.org>
@ 2009-09-03 19:38       ` Elena
  2009-09-03 21:53         ` Lennart Borgman
       [not found]         ` <mailman.5974.1252014851.2239.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 17+ messages in thread
From: Elena @ 2009-09-03 19:38 UTC (permalink / raw)
  To: help-gnu-emacs

On 3 Set, 18:38, Sean Sieger
> But I guess where I'm coming from is the `GNU/Emacs v Vi' thing (I've
> used Vi, and it seems like a cool text editor) and personally preferring
> GNU/Emacs and then wondering why on Earth I would then want it to behave
> like Vi.
>
> Essentially.

I understand.

IMO, comparing Vi and Emacs does not make sense. Vi is an editor,
Emacs is an environment. You can just compare Vi to the default
editing program run by Emacs. Emacs can also run a Vi-like editor
(Viper), if you like - I like so ;-)

Indeed Emacs allows you to run two editors at once! (Viper and the
default one)

BTW, I'm waiting for a pure Viper solution I'm sure Lennart is still
keeping for him ;-)


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Viper: replacing text?
  2009-09-03 19:38       ` Elena
@ 2009-09-03 21:53         ` Lennart Borgman
  2009-09-04  1:19           ` Sean Sieger
       [not found]           ` <mailman.5983.1252027190.2239.help-gnu-emacs@gnu.org>
       [not found]         ` <mailman.5974.1252014851.2239.help-gnu-emacs@gnu.org>
  1 sibling, 2 replies; 17+ messages in thread
From: Lennart Borgman @ 2009-09-03 21:53 UTC (permalink / raw)
  To: Elena; +Cc: help-gnu-emacs

On Thu, Sep 3, 2009 at 9:38 PM, Elena<egarrulo@gmail.com> wrote:
> On 3 Set, 18:38, Sean Sieger
>> But I guess where I'm coming from is the `GNU/Emacs v Vi' thing (I've
>> used Vi, and it seems like a cool text editor) and personally preferring
>> GNU/Emacs and then wondering why on Earth I would then want it to behave
>> like Vi.
>>
>> Essentially.
>
> I understand.
>
> IMO, comparing Vi and Emacs does not make sense. Vi is an editor,
> Emacs is an environment. You can just compare Vi to the default
> editing program run by Emacs. Emacs can also run a Vi-like editor
> (Viper), if you like - I like so ;-)
>
> Indeed Emacs allows you to run two editors at once! (Viper and the
> default one)
>
> BTW, I'm waiting for a pure Viper solution I'm sure Lennart is still
> keeping for him ;-)

I should keep my mouth shut ... ;-)

Now, since I did not this time, let us do a quick comparision with
Sean's suggestion, translating from Emacs default key sequences to
Viper dito:

   M-d
   C-f
   M-d
   C-u 2 C-y

You can do this in a very similar way in Viper (but I do not know if
it is actually worth the effort using and remembering "2P):

   dw (or de, dE, dW, db, dB)
   h
   dw
   "2P

I count it to 11 keyboard hits in Emacs and 8 in Viper... - though I
hardly dare to tell this ... ;-)

Someone may say I am wrong since " and P requires shift on most
keyboards so it is really 10 in Viper...

The real advantage with the Viper keys is in my opinion perhaps that
you use the keyboard keys you reach very fast, ie normal letters. At
least for me reaching Control and Meta is a bit slower.

However in the beginning getting used to the vi modal editing is a bit
hard. (There is a little Viper interactive tutorial, but unfortunately
RMS did not want it to be shipped with Emacs, no idea why now, I have
forgotten. I ship it with nXhtml instead.)

Note that you still have access to most of the Emacs key bindings in
Viper. They are still very useful for more complicated things, but
most Viper users probably never use M-d, C-f etc.




^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Viper: replacing text?
       [not found]         ` <mailman.5974.1252014851.2239.help-gnu-emacs@gnu.org>
@ 2009-09-03 22:51           ` Elena
  2009-09-04  8:02             ` Anselm Helbig
  0 siblings, 1 reply; 17+ messages in thread
From: Elena @ 2009-09-03 22:51 UTC (permalink / raw)
  To: help-gnu-emacs

On 3 Set, 23:53, Lennart Borgman
> Someone may say I am wrong since " and P requires shift on most
> keyboards so it is really 10 in Viper...
>
> The real advantage with the Viper keys is in my opinion perhaps that
> you use the keyboard keys you reach very fast, ie normal letters. At
> least for me reaching Control and Meta is a bit slower.

Me too.

>
> However in the beginning getting used to the vi modal editing is a bit
> hard.

I think the trick is: you should always be in Viper mode. Whenever you
enter Insert mode to enter text, you should hit Esc as soon as
possible. And swap that useless Caps Lock with Esc ;-)


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Viper: replacing text?
  2009-09-03 21:53         ` Lennart Borgman
@ 2009-09-04  1:19           ` Sean Sieger
       [not found]           ` <mailman.5983.1252027190.2239.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 17+ messages in thread
From: Sean Sieger @ 2009-09-04  1:19 UTC (permalink / raw)
  To: help-gnu-emacs

Lennart Borgman <lennart.borgman@gmail.com> writes:

    The real advantage with the Viper keys is in my opinion perhaps that
    you use the keyboard keys you reach very fast, ie normal letters. At
    least for me reaching Control and Meta is a bit slower.

Right.  In fact, when I referred to vi as a `cool' editor that is
exactly what I thought of as cool.  It was vi that made me think of the
editor as a `computer game' well worth becoming good at.  But whenever I
get that urge these days, it's gtypist that I turn to improve my touch
typing ... often thought a emacs.typ (gtypist's tutor files are .typ
files) with emacs key combinations---um, like the GNU/Emacs
Tutorial---would be worth building.

    However in the beginning getting used to the vi modal editing is a bit
    hard.

And now I get that phrase---I didn't know that modal editing was what I
was doing when I use vi.  Thank you, Lennart.





^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Viper: replacing text?
       [not found]           ` <mailman.5983.1252027190.2239.help-gnu-emacs@gnu.org>
@ 2009-09-04  7:58             ` Anselm Helbig
  2009-09-04 10:41               ` Sean Sieger
  0 siblings, 1 reply; 17+ messages in thread
From: Anselm Helbig @ 2009-09-04  7:58 UTC (permalink / raw)
  To: help-gnu-emacs

At Thu, 03 Sep 2009 21:19:14 -0400,
Sean Sieger <sean.sieger@gmail.com> wrote:
> 
> Lennart Borgman <lennart.borgman@gmail.com> writes:
> 
>     The real advantage with the Viper keys is in my opinion perhaps that
>     you use the keyboard keys you reach very fast, ie normal letters. At
>     least for me reaching Control and Meta is a bit slower.
> 
> Right.  In fact, when I referred to vi as a `cool' editor that is
> exactly what I thought of as cool.  It was vi that made me think of the
> editor as a `computer game' well worth becoming good at.  But whenever I
> get that urge these days, it's gtypist that I turn to improve my touch
> typing ... often thought a emacs.typ (gtypist's tutor files are .typ
> files) with emacs key combinations---um, like the GNU/Emacs
> Tutorial---would be worth building.

Did you ever play keywiz? 

  http://www.emacswiki.org/emacs/KeyWiz



-- 
Anselm Helbig 
mailto:anselm.helbig+news2009@googlemail.com


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Viper: replacing text?
  2009-09-03 22:51           ` Elena
@ 2009-09-04  8:02             ` Anselm Helbig
  2009-09-04  8:31               ` Elena
  0 siblings, 1 reply; 17+ messages in thread
From: Anselm Helbig @ 2009-09-04  8:02 UTC (permalink / raw)
  To: help-gnu-emacs

At Thu, 3 Sep 2009 15:51:22 -0700 (PDT),
Elena <egarrulo@gmail.com> wrote:
> 
> On 3 Set, 23:53, Lennart Borgman
> > Someone may say I am wrong since " and P requires shift on most
> > keyboards so it is really 10 in Viper...
> >
> > The real advantage with the Viper keys is in my opinion perhaps that
> > you use the keyboard keys you reach very fast, ie normal letters. At
> > least for me reaching Control and Meta is a bit slower.
> 
> Me too.
> 
> >
> > However in the beginning getting used to the vi modal editing is a bit
> > hard.
> 
> I think the trick is: you should always be in Viper mode. Whenever you
> enter Insert mode to enter text, you should hit Esc as soon as
> possible. And swap that useless Caps Lock with Esc ;-)

Nah, the leftmost key on the home row should always be bound to
Control. You can use C-[ for ESC. 8-)


-- 
Anselm Helbig 
mailto:anselm.helbig+news2009@googlemail.com


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Viper: replacing text?
  2009-09-04  8:02             ` Anselm Helbig
@ 2009-09-04  8:31               ` Elena
  0 siblings, 0 replies; 17+ messages in thread
From: Elena @ 2009-09-04  8:31 UTC (permalink / raw)
  To: help-gnu-emacs

On 4 Set, 08:02, Anselm Helbig <anselm.helbig+news2...@googlemail.com>
wrote:
>
> Nah, the leftmost key on the home row should always be bound to
> Control. You can use C-[ for ESC. 8-)

Unless you're using a (crippled) European layout, where Shift is a
good choice too.


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Viper: replacing text?
  2009-09-04  7:58             ` Anselm Helbig
@ 2009-09-04 10:41               ` Sean Sieger
  0 siblings, 0 replies; 17+ messages in thread
From: Sean Sieger @ 2009-09-04 10:41 UTC (permalink / raw)
  To: help-gnu-emacs

Anselm Helbig <anselm.helbig+news2009@googlemail.com> writes:

    Did you ever play keywiz? 

      http://www.emacswiki.org/emacs/KeyWiz

Thank you Anselm, I left my discovery of that mode out of my post
because I couldn't remember the name.  I removed the name from .notes
after I'd tried it.

I see the gtypist drills as teaching the key combinations let alone
drilling one on them.  Does keywiz.el correct errors thereby teaching
key combinations?  I guess I should try it again and see.





^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2009-09-04 10:41 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-03 14:11 Viper: replacing text? Elena
2009-09-03 15:05 ` Lennart Borgman
     [not found] ` <mailman.5945.1251990364.2239.help-gnu-emacs@gnu.org>
2009-09-03 15:21   ` Elena
2009-09-03 15:40 ` Sean Sieger
2009-09-03 16:13   ` Lennart Borgman
2009-09-03 16:38     ` Sean Sieger
     [not found]     ` <mailman.5955.1251995918.2239.help-gnu-emacs@gnu.org>
2009-09-03 19:38       ` Elena
2009-09-03 21:53         ` Lennart Borgman
2009-09-04  1:19           ` Sean Sieger
     [not found]           ` <mailman.5983.1252027190.2239.help-gnu-emacs@gnu.org>
2009-09-04  7:58             ` Anselm Helbig
2009-09-04 10:41               ` Sean Sieger
     [not found]         ` <mailman.5974.1252014851.2239.help-gnu-emacs@gnu.org>
2009-09-03 22:51           ` Elena
2009-09-04  8:02             ` Anselm Helbig
2009-09-04  8:31               ` Elena
     [not found] ` <mailman.5946.1251992506.2239.help-gnu-emacs@gnu.org>
2009-09-03 15:58   ` Elena
2009-09-03 17:00     ` Sean Sieger
2009-09-03 17:01     ` Sean Sieger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).