vim user switch to emacs?

J

Joe Van Dyk

Hi,

So, I've been a long-term vim user. But I've heard about how emacs is
pretty good, and there's a vim-compatible mode in emacs (i tried using
standard emacs for a day, but my hands hurt so bad from pressing ctrl
so much).

Are there any Rubyists out there who use emacs in vim mode? Can you
post your configuration files so I can get syntax highlighting,
automatic indentation, etc? And how can I set up emacs to run a shell
command (i.e. 'ruby <current file>' or 'ruby unit_tests.rb' easily)?

Thanks,
Joe
 
K

Kelly Felkins

------=_Part_10162_32681173.1125077902247
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

I can't speak to the vimisms. Shell mode in emacs is really easy: M-x shell

In emacs-speak, that's "hold down the Alt key, and press the x key, type=20
'shell' and hit return.

You are now sitting at a shell.



=20
Hi,
=20
So, I've been a long-term vim user. But I've heard about how emacs is
pretty good, and there's a vim-compatible mode in emacs (i tried using
standard emacs for a day, but my hands hurt so bad from pressing ctrl
so much).
=20
Are there any Rubyists out there who use emacs in vim mode? Can you
post your configuration files so I can get syntax highlighting,
automatic indentation, etc? And how can I set up emacs to run a shell
command (i.e. 'ruby <current file>' or 'ruby unit_tests.rb' easily)?
=20
Thanks,
Joe
=20

------=_Part_10162_32681173.1125077902247--
 
M

Mike Douglas

The mode you are looking for is called Viper Mode.

M-x viper-mode.

Btw, remapping the Caps Lock key to Ctrl made the Emacs key bindings
much easier for me.

I can't speak to the vimisms. Shell mode in emacs is really easy: M-x she= ll
=20
In emacs-speak, that's "hold down the Alt key, and press the x key, type
'shell' and hit return.
=20
You are now sitting at a shell.
=20
=20
=20

=20
=20


--=20
Mike Douglas
 
J

Joe Van Dyk

I can't speak to the vimisms. Shell mode in emacs is really easy: M-x she= ll
=20
In emacs-speak, that's "hold down the Alt key, and press the x key, type
'shell' and hit return.
=20
You are now sitting at a shell.
=20

Thanks! What about syntax highlighting and Ruby indentation? (And
rhtml support would be nice)

Also, does emacs support stuff like this properly?

some_function argument_1,=20
argument_2,
argument_3
#cursor should not be here!
#cursor should be here!

That's one of the things that bugged me with vim. =20
=20
 
N

Nikolai Weibull

Joe said:
Also, does emacs support stuff like this properly?

some_function argument_1,
argument_2,
argument_3
#cursor should not be here!
#cursor should be here!

That's one of the things that bugged me with vim.

This has been fixed. Get the latest from CVS:

http://rubyforge.org/cgi-bin/viewcv...vim-ruby&content-type=text/vnd.viewcvs-markup

Actually, a lot of things have been fixed in CVS.

(Although it doesn't work how you describe above. The arguments would
have to be contained in parentheses. Anything else would require a lot
more work (_a lot more_)),
nikolai
 
A

Austin Ziegler

(Although it doesn't work how you describe above. The arguments would
have to be contained in parentheses. Anything else would require a lot
more work (_a lot more_)),
nikolai

As far as I can tell, Nikolai, it *does* work without the parens.

-austin
--=20
Austin Ziegler * (e-mail address removed)
* Alternate: (e-mail address removed)
 
J

Joe Van Dyk

Joe Van Dyk wrote:
=20
=20
This has been fixed. Get the latest from CVS:
=20
http://rubyforge.org/cgi-bin/viewcvs.cgi/vim-ruby/indent/ruby.vim?rev=3D1= 24&cvsroot=3Dvim-ruby&content-type=3Dtext/vnd.viewcvs-markup
=20
Actually, a lot of things have been fixed in CVS.
=20
(Although it doesn't work how you describe above. The arguments would
have to be contained in parentheses. Anything else would require a lot
more work (_a lot more_)),
nikolai
=20

Great! If I want to use that, I'd put it in $HOME/.vim/indent? And
it'll be used automatically instead of the stock version?
 
C

Cam

Hi,

If this is the sort of thing you're looking for then I have an
alternate solution. I was a hard-core emacs user who switched to
vim and the one major thing i missed was running a shell in my editor.

did ':shell' not work for you?

Cameron Matheson
 
A

