Skip to content

Instantly share code, notes, and snippets.

@ongaeshi
Created January 9, 2012 04:18
Show Gist options
  • Save ongaeshi/1581064 to your computer and use it in GitHub Desktop.
Save ongaeshi/1581064 to your computer and use it in GitHub Desktop.
smartrep.el を使って2つのバッファを同時にスクロール出来るViewer機能を作ってみた。
;;--------------------------------------------------------------------------
;; smartrep
;;--------------------------------------------------------------------------
(require 'smartrep)
;;--------------------------------------------------------------------------
;; smartrep viewer
;;--------------------------------------------------------------------------
; プレフィックスキーの設定
(defvar ctl-t-map (make-keymap))
(define-key global-map "\C-t" ctl-t-map)
; キーバインドの設定
(smartrep-define-key
global-map "C-t"
'(
; main-window
("SPC" . 'scroll-up)
("b" . 'scroll-down)
("l" . 'forward-char)
("h" . 'backward-char)
("j" . (lambda () (scroll-up 1)))
("k" . (lambda () (scroll-up -1)))
("a" . (lambda () (beginning-of-buffer)))
("e" . (lambda () (end-of-buffer)))
("i" . 'keyboard-quit)
; other-window
("n" . 'scroll-other-window)
("N" . (lambda () (scroll-other-window '-)))
("m" . (lambda () (scroll-other-window 1)))
("," . (lambda () (scroll-other-window -1)))
("A" . (lambda () (beginning-of-buffer-other-window 0)))
("E" . (lambda () (end-of-buffer-other-window 0)))
)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment