[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to move the cursor to the bottom of the screen?
From: |
Stefan Kamphausen |
Subject: |
Re: How to move the cursor to the bottom of the screen? |
Date: |
Thu, 10 Jan 2008 17:06:29 +0100 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux) |
"Ye ilho" <iy2110@columbia.edu> writes:
> Hi everyone,
>
> I am sorry for my ignorance but I was trying to find out how to move
> the cursor to the bottom/middle/top of the screen?
> In other words, when I edit something, I sometimes want to go to the
> top of the screen I see with one key stroke.
There are two functions I've been using for years which allow me to
use the home and end keys as follows:
press once goto beginning/end of line
press twice goto beginning/end of window
press thrice goto beginning/end of buffer
Those functions are:
(defun chb-home ()
(interactive)
(if (not (bolp))
(beginning-of-line)
(if (eq this-command last-command)
(cond
((not (= (point) (window-start)))
(move-to-window-line 0)
(beginning-of-line))
(t
(goto-char (point-min)))))))
(defun chb-end ()
(interactive)
(if (not (eolp))
(end-of-line)
(if (eq this-command last-command)
(cond
((not (= (point) (save-excursion
(move-to-window-line -1)
(end-of-line)
(point))))
(move-to-window-line -1)
(end-of-line))
(t
(goto-char (point-max)))))))
I bind them like this:
(global-set-key '[(home)] 'chb-home)
(global-set-key '[(end)] 'chb-end)
Very convenient.
Regards,
Stefan
--
Stefan Kamphausen --- http://www.skamphausen.de
a blessed +42 regexp of confusion (weapon in hand)
You hit. The format string crumbles and turns to dust.
Re: How to move the cursor to the bottom of the screen?, Dmitri Minaev, 2008/01/10
Re: How to move the cursor to the bottom of the screen?, Exal de Jesus Garcia Carrillo, 2008/01/09
Re: How to move the cursor to the bottom of the screen?,
Stefan Kamphausen <=