开发者

Emacs elscreen - how do I jump to numbered tabs

开发者 https://www.devze.com 2023-01-16 14:46 出处:网络
Elscreen has a method called elscreen-jump and also elscreen-jump-0 and elscreen-jump-9. I\'d开发者_如何转开发 like to be able to jump to tabs between 0 and 9. How do I define a keymap for this? I\'ve

Elscreen has a method called elscreen-jump and also elscreen-jump-0 and elscreen-jump-9. I'd开发者_如何转开发 like to be able to jump to tabs between 0 and 9. How do I define a keymap for this? I've tried:

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

but I get an error:

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

Any ideas?


It appears as if elscreen-jump doesn't take any arguments, try using the (elscreen-goto 3) instead.


I believe that is just your elscreen-prefix-key + 0, 1, 2, ... By default, the prefix key is C-z (so for instance, C-z 0). You can customize this variable, but if you set it to "M" that'll change a whole lot of things. The key bindings are in 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)

And the file header also contains brief explanations of each of these functions.

0

精彩评论

暂无评论...
验证码 换一张
取 消