102

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: (windmove-default-keybindings) You can then switch to neighbouring windows using the following keys (...


62

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 ...


56

Registers: C-xrSPC runs point-to-register C-xrj runs jump-to-register Type any character to specify a register when prompted.1 Bookmarks: C-xrm runs bookmark-set C-xrb runs bookmark-jump Mark ring: C-SPCC-SPC pushes the current position to the mark ring (without leaving it active). C-uC-SPC pops the mark ring, jumping to the previous position. You can ...


24

M-x scroll-all-mode does exactly that. You can also refer to the emacs wiki on scroll-all-mode and how to make synchronized scrolling work with mouse scrolling.


21

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 () (interactive) (other-window -1)) This is especially useful for moving multiple windows; ...


20

Emacs windows C-x 2 will open another window (=split the frame) below the current one, attached to the same buffer. You can move point in either window without affecting the other. You can move from one window to the other using C-x o. The built-in windmove library provides some function that makes navigating between windows easier. If this method suits ...


18

In addition to phils's answer, there are some more options: helm-all-mark-rings: It allows you to view the content of the both the local and global mark rings in a friendly interface, so you can always jump back to where you were. You can push mark with C-SPC C-SPC. Demo: helm-semantic-or-imenu: List all available definitions in the current file. If ...


13

window-numbering.el ! 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 ...


11

