97

Emacs ではC-x o、次のウィンドウに移動します。

Emacs の前のウィンドウに移動するキーボード マクロは?

4

13 に答える 13

109

また、ジオメトリに基づいて選択したウィンドウに移動できるwindmoveを使用してみることもできます。.emacsファイルには、Cx矢印キーを使用してウィンドウを変更するための次のものがあります。

(global-set-key (kbd "C-x <up>") 'windmove-up)
(global-set-key (kbd "C-x <down>") 'windmove-down)
(global-set-key (kbd "C-x <right>") 'windmove-right)
(global-set-key (kbd "C-x <left>") 'windmove-left)
于 2008-09-18T20:27:11.600 に答える
90

それだろうC-- C-x o

つまり、C-x o引数が -1 の場合です。C-uのように、 と コマンドの間に数値引数を挿入することで、移動するウィンドウの数を指定できますC-u 2 C-x o。(C--は のショートカットC-u - 1)

于 2008-09-18T09:05:05.327 に答える
32

個人的に私は使用することを好みますwindow-number.el

別のウィンドウを選択するには、Ctrl- xCtrl- j nを使用します

ここで、 nはウィンドウの番号です。スクリーンショットに示すように、各ウィンドウのモードラインにはその番号が表示されます。

window-number.elをダウンロードし、emacs のロードパスに配置して、.emacs

 (autoload 'window-number-mode "window-number"
   "A global minor mode that enables selection of windows according to
 numbers with the C-x C-j prefix.  Another mode,
 `window-number-meta-mode' enables the use of the M- prefix."
   t)

ウィンドウに大きな数字を表示する、別の同様のモードがありswitch-window.elます... (数字を押すと、ウィンドウが切り替わり、表示が元に戻ります。)


(ソース: tapoeh.org )

于 2012-06-25T05:57:05.830 に答える
14

複数のemacsウィンドウ(> 3)を頻繁に使用していて、いくつかのキーストロークを保存したい場合は、これをinitファイルに追加してください。

(defun frame-bck()
  (interactive)
  (other-window-or-frame -1)
)
(define-key (current-global-map) (kbd "M-o") 'other-window-or-frame)
(define-key (current-global-map) (kbd "M-O") 'frame-bck)

今すぐMoで窓をすばやく循環します

于 2012-02-16T04:54:55.750 に答える
12

ここには非常に優れた完全な回答がいくつかありますが、最小限の方法で質問に答えるには:

 (defun prev-window ()
   (interactive)
   (other-window -1))

 (define-key global-map (kbd "C-x p") 'prev-window)
于 2013-08-01T02:52:36.453 に答える
4

@Nate のアイデアに基づいていますが、ウィンドウ間の後方循環をサポートするためにわずかに変更されています

;; Windows Cycling
(defun windmove-up-cycle()
  (interactive)
  (condition-case nil (windmove-up)
    (error (condition-case nil (windmove-down)
         (error (condition-case nil (windmove-right) (error (condition-case nil (windmove-left) (error (windmove-up))))))))))

(defun windmove-down-cycle()
  (interactive)
  (condition-case nil (windmove-down)
    (error (condition-case nil (windmove-up)
         (error (condition-case nil (windmove-left) (error (condition-case nil (windmove-right) (error (windmove-down))))))))))

(defun windmove-right-cycle()
  (interactive)
  (condition-case nil (windmove-right)
    (error (condition-case nil (windmove-left)
         (error (condition-case nil (windmove-up) (error (condition-case nil (windmove-down) (error (windmove-right))))))))))

(defun windmove-left-cycle()
  (interactive)
  (condition-case nil (windmove-left)
    (error (condition-case nil (windmove-right)
         (error (condition-case nil (windmove-down) (error (condition-case nil (windmove-up) (error (windmove-left))))))))))

(global-set-key (kbd "C-x <up>") 'windmove-up-cycle)
(global-set-key (kbd "C-x <down>") 'windmove-down-cycle)
(global-set-key (kbd "C-x <right>") 'windmove-right-cycle)
(global-set-key (kbd "C-x <left>") 'windmove-left-cycle)
于 2011-05-21T10:58:28.730 に答える
4

@Nate、@aspirin、@Tloydmの回答に追加するだけで、windmoveコマンドを選択したキーの組み合わせにバインドすることにした場合、これは非常に役立つ追加であることがわかりました。

(setq windmove-wrap-around t)

デフォルトの構成では、存在しないウィンドウに移動しようとするとエラーが発生し、しばらくすると面倒になります。ただし、windmove-wrap-around が設定されている場合、たとえばフレームの下部から移動しようとすると、代わりにフレームの一番上のウィンドウが選択されます。これは、より直感的な動作かもしれません。

于 2012-10-01T04:02:04.417 に答える
3

ネイトの答えを参照して、私arrow keysは伝統的な go 、 for going 、 for going 、 for going を使用pするupようにndown置き換えました。また、デフォルトの移動キーと同じようにキーを置き換えました。この との組み合わせにより、キーストロークごとに 1 つずつ移動する代わりに、文字や行をジャンプできます。したがって、キーは簡単なキーバインドを維持するための最良の選択だと感じました。また、もうホームローから手を離す必要はありません!frightbleftCtrlSuperC-p, C-n, C-f and C-bMSuper

(global-set-key (kbd "s-p") `windmove-up)
(global-set-key (kbd "s-n") `windmove-down)
(global-set-key (kbd "s-f") `windmove-right)
(global-set-key (kbd "s-b") `windmove-left)

それが役に立てば幸い!

于 2014-06-10T13:24:03.730 に答える
1

M- を使用してウィンドウを切り替えることができるパッケージが既にあります。このウェブサイトをチェックしてください。これを init ファイルに追加します。

(require 'windmove)
(windmove-default-keybindings 'meta) ;; or use 'super to use windows key instead alt
于 2012-07-30T23:06:02.183 に答える
0
(global-set-key (kbd "C-x a") 'ace-swap-window)  
(global-set-key (kbd "C-x q") 'ace-select-window)

download ace-window from the melpa repo if you don't know how to do that
put this in your .emacs file if you don't have one create it 

(package-initialize)                                                                                                                                                                     

(require 'package)                                                                                                                                                                       
(add-to-list 'package-archives '("melpa" , "http://melpa.org/packages/"))                                                                                                                

(package-initialize) 

then "m-x list-packages"
于 2018-04-09T11:40:12.230 に答える