all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* how to position cursor at top/middle/bottom of the current screen? ( H / M / L in Vi)
@ 2008-10-08 23:09 David Lam
  2008-10-08 23:20 ` Lennart Borgman (gmail)
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: David Lam @ 2008-10-08 23:09 UTC (permalink / raw)
  To: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 211 bytes --]

like... theres  M-<  and M->,  but those move to the cursor to the
*very*top/bottom of the file

i wanna just move the cursor relative to the current text on the screen...
is there a built-in function for this?

[-- Attachment #2: Type: text/html, Size: 270 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: how to position cursor at top/middle/bottom of the current screen? ( H / M / L in Vi)
  2008-10-08 23:09 how to position cursor at top/middle/bottom of the current screen? ( H / M / L in Vi) David Lam
@ 2008-10-08 23:20 ` Lennart Borgman (gmail)
  2008-10-08 23:29   ` Bastien
  2008-10-08 23:35 ` Nikolaj Schumacher
  2008-11-03  9:25 ` Xavier Maillard
  2 siblings, 1 reply; 12+ messages in thread
From: Lennart Borgman (gmail) @ 2008-10-08 23:20 UTC (permalink / raw)
  To: David Lam; +Cc: help-gnu-emacs

David Lam wrote:
> like... theres  M-<  and M->,  but those move to the cursor to the
> /very/ top/bottom of the file
> 
> i wanna just move the cursor relative to the current text on the
> screen... is there a built-in function for this?

Ehum, yes, if you use Viper at least... ;-)

It is actually very good if you know vi.

Otherwise try the command move-to-window-line.




^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: how to position cursor at top/middle/bottom of the current screen? ( H / M / L in Vi)
  2008-10-08 23:20 ` Lennart Borgman (gmail)
@ 2008-10-08 23:29   ` Bastien
  0 siblings, 0 replies; 12+ messages in thread
From: Bastien @ 2008-10-08 23:29 UTC (permalink / raw)
  To: Lennart Borgman (gmail); +Cc: help-gnu-emacs

"Lennart Borgman (gmail)" <lennart.borgman@gmail.com> writes:

> David Lam wrote:
>> like... theres  M-<  and M->,  but those move to the cursor to the
>> /very/ top/bottom of the file
>> 
>> i wanna just move the cursor relative to the current text on the
>> screen... is there a built-in function for this?
>
> Ehum, yes, if you use Viper at least... ;-)
>
> It is actually very good if you know vi.
>
> Otherwise try the command move-to-window-line.

You can easily define these two commands:

(defun move-to-window-first-line ()
  (interactive)
  (move-to-window-line 0))

(defun move-to-window-last-line ()
  (interactive)
  (move-to-window-line -1))

... then bind them to what you want.

-- 
Bastien




^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: how to position cursor at top/middle/bottom of the current screen? ( H / M / L in Vi)
  2008-10-08 23:09 how to position cursor at top/middle/bottom of the current screen? ( H / M / L in Vi) David Lam
  2008-10-08 23:20 ` Lennart Borgman (gmail)
@ 2008-10-08 23:35 ` Nikolaj Schumacher
  2008-10-08 23:54   ` David Lam
  2008-11-03  9:25 ` Xavier Maillard
  2 siblings, 1 reply; 12+ messages in thread
From: Nikolaj Schumacher @ 2008-10-08 23:35 UTC (permalink / raw)
  To: David Lam; +Cc: help-gnu-emacs

"David Lam" <david.k.lam1@gmail.com> wrote:

> i wanna just move the cursor relative to the current text on the screen...
> is there a built-in function for this?

I only recently found this, even though it is prominently bound to M-r.
The command is `move-to-window-line', which moves to the middle.

For top, bottom:

(defun move-to-top ()
  (interactive)
  (move-to-window-line 0))

(defun move-to-bottom ()
  (interactive)
  (move-to-window-line -1))


regards,
Nikolaj Schumacher




^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: how to position cursor at top/middle/bottom of the current screen? ( H / M / L in Vi)
  2008-10-08 23:35 ` Nikolaj Schumacher
@ 2008-10-08 23:54   ` David Lam
  2008-10-09  1:55     ` Allan Gottlieb
  0 siblings, 1 reply; 12+ messages in thread
From: David Lam @ 2008-10-08 23:54 UTC (permalink / raw)
  To: Nikolaj Schumacher; +Cc: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 1055 bytes --]

hey cool thanks... this mailing list is helpful wooo  ->

;; from Emacs Mailing list on 10/8/2008 4pm!!!
;; 'H' in vi
(defun move-to-window-first-line ()
  (interactive)
  (move-to-window-line 0))

 ;; 'L' in vi
(defun move-to-window-last-line ()
  (interactive)
  (move-to-window-line -1))

;;    M-r  =  move-to-window   (by itself its 'M' in vi)
(global-set-key "\C-x\M-r" 'move-to-window-first-line)
(global-set-key "\C-x\M-c" 'move-to-window-last-line)

On Wed, Oct 8, 2008 at 4:35 PM, Nikolaj Schumacher <me@nschum.de> wrote:

> "David Lam" <david.k.lam1@gmail.com> wrote:
>
> > i wanna just move the cursor relative to the current text on the
> screen...
> > is there a built-in function for this?
>
> I only recently found this, even though it is prominently bound to M-r.
> The command is `move-to-window-line', which moves to the middle.
>
> For top, bottom:
>
> (defun move-to-top ()
>   (interactive)
>  (move-to-window-line 0))
>
> (defun move-to-bottom ()
>   (interactive)
>  (move-to-window-line -1))
>
>
> regards,
> Nikolaj Schumacher
>

