help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How do you scroll the screen without moving the cursor ? (theC-E and


From: David Lam
Subject: Re: How do you scroll the screen without moving the cursor ? (theC-E and C-Y keys in vi)
Date: Fri, 3 Oct 2008 17:57:57 -0700

aww cool thanks... i just tried the stuffs

this is what i ended up with ->

;; ^E in Vi
(defun ctrl-e-in-vi (n)
 (interactive "p")
 (scroll-down n))

;; ^Y in Vi
(defun ctrl-y-in-vi (n)
 (interactive "p")
 (scroll-up n))

(global-set-key "\M-n" 'ctrl-y-in-vi)
(global-set-key "\M-p" 'ctrl-e-in-vi)






On Fri, Oct 3, 2008 at 1:07 PM, Chris McMahan <first_initiallastname@one.dot.net> wrote:
Paul R <paul.r.ml@gmail.com> writes:

> 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))))

Excellent! Thank you!

BTW, where can I get info on the key syntax you're using? [down] and
[up]...

- Chris

--
    (.   .)
 =ooO=(_)=Ooo=====================================
 Chris McMahan | first_initiallastname@one.dot.net
 =================================================


reply via email to

[Prev in Thread] Current Thread [Next in Thread]