diff --git a/helpers.el b/helpers.el index 569eac3..f942914 100644 --- a/helpers.el +++ b/helpers.el @@ -70,6 +70,23 @@ there's a region, all lines that region covers will be duplicated." (yank-pop (- arg))) +;; +;; Scroll Half Screen +;; - from: http://www.emacswiki.org/emacs/HalfScrolling +;; + +(defun window-half-height () + (max 1 (/ (1- (window-height (selected-window))) 2))) + +(defun scroll-up-half () + (interactive) + (scroll-up (window-half-height))) + +(defun scroll-down-half () + (interactive) + (scroll-down (window-half-height))) + + ;; ;; Window Switching ;; diff --git a/keybindings.el b/keybindings.el index cbbcb32..628e13c 100644 --- a/keybindings.el +++ b/keybindings.el @@ -24,6 +24,10 @@ ;; Goto line (global-set-key (kbd "C-c C-l") 'goto-line) +;; Scroll up/down +(global-set-key (kbd "C-v") 'scroll-up-half) +(global-set-key (kbd "M-v") 'scroll-down-half) + ;; Switch to next/previous buffer (global-set-key (kbd "C-c C-n") 'switch-to-next-buffer) (global-set-key (kbd "C-c C-p") 'switch-to-prev-buffer)