[-- Attachment #2: Type: text/html, Size: 1758 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: how to position cursor at top/middle/bottom of the current screen? ( H / M / L in Vi)
  2008-10-08 23:54   ` David Lam
@ 2008-10-09  1:55     ` Allan Gottlieb
  2008-10-09 12:43       ` Stephen Berman
  0 siblings, 1 reply; 12+ messages in thread
From: Allan Gottlieb @ 2008-10-09  1:55 UTC (permalink / raw)
  To: help-gnu-emacs

At Wed, 08 Oct 2008 16:54:34 -0700 David Lam <david.k.lam1@gmail.com> wrote:

> hey cool thanks... this mailing list is helpful wooo  ->
>
> ;; from Emacs Mailing list on 10/8/2008 4pm!!!
> ;; 'H' in vi
> (defun move-to-window-first-line ()
>   (interactive)
>   (move-to-window-line 0))
>
>  ;; 'L' in vi
> (defun move-to-window-last-line ()
>   (interactive)
>   (move-to-window-line -1))

So these are already bound to keys

C-U 0 M-r     move to first line
C-U - 1 M-r   move to first line

When in X these can be shortened to

M-0 M-r
M-- 1 M-r    that one is meta minus, followed by 1, followed by meta r

allan




^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: how to position cursor at top/middle/bottom of the current screen? ( H / M / L in Vi)
  2008-10-09  1:55     ` Allan Gottlieb
@ 2008-10-09 12:43       ` Stephen Berman
  2008-10-13  3:03         ` David Lam
  0 siblings, 1 reply; 12+ messages in thread
From: Stephen Berman @ 2008-10-09 12:43 UTC (permalink / raw)
  To: help-gnu-emacs

On Wed, 08 Oct 2008 21:55:27 -0400 Allan Gottlieb <gottlieb@nyu.edu> wrote:

> At Wed, 08 Oct 2008 16:54:34 -0700 David Lam <david.k.lam1@gmail.com> wrote:
>
>> hey cool thanks... this mailing list is helpful wooo  ->
>>
>> ;; from Emacs Mailing list on 10/8/2008 4pm!!!
>> ;; 'H' in vi
>> (defun move-to-window-first-line ()
>>   (interactive)
>>   (move-to-window-line 0))
>>
>>  ;; 'L' in vi
>> (defun move-to-window-last-line ()
>>   (interactive)
>>   (move-to-window-line -1))
>
> So these are already bound to keys
>
> C-U 0 M-r     move to first line
> C-U - 1 M-r   move to first line
>
> When in X these can be shortened to
>
> M-0 M-r
> M-- 1 M-r    that one is meta minus, followed by 1, followed by meta r

The latter can be shorter:

M-- M-r

Steve Berman





^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: how to position cursor at top/middle/bottom of the current screen? ( H / M / L in Vi)
  2008-10-09 12:43       ` Stephen Berman
@ 2008-10-13  3:03         ` David Lam
  0 siblings, 0 replies; 12+ messages in thread
From: David Lam @ 2008-10-13  3:03 UTC (permalink / raw)
  To: Stephen Berman; +Cc: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 986 bytes --]

whoa wait thats tons easier

i.e.

M-0 M-r  =  H
M-- M-r   =  L

On Thu, Oct 9, 2008 at 5:43 AM, Stephen Berman <stephen.berman@gmx.net>wrote:

> On Wed, 08 Oct 2008 21:55:27 -0400 Allan Gottlieb <gottlieb@nyu.edu>
> wrote:
>
> > At Wed, 08 Oct 2008 16:54:34 -0700 David Lam <david.k.lam1@gmail.com>
> wrote:
> >
> >> hey cool thanks... this mailing list is helpful wooo  ->
> >>
> >> ;; from Emacs Mailing list on 10/8/2008 4pm!!!
> >> ;; 'H' in vi
> >> (defun move-to-window-first-line ()
> >>   (interactive)
> >>   (move-to-window-line 0))
> >>
> >>  ;; 'L' in vi
> >> (defun move-to-window-last-line ()
> >>   (interactive)
> >>   (move-to-window-line -1))
> >
> > So these are already bound to keys
> >
> > C-U 0 M-r     move to first line
> > C-U - 1 M-r   move to first line
> >
> > When in X these can be shortened to
> >
> > M-0 M-r
> > M-- 1 M-r    that one is meta minus, followed by 1, followed by meta r
>
> The latter can be shorter:
>
> M-- M-r
>
> Steve Berman
>
>
>
>