Austin Ziegler

did ':shell' not work for you?

That's different. That starts a shell in a new window, or shells out.
The emacs shell -- one of the few things that I *do* like about emacs
-- essentially does a new pty on Unix, similar to what screen does.

-austin
--=20
Austin Ziegler * (e-mail address removed)
* Alternate: (e-mail address removed)
 
J

Jacob Fugal

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
=20
|>If this is the sort of thing you're looking for then I have an
|>alternate solution. I was a hard-core emacs user who switched to
|>vim and the one major thing i missed was running a shell in my editor.
|
|
| did ':shell' not work for you?
=20
Dont' get me wrong, i love vim and it's the greatest editor in the
history of the world, but umm... ":shell" sucks.

Under what conditions? I'll agree that :shell from inside a gvim
window (note: gvim, not terminal vim) sucks. However, shell from a
terminal vim process works fine for me. It would be nice if it had
screen-type functionality, but I don't consider that one missed
feature enough to make it suck as horrendously as you imply. In all
respects, when I :shell from terminal vim, I might as well be in
another terminal except I have the added bonus that exit takes me back
to my still running vim instance.

So, I admitted the :shell under gvim sucks... but why would I need it?
If I'm in gvim, I've got plenty of other dedicated terminals just an
M-<tab> away. The only time I use shell is when I'm stuck in a
terminal vim across an SSH connection without X tunnelling.

Jacob Fugal
 
N

Nikolai Weibull

Dont' get me wrong, i love vim and it's the greatest editor in the
history of the world, but umm... ":shell" sucks. Oh does it suck...
the vaccuum of space is envious of the amount that ":shell" can suck. :)

Well, that's really not Vim's fault. If you don't like what :shell
does, switch shells. Zsh is good, for one,
nikolai
 
J

Josef 'Jupp' SCHUGT

Hi!
So, I've been a long-term vim user. But I've heard about how emacs
is pretty good, and there's a vim-compatible mode in emacs

Don't believe those false rumors. Yes, there is viper-mode but it is
unusable to anyone relying on the advanced features of vi (leave alone
vim). Yes, unfortunately I know precisely what I am talking about :-|

Nevertheless you can make Emacs 100% compatible: Simply use 'M-x
ansi-term' then 'vim ENTER'.

That actually is running vim inside a terminal emulation inside Emacs.

When people hear me say "Emacs is great. It only lacks a good editor."
they first think that is meant to be a funny remark. It is not. Emacs
is a great program I use for many tasks but when it comes to quite
advanced editing tasks I usually save the file, do the complex editing
in vim, then switch back to Emacs.

Note that customizing Emacs can help a lot. My favorite setting is:

(delete-selection-mode t)

Its effect is that a selection is replaced by the text that is entered
(or pasted). This is much handier than the original behavior.

Josef 'Jupp' SCHUGT
 
S

Stefan Schmiedl

Hmm, I'm curious. Can you show me a sample task that made you switch
to vim?

The global command, for example:

:%g/\[CRON\]/d deletes all (uninteresting) cron entries in my auth.log

:%g/Customer$/s/\([^ ]*\) \([^ ]*\)/&2, &1/g
.... give and take a few \ in front of parentheses ...
exchanges the first and second space delimited word in lines ending with Customer

Being able to record arbitrary command sequences like (not a real life example)
df.3j04 p (cut upto and including . and paste the deletion 3 lines down after column 4)

and of course my favourite vim application: vimoutliner (www.vimoutliner.org)

all of this without breaking my fingers because of the unlucky positioning of CTRL.

s.
 
L

Logan Capaldo

When people hear me say "Emacs is great. It only lacks a good
editor."
they first think that is meant to be a funny remark. It is not.
Emacs
is a great program I use for many tasks but when it comes to quite
advanced editing tasks I usually save the file, do the complex
editing
in vim, then switch back to Emacs.


Hmm, I'm curious. Can you show me a sample task that made you
switch
to vim?

The global command, for example:

:%g/\[CRON\]/d deletes all (uninteresting) cron entries in my
auth.log

C-x h M-x flush-lines \[CRON\] RET

:%g/Customer$/s/\([^ ]*\) \([^ ]*\)/&2, &1/g
.... give and take a few \ in front of parentheses ...
exchanges the first and second space delimited word in lines
ending with Customer

M-% ... RET ... !

Being able to record arbitrary command sequences like (not a real
life example)
df.3j04 p (cut upto and including . and paste the deletion 3 lines
down after column 4)

