Emacs ではC-x o、次のウィンドウに移動します。
Emacs の前のウィンドウに移動するキーボード マクロは?
また、ジオメトリに基づいて選択したウィンドウに移動できる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)
それだろうC-- C-x o
つまり、C-x o引数が -1 の場合です。C-uのように、 と コマンドの間に数値引数を挿入することで、移動するウィンドウの数を指定できますC-u 2 C-x o。(C--は のショートカットC-u - 1)
個人的に私は使用することを好みますwindow-number.el
別のウィンドウを選択するには、Ctrl- x、Ctrl- 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 )
複数の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で窓をすばやく循環します
ここには非常に優れた完全な回答がいくつかありますが、最小限の方法で質問に答えるには:
(defun prev-window ()
(interactive)
(other-window -1))
(define-key global-map (kbd "C-x p") 'prev-window)
@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)
@Nate、@aspirin、@Tloydmの回答に追加するだけで、windmoveコマンドを選択したキーの組み合わせにバインドすることにした場合、これは非常に役立つ追加であることがわかりました。
(setq windmove-wrap-around t)
デフォルトの構成では、存在しないウィンドウに移動しようとするとエラーが発生し、しばらくすると面倒になります。ただし、windmove-wrap-around が設定されている場合、たとえばフレームの下部から移動しようとすると、代わりにフレームの一番上のウィンドウが選択されます。これは、より直感的な動作かもしれません。
ネイトの答えを参照して、私arrow keys
は伝統的な go 、 for going 、 for going 、 for going を使用p
するup
ようにn
をdown
置き換えました。また、デフォルトの移動キーと同じようにキーを置き換えました。この との組み合わせにより、キーストロークごとに 1 つずつ移動する代わりに、文字や行をジャンプできます。したがって、キーは簡単なキーバインドを維持するための最良の選択だと感じました。また、もうホームローから手を離す必要はありません!f
right
b
left
Ctrl
Super
C-p, C-n, C-f and C-b
M
Super
(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)
それが役に立てば幸い!
M- を使用してウィンドウを切り替えることができるパッケージが既にあります。このウェブサイトをチェックしてください。これを init ファイルに追加します。
(require 'windmove)
(windmove-default-keybindings 'meta) ;; or use 'super to use windows key instead alt
(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"