One way is to use windmove. With its default keybindings, it allows switching to the window next to the currently active one.
It's built in Emacs, so there is no need to install anything; just activate it with the following minimal setup in your init file:
You can then switch to neighbouring windows using the following keys (...
I obviously prefer ace-window for this.
You can switch between visible windows and frames. It's in MELPA, you can install it quickly.
The only thing left to do is to bind it:
(global-set-key (kbd "C-x o") 'ace-window)
Or maybe use a shorter key chord, since switching windows is a common task:
(global-set-key (kbd "M-p") 'ace-window)
Summary of ace-window
Emacs predates contemporary window-based operating systems, so its
terminology also predates the current terms. Unfortunately, it means that new users and experienced users sometimes have trouble making themselves understood to each other, since they're using the terms in different ways.
"Frames" are to Emacs what "windows" are to everything ...
The built in way to do this is with registers.
For instance use C-xrwa to save the current window configuration to register a.
Then you can use the built in binding C-x1 to run delete-other-windows
after you're done looking at the single file, use C-xrja to pop back to the saved window configuration in register a.
C-xrwa (save config into ...
You can bind other-window to an easier-to-type key sequence.
For example, I have C-. bound to other-window, and C-, bound to go to the previous window.
(global-set-key (kbd "C-.") #'other-window)
(global-set-key (kbd "C-,") #'prev-window)
(defun prev-window ()
This is especially useful for moving multiple windows; ...
C-x- (shrink-window-if-larger-than-buffer) to shrink a window to fit its content.
C-x+ (balance-windows) to make windows the same heights and widths.
C-x^ (enlarge-window) to increase height by 1 line, or the prefix arg value. A negative arg shrinks the window. Example: C-u - 3 C-x ^
I use winner-mode. Here's my setup:
(global-set-key [f7] 'winner-undo)
(global-set-key [C-f7] 'winner-redo)
(global-set-key [f9] 'delete-other-windows)
(global-set-key [C-f9] 'delete-window)
I don't know if there's a way to bookmark a layout or something, but being able to
continuously switch back to previous layout is enough for me.
If you mean the number of windows regardless of which buffers are showing, then: (length (window-list)) will do it. Better still, you can just use the existing (count-windows) function.
If you want to count the number of unique buffers visible in windows on the frame, then you can use:
(length (cl-delete-duplicates (mapcar #'window-buffer (window-list))))
The content of the mode-line are stored in the variable mode-line-format. Emacs also supports a header line whose content is steered by the variable header-line-format.
In principle you can use
(setq header-line-format mode-line-format)
(setq-default mode-line-format nil)
to make the format of the header-line be equal to that of your current mode line and ...
It is possible to configure how a buffer opens (in the same frame/window or a different frame/window) using display-buffer-alist. Refer to the references below to learn more about this variable.
We need to tell emacs to always open buffers ending with COMMIT_EDITMSG in a window but not in the same (*magit ..*) window.
Add the following snippet to ...
I second @Nsukami's suggestion to use dedicated windows. Since it is a function, not a command, using set-window-dedicated-p directly can be cumbersome. With the following command and associated key binding, you can toggle "dedicatedness" of any window by pressing C-c t:
(defun toggle-window-dedicated ()
"Control whether or not Emacs is allowed to display ...
Alternatively, there's a tranpose-frame package on EmacsWiki that will allow you to transpose the whole frame, as well as do other transformations (rotate by by 180 degrees; rotate by 90 degrees clockwise or counterclockwise; flip horizontally or vertically).
Here's a defun that would do what you are looking for:
(defun toggle-window-split ()
(if (= (count-windows) 2)
(let* ((this-win-buffer (window-buffer))
(next-win-buffer (window-buffer (next-window)))
(this-win-edges (window-edges (selected-window)))
(next-win-edges (window-edges (next-window)))
I'm using Spacemacs (on Windows 10 if that matters) with the default keybindings. This may differ from your configuration, but I found the following ways to open files via Helm-Find-Files:
Open Helm-Find-Files - SPCff
Type in filename (via tab completion etc.). Once file has been selected, there are 3 options I use for opening the file:
Option 1. Tab to ...
The different sections of text you see in your Emacs are windows. You can, for example, create a new window with C-x 2. Yes, this terminology is confusing. It predates most GUI systems, so it's understandable if still confusing.
But once we know we're talking about windows, we can do the changes you want. To get rid of all windows except the one that point ...
Looking quickly at the code (in library compile.el), you should be able to just kill or hide the displayed buffer by using a function on hook compilation-finish-functions. To do that, use something like this:
(add-hook 'compilation-finish-functions (lambda (buf strg) (kill-buffer buf))
If you don't want to kill the buffer, then use something like this:
I assign the hotkey ",1", ",2", ",3" to switch specific window (please note I use evil-mode)
besides, I display the window number at the mode line in PINK color, underlined.
It's a visual hint you can never ignore,
That's quickest way to switch window.
check https://github.com/redguardtoo/emacs.d/blob/master/lisp/init-evil.el and ...
Since Emacs 24.4, you can use desktop-save-mode. It's been part of Emacs for ages, but the window layout is only saved and restored since version 24.4.
Just add this line in your init file:
Here's a simple function that will toggle between a horizontal and vertical split. It assumes you've only got two windows, and doesn't do any resizing:
(defun window-split-toggle ()
"Toggle between horizontal and vertical split with two windows."
(if (> (length (window-list)) 2)
(error "Can't toggle with more than 2 windows!")
years ago on the #emacs IRC channel I got this bit of code I've been using forever. The value "2 sec" sets the amount of time the successful compilation window stays visible.
; from enberg on #emacs
(lambda (buf str)
(if (null (string-match ".*exited abnormally.*" str))
;;no errors, make the compilation ...
Emacs offers registers to save and apply data such as your current window configuration, this can be done with C-x r w and C-x r j. However this approach gets unwieldy since you need to remember the window registers.
There are a few packages to improve this. iregister makes this basic feature more inspectable and interactive. The other ones I'm aware of use ...
Without using any additional add-ons, you can continue to use C-x o with an optional prefix to skip over that many windows. Eg: C-u 1 C-x o will go to the next window in the order (ie, what you would get with plain C-x o), C-u 2 C-x o goes two windows over, C-u 3 C-x o goes three windows over, and so on.
An excerpt from the other-window docstring (the ...
Since mention that the command is running asynchronously I am assuming you mean the command async-shell-command bound to M-&. You can follow the advice in documentation of async-shell-command (you can read it by doing C-hfasync-shell-commandRET) customize display-buffer-alist as follows
(add-to-list 'display-buffer-alist (cons "\\*Async Shell Command\\*....
You need to configure the 600-pound gorilla that is display-buffer-alist which determines how display-buffer chooses where to display a buffer. It makes display-buffer-reuse-frames obsolete in newer emacsen. Here is a config that should guide you (atleast in emacs 24.3).
;; all buffers, try to reuse windows across all frames
I believe this behavior is not specific to org-agenda, but rather depends on the size of the window and the variables split-width-threshold and split-height-threshold. If your window is wide enough the agenda will open on the right.
You may want to try a lower split-width-threshold if you prefer to split things vertically (new window on the right). If you ...