Take a look at superword-mode and subword-mode. Superword treats underscores as part of a word instead of a boundary, so foo_bar would be treated as a single word. Subword does the opposite but for camelCase, so fooBar is treated as two words instead of one. It sounds like the behavior you want is for cc-mode to use superword-mode. (add-hook 'c-mode-common-...


11

Just use the built-in asm-mode. It gives you syntax highlighting for any assembly languages. gas-mode does not do that and is not usable with AT&T syntax. If you want to set indentation for asm-mode, note that you cannot use tab-width but tab-stop-list that specifies spaces that 1 tab, 2 tabs, 3 tabs... can display: (setq tab-stop-list '(4 8 12 16 20 ...


10

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 ...


9

I tend to end up using occur (or more specifically helm-swoop) to narrow down my choices. However you can also use paradox, which extends the functionality of the basic package manager. This include S x sorting options as well as single key next and status. It also has its own filter options: notably, f u will narrow down to all packages affected by an ...


9

Besides registers and markers (see @phils's answer about both and my other, Icicles answer about markers), bookmarks, particularly either autonamed or temporary bookmarks, can be helpful for this. You need library Bookmark+ for these special bookmark types. An autonamed bookmark is one that you do not need to name. It is quick to create and delete: just hit ...


8

If you use Icicles then C-x o lets you select windows by name (or by cycling). With no prefix arg, C-x o is the same as usual, other-window, unless the frame has only one window, in which case it is other-frame. With a prefix arg, C-x o is a multi-command that lets you navigate among windows or frames by name (or by cycling). Navigating among windows uses ...


8

Some people may remember the editor Brief (funnily enough produced by a company called Underware). It had a neat way to switch between visible windows. M-arrow would move the cursor into the window directly in line with the direction of the arrow key. So, I mapped the winmove-left, winmove-right, winmove-up and winmove-down functions to M-left, M-right, M-...


7

With regard to indirect buffers mentioned in the accepted answer... M-x clone-indirect-buffer will create an indirect buffer for the current buffer. The name of the new buffer will have '<2>' added to it (or a greater number if you've already got duplicate buffer names). The new buffer is opened in a new window. You can switch back to a single window ...


7

The reason you sometimes see “interactive compiled Lisp function” (or likewise for variables) with no file name is that the function was loaded from a byte-compiled file and the corresponding Elisp source file is not present. In order to show you the source code, Emacs has to be able to find the source code. Many distributions ship Lisp source files in a ...


7

That isn't supported yet but you can do it "the other way around". Instead of pressing RET to show and select the revision buffer, press SPC to show the revision buffer but stay in the log buffer. When you move to another revision in the log buffer, the revision buffer is automatically updated. And you can press SPC again to scroll the revision buffer, ...


6

Use C-l or the command (function) bound to it, recenter-top-bottom. Hit it repeatedly up to 3 times, to cycle among different vertical positions for the cursor. See the full doc for the command for more possibilities: C-l runs the command recenter-top-bottom (found in global-map), which is an interactive compiled Lisp function in window.el. It is ...


6

It's unclear to me why you want/need to add such symlinks. Why not just use Emacs bookmarks? If you use Bookmark+ then you can have: Bookmarks to Dired buffers (which record lots of stuff, including markings, subdir insertions, omit settings, etc.). Bookmarks to bookmark files (to load different sets of bookmarks). Bookmarks to bookmark-list displays (...


5

The following advice achieves the behavior I want: (defadvice mouse-set-point (around cv/mouse-set-point (event) activate) (let ((event-name (car event)) (event-target-window (posn-window (event-start event)))) (if (and (eql 'down-mouse-1 event-name) (eql event-target-window (selected-window))) ad-do-it (select-...


5

There are two commands that can help out here. One is mentioned by Drew in a previous answer: recenter-top-bottom, which is bound to C-l by default, keeps point at the same position in the text file, but scrolls the window with the text file to move that position to the center, top and then bottom of the file. This is often useful when point is near the ...


5

I'm not aware of a built-in function for this, but as you already noted you can write one: (defun goto-paragraph (arg) "Go to paragraph ARG." (interactive "nGoto paragraph: ") (goto-char (point-min)) (forward-paragraph arg))


4

Emacs should already use "the appropriate word boundaries for the syntax of the current language". If it does not then file a bug for the major mode for that language. But maybe you don't really mean words. Maybe you mean symbol syntax, not word syntax. Emacs distinguishes the two. For symbol syntax, use symbol commands, not word commands: forward-symbol,...


4

Consider using a key-chord for quickly jumping between windows. I find it much quicker than reaching for a modifier key(and less straining on my hands, as well). My choice of package to use is ace-window, which lets you navigate multiple windows easier than just other-window. (require 'key-chord) (key-chord-define-global "xo" 'ace-window) (key-chord-mode +...


4

You can hit C-M-e twice then C-M-a once to move to the beginning of the next defun, from anywhere in the current defun (those key bindings navigate across whole defuns). Other than that, you probably want to get into Paredit (or SmartParens), for editing s-expressions. (The C-M-f of Paredit does not behave exactly the way you describe, but will skip the ...


4

The echo area is not really a buffer. It is an area of a window. It is used to display messages and to display the minibuffer (which is a buffer). You cannot "visit" the echo area and select text there, as you would a buffer. You or your code needs instead to visit buffer *Messages*, where messages are logged. (Not everything displayed in the echo area gets ...


4

There are several ways to do this. One of my preferred methods is the bm package. The package provides visual bookmarks: The setup is dead simple: (require 'bm) (global-set-key (kbd "<C-f2>") 'bm-toggle) (global-set-key (kbd "<f2>") 'bm-next) (global-set-key (kbd "<S-f2>") 'bm-previous) You can change the color of the bookmark with ...


4

I use this in several of my libraries. Use it to make pretty much any command repeatable even when it's on a prefix key. (defun repeat-command (command) "Repeat COMMAND." (require 'repeat) (let ((repeat-previous-repeated-command command) (repeat-message-function #'ignore) (last-repeatable-command 'repeat)) (...


3

Some good answers here, I also am a fan of WinMove, but I bind it to C- because org-mode uses M- for manipulating headings (define-key global-map (kbd "C-<up>") 'windmove-up) (define-key global-map (kbd "C-<down>") 'windmove-down) (define-key global-map (kbd "C-<left>") 'windmove-left) (define-key global-map (kbd "C-<right>") '...


Only top voted, non community-wiki answers of a minimum length are eligible