代码之家  ›  专栏  ›  技术社区  ›  lukaszkorecki

如何从终端缓冲区切换到不同的缓冲区

  •  43
  • lukaszkorecki  · 技术社区  · 15 年前

    我已经使用emacs几个星期了,到目前为止,它非常棒——来自 vim 比我想象的要简单(实际上-emacs的键盘快捷键感觉更。。。自然的)。

    我添加了一些定制,比如使用 M-Left/Right/Up/Down 因为 C-x o 当我同时打开四个文件时,感觉有点太慢了。

    到目前为止-很好:-)

    1. 我打开一些分裂使用 C-x 3 C-x 2
    2. M-x term ENT
    3. 如何使用键盘切换到不同的分割?

    通常的快捷方式显然不起作用——终端正在拦截每个emacs命令,我必须点击不同的缓冲区来激活它。

    5 回复  |  直到 15 年前
        1
  •  152
  •   Josh Matthews    15 年前

    在术语模式中,任何常规 C-x whatever C-c whatever 相反

        2
  •  12
  •   Trey Jackson    15 年前

    我不确定我是否理解你的问题。如果你跑 M-x终端 ,大多数关键事件被发送到底层终端,因此 C-xo 绑定和您的

    试用 要在其中一个窗口中获取shell,您设置的导航绑定应该仍然有效。

        3
  •  10
  •   offby1    15 年前

    在术语模式中,输入 C-c b RET 切换到其他缓冲区。

    这就是C-x b RET通常所做的。

        4
  •  5
  •   Noufal Ibrahim    13 年前

    这应该可以让C-Xb正常工作。您可能必须为任何自定义移动命令添加绑定。

    (add-hook 'term-mode-hook
       (lambda ()
         ;; C-x is the prefix command, rather than C-c
         (term-set-escape-char ?\C-x)
         (define-key term-raw-map "\M-y" 'yank-pop)
         (define-key term-raw-map "\M-w" 'kill-ring-save)))
    

    顺便说一句,shell模式和term模式有很大的区别。前者更好地与emacs集成(例如cd命令)。后者是一个完整的终端仿真,可以处理curses程序。他们都有自己的位置。

        5
  •  2
  •   Joe Casadonte    15 年前

    有关emacs窗口的更一般的答案,您可以查看 windmove

    ;;; Commentary:
    ;;
    ;; This package defines a set of routines, windmove-{left,up,right,
    ;; down}, for selection of windows in a frame geometrically.  For
    ;; example, `windmove-right' selects the window immediately to the
    ;; right of the currently-selected one.  This functionality is similar
    ;; to the window-selection controls of the BRIEF editor of yore.
    ;;
    ;; One subtle point is what happens when the window to the right has
    ;; been split vertically; for example, consider a call to
    ;; `windmove-right' in this setup:
    ;;
    ;;                    -------------
    ;;                    |      | A  |
    ;;                    |      |    |
    ;;                    |      |-----
    ;;                    | *    |    |    (* is point in the currently
    ;;                    |      | B  |     selected window)
    ;;                    |      |    |
    ;;                    -------------
    ;;
    ;; There are (at least) three reasonable things to do:
    ;; (1) Always move to the window to the right of the top edge of the
    ;;     selected window; in this case, this policy selects A.
    ;; (2) Always move to the window to the right of the bottom edge of
    ;;     the selected window; in this case, this policy selects B.
    ;; (3) Move to the window to the right of point in the selected
    ;;     window.  This may select either A or B, depending on the
    ;;     position of point; in the illustrated example, it would select
    ;;     B.
    ;;
    ;; Similar issues arise for all the movement functions.  Windmove
    ;; resolves this problem by allowing the user to specify behavior
    ;; through a prefix argument.  The cases are thus:
    ;; * if no argument is given to the movement functions, or the
    ;;   argument given is zero, movement is relative to point;
    ;; * if a positive argument is given, movement is relative to the top
    ;;   or left edge of the selected window, depending on whether the
    ;;   movement is to be horizontal or vertical;
    ;; * if a negative argument is given, movement is relative to the
    ;;   bottom or right edge of the selected window, depending on whether
    ;;   the movement is to be horizontal or vertical.