|
From: | Paul R |
Subject: | Re: How do you scroll the screen without moving the cursor ? (theC-E and C-Y keys in vi) |
Date: | Fri, 03 Oct 2008 18:09:20 +0200 |
User-agent: | Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux) |
Chris> If that's not what you have in mind, I've been using these for Chris> some time. They keep the cursor in place and move the text Chris> underneath it. Chris> (defun scroll-down-in-place (n) (interactive "p") Chris> (previous-line n) (scroll-down n)) Chris> (defun scroll-up-in-place (n) (interactive "p") (next-line n) Chris> (scroll-up n)) To avoid weird behaviour when seeing ends of your buffer, use the code below. (global-set-key [down] (lambda () (interactive) (next-line 1) (unless (eq (window-end) (point-max)) (scroll-up 1)))) (global-set-key [up] (lambda () (interactive) (previous-line 1) (unless (eq (window-start) (point-min)) (scroll-down 1)))) -- Paul
[Prev in Thread] | Current Thread | [Next in Thread] |