Emacs elscreen - 如何跳转到带编号的标签

时间:2010-09-19 16:04:00

标签: emacs elisp dot-emacs

Elscreen有一个名为elscreen-jump的方法,还有elscreen-jump-0elscreen-jump-9。我希望能够跳转到0到9之间的选项卡。如何为此定义键盘映射?我试过了:

(global-set-key (kbd "M-1") (lambda () (interactive) (elscreen-jump 0)))
(global-set-key (kbd "M-2") (lambda () (interactive) (elscreen-jump 1)))

但是我收到了错误:

Wrong number of arguments: (lambda nil "Switch to specified screen." (interactive) (let ((next-screen (string-to-number (string last-command-char)))) (if (and (<= 0 next-screen) (<= next-screen 9)) (elscreen-goto next-screen)))), 1

有什么想法吗?

2 个答案:

答案 0 :(得分:2)

好像elscreen-jump没有接受任何参数,请尝试使用(elscreen-goto 3)

答案 1 :(得分:0)

我认为这只是你的elscreen-prefix-key + 0,1,2,...默认情况下,前缀键是C-z(例如,C-z 0)。您可以自定义此变量,但如果将其设置为“M”则会改变很多内容。密钥绑定在elscreen.el

(defvar elscreen-map (make-sparse-keymap)
  "Keymap for ElScreen.")
(define-key elscreen-map "\C-c" 'elscreen-create)
(define-key elscreen-map "c"    'elscreen-create)
(define-key elscreen-map "C"    'elscreen-clone)
(define-key elscreen-map "\C-k" 'elscreen-kill)
(define-key elscreen-map "k"    'elscreen-kill)
(define-key elscreen-map "\M-k" 'elscreen-kill-screen-and-buffers)
(define-key elscreen-map "K"    'elscreen-kill-others)
(define-key elscreen-map "\C-p" 'elscreen-previous)
(define-key elscreen-map "p"    'elscreen-previous)
(define-key elscreen-map "\C-n" 'elscreen-next)
(define-key elscreen-map "n"    'elscreen-next)
(define-key elscreen-map "\C-a" 'elscreen-toggle)
(define-key elscreen-map "a"    'elscreen-toggle)
(define-key elscreen-map "'"    'elscreen-goto)
(define-key elscreen-map "\""   'elscreen-select-and-goto)
(define-key elscreen-map "0"    'elscreen-jump-0)
(define-key elscreen-map "1"    'elscreen-jump)
(define-key elscreen-map "2"    'elscreen-jump)
(define-key elscreen-map "3"    'elscreen-jump)
(define-key elscreen-map "4"    'elscreen-jump)
(define-key elscreen-map "5"    'elscreen-jump)
(define-key elscreen-map "6"    'elscreen-jump)
(define-key elscreen-map "7"    'elscreen-jump)
(define-key elscreen-map "8"    'elscreen-jump)
(define-key elscreen-map "9"    'elscreen-jump-9)
(define-key elscreen-map "\C-s" 'elscreen-swap)
(define-key elscreen-map "\C-w" 'elscreen-display-screen-name-list)
(define-key elscreen-map "w"    'elscreen-display-screen-name-list)
(define-key elscreen-map "\C-m" 'elscreen-display-last-message)
(define-key elscreen-map "m"    'elscreen-display-last-message)
(define-key elscreen-map "\C-t" 'elscreen-display-time)
(define-key elscreen-map "t"    'elscreen-display-time)
(define-key elscreen-map "A"    'elscreen-screen-nickname)
(define-key elscreen-map "b"    'elscreen-find-and-goto-by-buffer)
(define-key elscreen-map "\C-f" 'elscreen-find-file)
(define-key elscreen-map "\C-r" 'elscreen-find-file-read-only)
(define-key elscreen-map "d"    'elscreen-dired)
(define-key elscreen-map "\M-x" 'elscreen-execute-extended-command)
(define-key elscreen-map "i"    'elscreen-toggle-display-screen-number)
(define-key elscreen-map "T"    'elscreen-toggle-display-tab)
(define-key elscreen-map "?"    'elscreen-help)
(define-key elscreen-map "v"    'elscreen-display-version)
(define-key elscreen-map "j"    'elscreen-link)
(define-key elscreen-map "s"    'elscreen-split)

文件标题还包含对这些功能的简要说明。