From: floyd@apaflo.com (Floyd L. Davidson)
Subject: Re: How can I move my cursor 80 characters with a key binding?
Date: Sun, 25 Dec 2005 11:05:41 -0900 [thread overview]
Message-ID: <87ek41j622.fld@apaflo.com> (raw)
In-Reply-To: mailman.20404.1135529707.20277.help-gnu-emacs@gnu.org
"Scott Teresi (sent by Nabble.com)" <lists@nabble.com> wrote:
>Well, that's great! The built-in key combination is almost good enough, but I think I might need
>to do the custom key binding so that I can rapidly jump the cursor 80 characters, repeatedly. If I
>have a line that takes up 10 lines on the screen (a paragraph of text, for instance), and I need
>to get to the center of that paragraph, I'd have to jump forward several times to get there. (I
>think the key binding would be easier for me than trying to guess exactly how many characters to
>jump forward.)
>Does anyone know an easier way to cursor around a very long line? I'm pretty frustrated with how I
>can't simply hit the up arrow and move up to the previous line on the screen (which is actually
>part of the same very long line), but it's an improvement over PICO which always adds a carriage
>return at the edge of the screen. I use the Terminal program in Mac OS X which doesn't seem to
>allow mouse input.
>Thanks a lot for your help! Merry Christmas!
>Scott
I'm not positive, but it sounds like this might do what you
want.
Put this into your init file, ~/.emacs.el or whatever. (This
works on either Emacs or XEmacs, but the init file would be
named differently.) You can change the name of the function
from "fld-jmp80" to anything you happen to like, but it is wise
to pick a prefix that will never be used by any other module,
just to avoid stepping on something else. Typicall the
programer's initials or a prefix specifying the name of the
module are used.
This function can take an optional argument, but the default
argument is 1. With the (default) argument of 1 it will move
the cursor forward by 80 characters. With any other argument it
will move the cursor backwards by 80 characters..
(defun fld-jmp80 (&optional fld-arg)
"Move cursor forward or backward 80 characters.
The default argument is 1, which moves characters forward,
any other argument will move 80 characters backwards."
(interactive "p")
(let ((fld-cnt))
(setq fld-cnt -80)
(if (eq 1 fld-arg) (setq fld-cnt 80))
(forward-char fld-cnt)))
You will also want to bind this to a key sequence, such as
a function key.
Here are ways to bind this function to various keys. Choose a
key sequency you like, and using one of these as an example,
put a command into your init file to bind your function to
your choise of keys.
(global-set-key "\C-a" 'fld-jmp80) ;; Cntl-A
(global-set-key "\C-x\C-a" 'fld-jmp80) ;; Cntl-X Cntl-A
(define-key ctl-x-map "\C-a" 'fld-jmp80) ;; Cntl-X Cntl-A
(define-key esc-map "a" 'fld-jmp80) ;; Esc A
(global-set-key [(insert)] 'fld-jmp80) ;; "Insert" fkey
(define-key global-map [f5] 'fld-jmp80) ;; F5 fkey
--
Floyd L. Davidson <http://www.apaflo.com/floyd_davidson>
Ukpeagvik (Barrow, Alaska) floyd@apaflo.com
next prev parent reply other threads:[~2005-12-25 20:05 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-12-25 6:08 How can I move my cursor 80 characters with a key binding? Scott Teresi (sent by Nabble.com)
2005-12-25 6:25 ` Cameron Desautels
2005-12-25 6:31 ` Cameron Desautels
2005-12-25 16:53 ` Scott Teresi (sent by Nabble.com)
2005-12-25 17:59 ` Peter Dyballa
2005-12-25 22:26 ` Stawrul
[not found] ` <mailman.20404.1135529707.20277.help-gnu-emacs@gnu.org>
2005-12-25 20:05 ` Floyd L. Davidson [this message]
2005-12-26 12:32 ` Slawomir Nowaczyk
[not found] <mailman.20378.1135491010.20277.help-gnu-emacs@gnu.org>
2005-12-25 14:59 ` David Hansen
2005-12-25 18:50 ` B. T. Raven
2005-12-25 19:19 ` Scott Teresi (sent by Nabble.com)
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=87ek41j622.fld@apaflo.com \
--to=floyd@apaflo.com \
/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).