* How can I move my cursor 80 characters with a key binding? @ 2005-12-25 6:08 Scott Teresi (sent by Nabble.com) 2005-12-25 6:25 ` Cameron Desautels 0 siblings, 1 reply; 11+ messages in thread From: Scott Teresi (sent by Nabble.com) @ 2005-12-25 6:08 UTC (permalink / raw) [-- Attachment #1.1: Type: text/plain, Size: 507 bytes --] I'm trying to figure out how to bind a key combination to a function which would move the cursor forward about 80 characters (or back 80 characters). I sometimes type very long lines in emacs and would like to be able to navigate through the line quicker than one space at a time or one word at a time. Thanks for any advice anyone can provide! Scott -- Sent from the Emacs - Help forum at Nabble.com: http://www.nabble.com/How-can-I-move-my-cursor-80-characters-with-a-key-binding--t803190.html#a2089451 [-- Attachment #1.2: Type: text/html, Size: 683 bytes --] [-- Attachment #2: Type: text/plain, Size: 152 bytes --] _______________________________________________ help-gnu-emacs mailing list help-gnu-emacs@gnu.org http://lists.gnu.org/mailman/listinfo/help-gnu-emacs ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: How can I move my cursor 80 characters with a key binding? 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 ` (3 more replies) 0 siblings, 4 replies; 11+ messages in thread From: Cameron Desautels @ 2005-12-25 6:25 UTC (permalink / raw) On Sat, Dec 24, 2005 at 10:08:54PM -0800, Scott Teresi (sent by Nabble.com) wrote: > I'm trying to figure out how to bind a key combination to a function > which would move the cursor forward about 80 characters (or back 80 > characters). I sometimes type very long lines in emacs and would > like to be able to navigate through the line quicker than one space > at a time or one word at a time. Thanks for any advice anyone can > provide! Is ``C-u 8 0 C-f'' too long for you? You do it with a function if you really wanted to.. -- Cameron Desautels <cam@apt2324.com> One kill-ring to push them all, and to C-w bind them. -- Joe Brenner <doom@kzsu.stanford.edu>, in alt.religion.emacs ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: How can I move my cursor 80 characters with a key binding? 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) ` (2 subsequent siblings) 3 siblings, 0 replies; 11+ messages in thread From: Cameron Desautels @ 2005-12-25 6:31 UTC (permalink / raw) On Sun, Dec 25, 2005 at 12:25:18AM -0600, Cameron Desautels wrote: > On Sat, Dec 24, 2005 at 10:08:54PM -0800, Scott Teresi (sent by Nabble.com) wrote: > > I'm trying to figure out how to bind a key combination to a function > > which would move the cursor forward about 80 characters (or back 80 > > characters). I sometimes type very long lines in emacs and would > > like to be able to navigate through the line quicker than one space > > at a time or one word at a time. Thanks for any advice anyone can > > provide! > > Is ``C-u 8 0 C-f'' too long for you? You do it with a function if you > really wanted to.. Such a function, btw, could look like this: (global-set-key "\C-cf" '(lambda () (interactive) (forward-char 80))) -- Cameron Desautels <cam@apt2324.com> "The smallest minority on earth is the individual. Those who deny individual rights cannot claim to be defenders of minorities." --Ayn Rand ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: How can I move my cursor 80 characters with a key binding? 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-26 12:32 ` Slawomir Nowaczyk 3 siblings, 2 replies; 11+ messages in thread From: Scott Teresi (sent by Nabble.com) @ 2005-12-25 16:53 UTC (permalink / raw) [-- Attachment #1.1: Type: text/plain, Size: 1116 bytes --] 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 -- Sent from the Emacs - Help forum at Nabble.com: http://www.nabble.com/How-can-I-move-my-cursor-80-characters-with-a-key-binding--t803190.html#a2091468 [-- Attachment #1.2: Type: text/html, Size: 1312 bytes --] [-- Attachment #2: Type: text/plain, Size: 152 bytes --] _______________________________________________ help-gnu-emacs mailing list help-gnu-emacs@gnu.org http://lists.gnu.org/mailman/listinfo/help-gnu-emacs ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: How can I move my cursor 80 characters with a key binding? 2005-12-25 16:53 ` Scott Teresi (sent by Nabble.com) @ 2005-12-25 17:59 ` Peter Dyballa 2005-12-25 22:26 ` Stawrul 1 sibling, 0 replies; 11+ messages in thread From: Peter Dyballa @ 2005-12-25 17:59 UTC (permalink / raw) Cc: Help-gnu-emacs Am 25.12.2005 um 17:53 schrieb Scott Teresi (sent by Nabble.com): > Does anyone know an easier way to cursor around a very long line? You can install a 'Carbon Emacs' of any flavour, or compile an experimental version with a Cocoa (Aqua-tic) interface. All run as tools/windows in Mac OS X and you can use the mouse. One of them (at least) is even on Apple's download page of free or not so free UNIX utilities. -- Greetings Pete "I wouldn't recommend sex, drugs or insanity for everyone, but they've always worked for me." -- Hunter S. Thompson ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: How can I move my cursor 80 characters with a key binding? 2005-12-25 16:53 ` Scott Teresi (sent by Nabble.com) 2005-12-25 17:59 ` Peter Dyballa @ 2005-12-25 22:26 ` Stawrul 1 sibling, 0 replies; 11+ messages in thread From: Stawrul @ 2005-12-25 22:26 UTC (permalink / raw) > > 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. > You should try longlines-mode. In this mode returns inserted by the user are "hard" returns. The returns inserted by the filling functions, which prevent the lines from running off the screen, are "soft" returns. Soft returns are automatically removed when the text is saved to disk. You can navigate through single long line displayed in several lines as through many short lines, by hitting up/down arrow or C-p, C-n (like in PICO). To use this mode you need longlines.el file. If you use EmacsFromCVS you already have it. In other case you can download it from http://cvs.savannah.gnu.org/ viewcvs/emacs/emacs/lisp/longlines.el Add something like this to your ~/.emacs: (require 'longlines) (global-set-key "\C-c\C-q" 'longlines-mode) (global-set-key "\C-cq" 'refill-mode) Then open a file and hit C-c C-q and C-c q to turn on both modes. Hit M-q at a long line to break it with "soft" returns. You can write a function to automatically break all lines (search at emacswiki.org) Stawrul ^ permalink raw reply [flat|nested] 11+ messages in thread
[parent not found: <mailman.20404.1135529707.20277.help-gnu-emacs@gnu.org>]
* Re: How can I move my cursor 80 characters with a key binding? [not found] ` <mailman.20404.1135529707.20277.help-gnu-emacs@gnu.org> @ 2005-12-25 20:05 ` Floyd L. Davidson 0 siblings, 0 replies; 11+ messages in thread From: Floyd L. Davidson @ 2005-12-25 20:05 UTC (permalink / raw) "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 ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: How can I move my cursor 80 characters with a key binding? 2005-12-25 6:25 ` Cameron Desautels ` (2 preceding siblings ...) [not found] ` <mailman.20404.1135529707.20277.help-gnu-emacs@gnu.org> @ 2005-12-26 12:32 ` Slawomir Nowaczyk 3 siblings, 0 replies; 11+ messages in thread From: Slawomir Nowaczyk @ 2005-12-26 12:32 UTC (permalink / raw) On Sun, 25 Dec 2005 00:25:18 -0600 Cameron Desautels <cam@apt2324.com> wrote: #> On Sat, Dec 24, 2005 at 10:08:54PM -0800, Scott Teresi (sent by Nabble.com) wrote: #> > I'm trying to figure out how to bind a key combination to a function #> > which would move the cursor forward about 80 characters (or back 80 #> > characters). I sometimes type very long lines in emacs and would #> > like to be able to navigate through the line quicker than one space #> > at a time or one word at a time. Thanks for any advice anyone can #> > provide! #> #> Is ``C-u 8 0 C-f'' too long for you? You do it with a function if you #> really wanted to.. ``C-8 0 C-f'' is even faster for me -- I know it runs forward-char 80 times instead of just once, but for reasonable values of 80 I prefer computer to work harder if it saves me the extra keystroke :) -- Best wishes, Slawomir Nowaczyk ( slawomir.nowaczyk.847@student.lu.se ) Most interesting information comes from children, for they tell all they know and then stop. ^ permalink raw reply [flat|nested] 11+ messages in thread
[parent not found: <mailman.20378.1135491010.20277.help-gnu-emacs@gnu.org>]
* Re: How can I move my cursor 80 characters with a key binding? [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 1 sibling, 0 replies; 11+ messages in thread From: David Hansen @ 2005-12-25 14:59 UTC (permalink / raw) C-u 80 C-f ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: How can I move my cursor 80 characters with a key binding? [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) 1 sibling, 1 reply; 11+ messages in thread From: B. T. Raven @ 2005-12-25 18:50 UTC (permalink / raw) "Scott Teresi (sent by Nabble.com)" <lists@nabble.com> wrote in message news:mailman.20378.1135491010.20277.help-gnu-emacs@gnu.org... I'm trying to figure out how to bind a key combination to a function which would move the cursor forward about 80 characters (or back 80 characters). I sometimes type very long lines in emacs and would like to be able to navigate through the line quicker than one space at a time or one word at a time. Thanks for any advice anyone can provide! Scott Sent from the Emacs - Help forum at Nabble.com: How can I move my cursor 80 characters with a key binding? The fastest way to accomplish this is to use incremental search (either C-s or C-r). Find a word or substring you want to move to and then press C-s to move forward or C-r to move backward. Hold down Ctl key and keep pressing s or r until you get to the instance of the substring you want and then press Return. The cursor will then be positioned after the substring. I would bet a not inconsequential sum of money that this will turn out to me (much!) faster than hardwiring a "forward80" function to a keychord. Ed. ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: How can I move my cursor 80 characters with a key binding? 2005-12-25 18:50 ` B. T. Raven @ 2005-12-25 19:19 ` Scott Teresi (sent by Nabble.com) 0 siblings, 0 replies; 11+ messages in thread From: Scott Teresi (sent by Nabble.com) @ 2005-12-25 19:19 UTC (permalink / raw) [-- Attachment #1.1: Type: text/plain, Size: 557 bytes --] Ed, That is excellent! I tried it out and decided I won't bet against you. I can use C-s and C-r to zip around my document pretty quick that way. Never thought to use "search" for navigation. Pete, I edit text files on my home OS X machine over SSH while I'm traveling (often visiting family). I like to use Terminal because I don't need any software installed on whoever's machine I'm using. Scott -- Sent from the Emacs - Help forum at Nabble.com: http://www.nabble.com/How-can-I-move-my-cursor-80-characters-with-a-key-binding--t803190.html#a2092178 [-- Attachment #1.2: Type: text/html, Size: 763 bytes --] [-- Attachment #2: Type: text/plain, Size: 152 bytes --] _______________________________________________ help-gnu-emacs mailing list help-gnu-emacs@gnu.org http://lists.gnu.org/mailman/listinfo/help-gnu-emacs ^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2005-12-26 12:32 UTC | newest] Thread overview: 11+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 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 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)
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).