[-- Attachment #2: Type: text/html, Size: 1705 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: how to position cursor at top/middle/bottom of the current screen? ( H / M / L in Vi)
  2008-10-08 23:09 how to position cursor at top/middle/bottom of the current screen? ( H / M / L in Vi) David Lam
  2008-10-08 23:20 ` Lennart Borgman (gmail)
  2008-10-08 23:35 ` Nikolaj Schumacher
@ 2008-11-03  9:25 ` Xavier Maillard
  2008-11-05 10:16   ` Kevin Rodgers
       [not found]   ` <mailman.2917.1225880237.25473.help-gnu-emacs@gnu.org>
  2 siblings, 2 replies; 12+ messages in thread
From: Xavier Maillard @ 2008-11-03  9:25 UTC (permalink / raw)
  To: David Lam; +Cc: help-gnu-emacs

Hi,

{catching up on my mail log}

I did not see this answer so in case it could help:

in window.el, you have recenter-top-bottom function which is
bound to just C-l.

It will cycle between top, bottom and center of the screen. It is
so convenient and I got so used to it that I could not pass over
me ;)

	Xavier
-- 
http://www.gnu.org
http://www.april.org
http://www.lolica.org




^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: how to position cursor at top/middle/bottom of the current   screen? ( H / M / L in Vi)
  2008-11-03  9:25 ` Xavier Maillard
@ 2008-11-05 10:16   ` Kevin Rodgers
  2008-11-05 15:08     ` Drew Adams
       [not found]   ` <mailman.2917.1225880237.25473.help-gnu-emacs@gnu.org>
  1 sibling, 1 reply; 12+ messages in thread
From: Kevin Rodgers @ 2008-11-05 10:16 UTC (permalink / raw)
  To: help-gnu-emacs

Xavier Maillard wrote:
> Hi,
> 
> {catching up on my mail log}
> 
> I did not see this answer so in case it could help:
> 
> in window.el, you have recenter-top-bottom function which is
> bound to just C-l.

Not in the window.el distributed with Emacs 22.3

> It will cycle between top, bottom and center of the screen. It is
> so convenient and I got so used to it that I could not pass over
> me ;)

Cool.

-- 
Kevin Rodgers
Denver, Colorado, USA





^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: how to position cursor at top/middle/bottom of the current screen? ( H / M / L in Vi)
       [not found]   ` <mailman.2917.1225880237.25473.help-gnu-emacs@gnu.org>
@ 2008-11-05 10:46     ` Tim X
  0 siblings, 0 replies; 12+ messages in thread
From: Tim X @ 2008-11-05 10:46 UTC (permalink / raw)
  To: help-gnu-emacs

Kevin Rodgers <kevin.d.rodgers@gmail.com> writes:

> Xavier Maillard wrote:
>> Hi,
>>
>> {catching up on my mail log}
>>
>> I did not see this answer so in case it could help:
>>
>> in window.el, you have recenter-top-bottom function which is
>> bound to just C-l.
>
> Not in the window.el distributed with Emacs 22.3
>
>> It will cycle between top, bottom and center of the screen. It is
>> so convenient and I got so used to it that I could not pass over
>> me ;)
>
> Cool.

This behavior is also the new default in emacs 23.

Tim

-- 
tcross (at) rapttech dot com dot au


^ permalink raw reply	[flat|nested] 12+ messages in thread

* RE: how to position cursor at top/middle/bottom of the current screen? ( H / M / L in Vi)
  2008-11-05 10:16   ` Kevin Rodgers
@ 2008-11-05 15:08     ` Drew Adams
  0 siblings, 0 replies; 12+ messages in thread
From: Drew Adams @ 2008-11-05 15:08 UTC (permalink / raw)
  To: 'Kevin Rodgers', help-gnu-emacs

> > in window.el, you have recenter-top-bottom function which is
> > bound to just C-l.
> 
> Not in the window.el distributed with Emacs 22.3
> 
> > It will cycle between top, bottom and center of the screen. It is
> > so convenient and I got so used to it that I could not pass over
> > me ;)
> 
> Cool.

FYI - The code runs in previous Emacs versions also.

The original is here, along with a couple of alternatives:
http://www.emacswiki.org/emacs/misc-cmds.el

And the CVS version is here:
http://cvs.savannah.gnu.org/viewvc/emacs/emacs/lisp/window.el?view=log





^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2008-11-05 15:08 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-08 23:09 how to position cursor at top/middle/bottom of the current screen? ( H / M / L in Vi) David Lam
2008-10-08 23:20 ` Lennart Borgman (gmail)
2008-10-08 23:29   ` Bastien
2008-10-08 23:35 ` Nikolaj Schumacher
2008-10-08 23:54   ` David Lam
2008-10-09  1:55     ` Allan Gottlieb
2008-10-09 12:43       ` Stephen Berman
2008-10-13  3:03         ` David Lam
2008-11-03  9:25 ` Xavier Maillard
2008-11-05 10:16   ` Kevin Rodgers
2008-11-05 15:08     ` Drew Adams
     [not found]   ` <mailman.2917.1225880237.25473.help-gnu-emacs@gnu.org>
2008-11-05 10:46     ` Tim X

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.