A Collection of Ridiculously Useful eXtensions for Emacs. crux bundles a few useful interactive commands to enhance your overall Emacs experience.
MELPA Stable is recommended as it has the latest stable version. MELPA has a development snapshot for users who don't mind breakage but don't want to run from a git checkout.
You can install
crux using the following command:
M-x package-install [RET] crux [RET]
or if you'd rather keep it in your dotfiles:
(unless (package-installed-p 'crux) (package-refresh-contents) (package-install 'crux))
If the installation doesn't work try refreshing the package list:
crux doesn't setup any keybindings for its commands out-of-the-box.
Here's the list of some suggested keybindings. Feel free to bind individual commands to whatever keybindings you prefer.
||C-c o||Open the currently visited file with an external program.|
||C-k or Super-k||First kill to end of line, then kill the whole line.|
||C-S-RET or Super-o||Insert an empty line above the current line and indent it properly.|
||S-RET or M-o||Insert an empty line and indent it properly (as in most IDEs).|
||C-c n||Fix indentation in buffer and strip whitespace.|
||C-c f or Super-r||Open recently visited file.|
||C-c u||Open a new buffer containing the contents of URL.|
||C-c e||Eval a bit of Emacs Lisp code and replace it with its result.|
||C-x 4 t||Transpose the buffers between two windows.|
||C-c D||Delete current file and buffer.|
||C-c c||Copy current file with file attributes preserved|
||C-c d||Duplicate the current line (or region).|
||C-c M-d||Duplicate and comment the current line (or region).|
||C-c r||Rename the current buffer and its visiting file if any.|
||C-c t||Open a terminal emulator (
||C-c k||Kill all open buffers except the one you're currently in.|
||C-M z||Indent the definition at point.|
||C-c TAB||Indent and copy region to clipboard|
||C-c I||Open user's init file.|
||C-c ,||Open user's custom file.|
||C-c S||Open shell's init file.|
||Super-j or C-^||Join lines|
||Super-k||Kill whole line|
||C-Backspace||Kill line backwards|
||C-c i||Fix word using
Here's how you'd bind some of the commands to keycombos:
(global-set-key [remap move-beginning-of-line] #'crux-move-beginning-of-line) (global-set-key (kbd "C-c o") #'crux-open-with) (global-set-key [(shift return)] #'crux-smart-open-line) (global-set-key (kbd "s-r") #'crux-recentf-find-file) (global-set-key (kbd "C-<backspace>") #'crux-kill-line-backwards) (global-set-key [remap kill-whole-line] #'crux-kill-whole-line)
crux-ispell-word-then-abbrev to be most effective you'll also need to add this to your config:
(setq save-abbrevs 'silently) (setq-default abbrev-mode t)
Using the bundled advices
crux ships with some handy advises that can enhance the operation of existing commands.
You can use
crux-with-region-or-buffer to make a command acting
normally on a region to operate on the entire buffer in the absence of
a region. Here are a few examples you can stuff in your config:
(crux-with-region-or-buffer indent-region) (crux-with-region-or-buffer untabify)
Likewise, you can use
crux-with-region-or-line to make a command
alternately act on the current line if the mark is not active:
Sometimes you might want to act on the point until the end of the current line, rather than the whole line, in the absence of a region:
Crux provides a
crux-reopen-as-root command for reopening a file as
root. This global minor mode changes
find-file so all root files are
automatically opened as root.
Copyright © 2015 Bozhidar Batsov and contributors.
Distributed under the GNU General Public License; type C-h C-c to view it.