Vim user switch to emacs?

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

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
'shell' and hit return.

You are now sitting at a shell.

···

On 8/26/05, Joe Van Dyk <joevandyk@gmail.com> wrote:

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

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 :expressionless:

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

···

At Sat, 27 Aug 2005 02:18:42 +0900, Joe Van Dyk wrote:
--
Receiving this message does not necessarily imply that you are
expected to understand it. If you do not understand it the best
current practice (BCP) is ignoring it. If you only understand parts
of it the BCP is ignoring the rest.

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.

···

On 8/26/05, Kelly Felkins <railsinator@gmail.com> wrote:

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
'shell' and hit return.

You are now sitting at a shell.

On 8/26/05, Joe Van Dyk <joevandyk@gmail.com> wrote:
>
> 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
>
>

--
Mike Douglas

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
'shell' and hit return.

You are now sitting at a shell.

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.

Then I found Ion (http://modeemi.cs.tut.fi/~tuomov/ion/\) as my
window manager for X. My productivity in everything shot up by
about 25% after i got used to it.

Of course, if you're in windows, maybe emacs is the way to go :slight_smile:
Or, quite frankly, if you love emacs then good on ya. It's a great
editor.

Regs,
Derek

Kelly Felkins wrote:

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

- --
Derek Wyatt - C++ / Ruby / Unix Programmer

···

On 8/26/05, Joe Van Dyk <joevandyk@gmail.com> wrote:

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
'shell' and hit return.

You are now sitting at a shell.

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,
              argument_2,
              argument_3
              #cursor should not be here!
#cursor should be here!

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

···

On 8/26/05, Kelly Felkins <railsinator@gmail.com> wrote:

On 8/26/05, Joe Van Dyk <joevandyk@gmail.com> wrote:
>
> 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
>
>

Josef 'Jupp' SCHUGT <jupp@gmx.de> writes:

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?

···

Josef 'Jupp' SCHUGT

--
Christian Neukirchen <chneukirchen@gmail.com> http://chneukirchen.org

Joe Van Dyk wrote:

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/viewcvs.cgi/vim-ruby/indent/ruby.vim?rev=1.24&cvsroot=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

···

--
Nikolai Weibull: now available free of charge at http://bitwi.se/\!
Born in Chicago, IL USA; currently residing in Gothenburg, Sweden.
main(){printf(&linux["\021%six\012\0"],(linux)["have"]+"fun"-97);}

Hi,

···

On 8/26/05, Derek Wyatt <derek@derekwyatt.org> wrote:

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

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

I made the switch after being a 5 year Emacs die-hard. There were
two simple things that made me switch. I was doing "big" edits in
emacs and "small" edits in vim. I finally asked myself why i was
using 2 editors... i realized i only needed one. The second reason,
however was the very simple difference between the two: moded vs.
modeless operation. With moded operation, i get the "." operator.
That's really all i needed.

Regs,
D

- --
Derek Wyatt - C++ / Ruby / Unix Programmer

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.

···

On Tue, 30 Aug 2005 23:37:54 +0900, Christian Neukirchen <chneukirchen@gmail.com> wrote:

Josef 'Jupp' SCHUGT <jupp@gmx.de> writes:

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?

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

-austin

···

On 8/26/05, Nikolai Weibull <mailing-lists.ruby-talk@rawuncut.elitemail.org> wrote:

(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

--
Austin Ziegler * halostatue@gmail.com
               * Alternate: austin@halostatue.ca

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?

···

On 8/26/05, Nikolai Weibull <mailing-lists.ruby-talk@rawuncut.elitemail.org> wrote:

Joe Van Dyk wrote:

> 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/viewcvs.cgi/vim-ruby/indent/ruby.vim?rev=1.24&cvsroot=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

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

···

On 8/26/05, Cam <cameron.matheson@gmail.com> wrote:

On 8/26/05, Derek Wyatt <derek@derekwyatt.org> wrote:
> 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?

--
Austin Ziegler * halostatue@gmail.com
               * Alternate: austin@halostatue.ca

Cam wrote:

···

On 8/26/05, Derek Wyatt <derek@derekwyatt.org> wrote:

> 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?

I hear good things about screen as well,
        nikolai (full of irony)

--
Nikolai Weibull: now available free of charge at http://bitwi.se/\!
Born in Chicago, IL USA; currently residing in Gothenburg, Sweden.
main(){printf(&linux["\021%six\012\0"],(linux)["have"]+"fun"-97);}

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?

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. :slight_smile:

Regs,
D

- --
Derek Wyatt - C++ / Ruby / Unix Programmer

Derek Wyatt wrote:

> > 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?

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. :slight_smile:

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

···

--
Nikolai Weibull: now available free of charge at http://bitwi.se/\!
Born in Chicago, IL USA; currently residing in Gothenburg, Sweden.
main(){printf(&linux["\021%six\012\0"],(linux)["have"]+"fun"-97);}

Derek Wyatt <derek@derekwyatt.org> writes:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

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

I made the switch after being a 5 year Emacs die-hard. There were
two simple things that made me switch. I was doing "big" edits in
emacs and "small" edits in vim.

Same here. I touch configuration files mainly with vim, and code with
emacs.

I finally asked myself why i was
using 2 editors... i realized i only needed one. The second reason,
however was the very simple difference between the two: moded vs.
modeless operation. With moded operation, i get the "." operator.
That's really all i needed.

From the emacs docs:

C-x z runs the command repeat
Repeat most recently executed command.
This command is like the `.' command in the vi editor.

···

D

--
Christian Neukirchen <chneukirchen@gmail.com> http://chneukirchen.org

"Stefan Schmiedl" <s@xss.de> writes:

Josef 'Jupp' SCHUGT <jupp@gmx.de> writes:

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?

···

On Tue, 30 Aug 2005 23:37:54 +0900, Christian Neukirchen <chneukirchen@gmail.com> wrote:

s.

--
Christian Neukirchen <chneukirchen@gmail.com> http://chneukirchen.org

Austin Ziegler wrote:

···

On 8/26/05, Nikolai Weibull > <mailing-lists.ruby-talk@rawuncut.elitemail.org> wrote:

> (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.

Ah, what I meant was that the continuation lines don't line up with the
first argument (i.e., after the function name). They do get a
'shiftwidth' indent, though,
        nikolai

--
Nikolai Weibull: now available free of charge at http://bitwi.se/\!
Born in Chicago, IL USA; currently residing in Gothenburg, Sweden.
main(){printf(&linux["\021%six\012\0"],(linux)["have"]+"fun"-97);}