From: Brian Adkins <lojicdotcom@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: Equivalent of vim's o or O commands
Date: Tue, 5 Feb 2008 11:47:58 -0800 (PST) [thread overview]
Message-ID: <3e30bd04-f387-4b8f-82bf-d088981089d1@s8g2000prg.googlegroups.com> (raw)
In-Reply-To: a57393f2-a62d-4694-8edf-dc41bb7bcbd4@v67g2000hse.googlegroups.com
On Feb 5, 2:22 pm, Brian Adkins <lojicdot...@gmail.com> wrote:
> I would like to have the equivalent of vim's o or O commands in emacs.
> The o command will open a new line below the cursor and position the
> cursor properly indented (if autoindent is on). The O command does the
> same but opens the line above the cursor.
>
> In emacs, C-o will open a line above the cursor if the cursor is at
> the beginning of the line (but won't properly indent), but splits the
> line if the cursor is within some text.
>
> This is such a common operation for me, that I would like to bind it
> to a simple combination instead of requiring C-e C-j.
>
> I failed to find a good "emacs for vim users" reference on Google.
> There are some partial ones that are helpful, but I would like a more
> complete reference as I consider transitioning from vim to emacs. If
> anyone knows of one, I'd appreciate a link.
>
> Thanks,
> Brian Adkins
I should have searched the group archives first. I found a
satisfactory solution from a 2002 posting :)
(defun bja-open-line-below ()
(interactive)
(end-of-line)
(open-line 1)
(next-line 1)
(indent-according-to-mode))
(defun bja-open-line-above ()
(interactive)
(beginning-of-line)
(open-line 1)
(indent-according-to-mode))
(global-set-key [?\C-o] 'bja-open-line-below)
(global-set-key [?\M-o] 'bja-open-line-above)
Being able to customize emacs with elisp is one of the main reasons
I'm considering a switch (that and being able to use emacs/slime for
Lisp programming).
Brian
next prev parent reply other threads:[~2008-02-05 19:47 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-05 19:22 Equivalent of vim's o or O commands Brian Adkins
2008-02-05 19:47 ` Brian Adkins [this message]
2008-02-06 0:49 ` Jason Earl
2008-02-06 22:07 ` Brian Adkins
2008-02-06 22:45 ` Lennart Borgman (gmail)
[not found] ` <mailman.7061.1202337917.18990.help-gnu-emacs@gnu.org>
2008-02-07 20:44 ` Brian Adkins
2008-02-07 22:06 ` Samuel Karl Peterson
2008-02-07 23:14 ` Lennart Borgman (gmail)
[not found] ` <mailman.7125.1202426051.18990.help-gnu-emacs@gnu.org>
2008-02-09 11:11 ` Fabian Braennstroem
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3e30bd04-f387-4b8f-82bf-d088981089d1@s8g2000prg.googlegroups.com \
--to=lojicdotcom@gmail.com \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).