C-x ( M-z . M-3 C-n C-a M-4 C-f C-y C-x )

Execute with C-x e as often as you want, or bind it to a key of your
choice. (Untested, I just wrote down what I'd intuitively type.)

and of course my favourite vim application: vimoutliner
(www.vimoutliner.org)

Ok, outliners. There are lots of them for Emacs but I admit I don't
really like any of them (I prefer org-mode). I know I tried
vimoutliner once, but I can't recall how it was... I think I was not
too impressed. I use OPML Editor for now when I need outlines.

all of this without breaking my fingers because of the unlucky
positioning of CTRL.

Just curious: How do you leave vim's input mode?

I'm not the OP, but probably the same way I do, ESC.
 
S

Stefan Schmiedl

The global command, for example:

:%g/\[CRON\]/d deletes all (uninteresting) cron entries in my auth.log

C-x h M-x flush-lines \[CRON\] RET

vim lets you put any command after the global pattern. How does emacs solve this
with its interactive parameter queries?
:%g/Customer$/s/\([^ ]*\) \([^ ]*\)/&2, &1/g
.... give and take a few \ in front of parentheses ...
exchanges the first and second space delimited word in lines ending with Customer

M-% ... RET ... !

I don't know enough emacs to see through the dots, but that's not important.
C-x ( M-z . M-3 C-n C-a M-4 C-f C-y C-x )

That's the main difference for me. I just can't remember all those meta/control
combinations. the vim command maps better to my brain.
Just curious: How do you leave vim's input mode?

with a swish of the hand to the ESC button ... don't ask how often
I hit ESC while I typed this message in Opera ...

s.
 
R

Randy Kramer

Top posting to say, if you're looking for (or to recommend) an editor and
you're considering vim or emacs, I'd recommend considering nedit as well.

In many ways it's almost as powerful as emacs (ignoring the emacs as an OS
syndrome), including such features as regular expressions, macros, recordable
keyboard macros (which can be editied to include any macro command or
construct available), (programmable) syntax highlighting, the possiblity to
do folding by virtue of macros (the text is, unfortunately, truly folded
instead of hidden--this may be its biggest weak point), but encased in a much
more modern GUI with "traditional" (Windows like) menus and keyboard
shortcuts.

At a quick glance, I believe that all of the tasks mentioned below can be done
in nedit (but I might not respond to any challenge to prove it, at least not
at the moment).

Randy Kramer

The global command, for example:
:%g/\[CRON\]/d deletes all (uninteresting) cron entries in my auth.log

C-x h M-x flush-lines \[CRON\] RET

vim lets you put any command after the global pattern. How does emacs solve
this with its interactive parameter queries?
:%g/Customer$/s/\([^ ]*\) \([^ ]*\)/&2, &1/g

.... give and take a few \ in front of parentheses ...
exchanges the first and second space delimited word in lines ending with
Customer

M-% ... RET ... !

I don't know enough emacs to see through the dots, but that's not
important.
C-x ( M-z . M-3 C-n C-a M-4 C-f C-y C-x )

That's the main difference for me. I just can't remember all those
meta/control combinations. the vim command maps better to my brain.
Just curious: How do you leave vim's input mode?

with a swish of the hand to the ESC button ... don't ask how often
I hit ESC while I typed this message in Opera ...

s.
 
D

Daniel Brockman

Christian Neukirchen said:
C-x ( and C-x ) define the macro
M-z zap to char
M-<number> prefix argument
C-n next line
C-a beginning of line (ok, that doesn't fit)

Ironically, I think C-a for beginning-of-line is one of the
best and easiest-to-remember bindings of all time.

Not only is `A' the first letter of the alphabet, which
would make a perfectly adequate mnemonic, but the `A' key is
actually located physically at the beginning of the keyboard
(on both Dvorak and QWERTY!).

In my experience, this "spatial mnemonic" enables you to
wire the C-a binding really deep into muscle memory. YMMV.
 
D

Daniel Brockman

Derek Wyatt said:
| C-x ( M-z . M-3 C-n C-a M-4 C-f C-y C-x )

I hate to say it but, strangely enough, you've just
reinforced my decision to switch from emacs. It probably
took you at least twice as long to type the example.

It probably took Stefan even longer to think through what
commands he needed to include in the macro. I very much
doubt that raw typing speed is any bottleneck here.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,262
Messages
2,571,043
Members
48,769
Latest member
Clifft

Latest Threads

Top