Such positive counts can also be negated, so if we wanted to delete 5 words to the left, we could press M-, M-5 and M-d. For example, if we wanted to delete 5 words to the right of the cursor. We can also prefix shortcuts with positive counts that causes the operation to be performed multiple times. Many of Emacs's default shortcuts can be prefixed with such negative arguments, by either using M- or C. This type of prefix is basically a negative count and it's officially referred to as a negative argument. It will perform the operation in the opposite direction and delete the first word to the left of the cursor. If we prefixed this command by first pressing M- and then M-d. By default this binding deletes a word to the right of the cursor. To demonstrate this we'll look at the kill-word shortcut, M-d. Making use of prefixesīefore we move on to the editing shortcuts, it's useful to know about Emacs's ability to prefix existing shortcuts with positive and negative counts. Be sure to give them a try, and you might also find them invaluable. If the cursor was somewhere inside a function, we can move the cursor to an outer block, using C-M-u (think of it as, up) and we can do the opposite by moving the cursor into deeper blocks, using C-M-d (think of this as, down).Įmacs provides a series of s-expression shortcuts for editing and movement commands. ![]() We can make use of the s-expression shortcuts, C-M-p and C-M-n to vertically move the cursor between each function, as long as the cursor is at the file's root level. Imagine you open up a C source file that defines a series of functions. If your unfamiliar with Emacs's s-expression shortcuts and how to use them, let me give you an example use case: These are intended for lisp like programming languages, but in Emacs they actually work for almost all languages. Taking advantage of the s-expression shortcutsĪside from the aforementioned movement shortcuts, I find myself making heavy use Emacs's s-expression shortcuts.
0 Comments
Leave a Reply. |