![]() ![]() If you don’t know the difference, read Running shells in Emacs: an overview. This runs M-x shell, my preferred one of the terminal/shell wrappers in Emacs. I don’t often resize my windows any more (my high monitor resolution means I don’t have to) but it’s occasionally useful, and definitely more useful than the useless and impossibly-hard-to-type C-x ^, et al. This calls shrink/enlarge-window-horizontally and enlarge/shrink-window respectively. I bind these to my smart scan next/previous commands. Instead I bind it to a custom command that, using IDO, gives me a list of recent files I’ve opened. The few occasions I need to do this I just set it as read only. ![]() It’s great.īy default this will run find-file-read-only, a command that finds a file but opens it as read only. It prompts me for a remote host to SSH to using an M-x ansi-term session. This I bind to CSSH’s cssh-term-remote-open. Read my article on repeating commands for more info. This key will kill the active buffer without any prompting whatsoever. I kill buffers all the time, and the idea of killing a buffer that is not active is just not part of my workflow at all. Very useful, but Ubuntu and Unity (in their wisdom) have decided that I am not allowed to rebind this key…. When pressed it’ll jump around in the mark ring. This is taken from my article on fixing the mark commands. This key is surprisingly unbound in most modes. This I bind to a custom Helm command that calls up some of my more frequent things. M-o is normally bound to some rich text formatting nobody cares about. The command other-window is normally bound to C-x o but I find that way too cumbersome for what is such a frequent operation. Most of them are quality of life improvements: I want to make it easier to type things I do frequently. Having said that… there are keys I rebind and commands I explicitly bind to keys. See the similarities? The C- for character, M- for word and C-M- for s-exp is a recurring pattern in Emacs. It moves forward by the character, but M-f moves forward by word, and C-M-f moves forward by an s-expression. ![]() Rebinding keys is something you should do as a last resort: if you’re new to Emacs and your first impulse is to rebind everything – stop! Learn Emacs first and then decide.Ĭonsider C-f. This is particularly true of the “core” bindings in Emacs. I think rebinding keys in Emacs – even though, in essence, the editor is built around the idea of customization – is a perilous thing to do if you are not careful: people do it without knowing why the key is bound to what it is. M-r cycle top, bottom and middle of current screen.I figured I’d write a blog post about the keys I’ve bound but also rebound in Emacs. M-% to search and replace in current file. M-x comment-region (I’ve set it to C-c c) comments the selected region and M-x uncomment-region (I’ve set it to C-c C-u c) uncomments the selected region (perfect for languages like PicoLisp, Clojure and Ruby).Ĭ-right arrow and C-left arrow to slurp/barf the next s-expr.Ĭ-q to for instance insert a semi-colon without also triggering the automatic generation of a newline. And paste with C-y.Ĭ-x C-b to see the buffer switcher and C-x k to kill a buffer.Ĭ-M-d and C-M-u, to move down one sexpr and up one sexpr.Ĭ-x 0 will close the current window/frame.Ĭ-M b and C-M f to move to the beginning and end of the s-expr. Repeat the just saved macro 9 times with M-9 C-x e.Ĭ-x C-k n => Give a command name to the latest recorded macro. Start recording macro with f3 and stop with f4. M-UP => (let |(some expression)) ->(some => Mark the preceding expression.Ĭ-M-\ => Re-indent selection, great in combination with to start marking, C-g to stop.Ĭ-x C-f => Opens up the find file buffer.Ĭ-h k -> key-combo to see what function key-combo is mapped to.Ĭ-x 1 to close all but the current frame. Some of my Emacs key bindings, some are standard, others custom.Ĭ-M-k -> and then paste the expression into it. ![]()
0 Comments
Leave a Reply. |