{"id":13592660,"url":"https://github.com/bbatsov/crux","last_synced_at":"2025-05-14T21:07:36.778Z","repository":{"id":3138012,"uuid":"48539486","full_name":"bbatsov/crux","owner":"bbatsov","description":"A Collection of Ridiculously Useful eXtensions for Emacs","archived":false,"fork":false,"pushed_at":"2025-02-12T20:17:57.000Z","size":205,"stargazers_count":959,"open_issues_count":15,"forks_count":54,"subscribers_count":13,"default_branch":"master","last_synced_at":"2025-04-13T17:46:58.229Z","etag":null,"topics":["emacs","emacs-lisp"],"latest_commit_sha":null,"homepage":"https://emacsredux.com","language":"Emacs Lisp","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bbatsov.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"bbatsov","patreon":"bbatsov","ko_fi":"bbatsov","liberapay":"bbatsov","custom":"https://www.paypal.me/bbatsov"}},"created_at":"2015-12-24T11:08:39.000Z","updated_at":"2025-04-13T16:52:42.000Z","dependencies_parsed_at":"2023-07-05T18:02:14.800Z","dependency_job_id":"3586a22c-667f-442e-8bd9-b80baafc58e2","html_url":"https://github.com/bbatsov/crux","commit_stats":{"total_commits":111,"total_committers":37,"mean_commits":3.0,"dds":0.5675675675675675,"last_synced_commit":"3998b753d0eb4fc5a64ed9c9f05a1427ff4be22d"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bbatsov%2Fcrux","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bbatsov%2Fcrux/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bbatsov%2Fcrux/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bbatsov%2Fcrux/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bbatsov","download_url":"https://codeload.github.com/bbatsov/crux/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254227613,"owners_count":22035670,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["emacs","emacs-lisp"],"created_at":"2024-08-01T16:01:11.793Z","updated_at":"2025-05-14T21:07:31.759Z","avatar_url":"https://github.com/bbatsov.png","language":"Emacs Lisp","funding_links":["https://github.com/sponsors/bbatsov","https://patreon.com/bbatsov","https://ko-fi.com/bbatsov","https://liberapay.com/bbatsov","https://www.paypal.me/bbatsov"],"categories":["Emacs Lisp"],"sub_categories":[],"readme":"[![License GPL 3][badge-license]][copying]\n[![MELPA][melpa-badge]][melpa-package]\n[![MELPA Stable][melpa-stable-badge]][melpa-stable-package]\n\n# crux\n\nA **C**ollection of **R**idiculously **U**seful e**X**tensions for Emacs.\ncrux bundles many useful interactive commands to enhance your\noverall Emacs experience.\n\nMost of the crux commands are related to the editing experience, but\nthere are also a bunch of utility commands that are just very useful\nto have (e.g. `crux-open-with` and `crux-reopen-as-root`).\n\n## Origins of crux\n\nMany of the functions in crux started life as blog posts on\n[Emacs Redux](https://emacsredux.com), then were included in\n[Emacs Prelude](https://www.github.com/bbatsov/prelude), before finally\nbeing [extracted](https://emacsredux.com/blog/2016/01/30/crux/)\nto crux. You can see a full list of blog posts on functions\nin crux on the [tags page](https://emacsredux.com/tags/#crux).\n\n## Installation\n\nAvailable on all major `package.el` community maintained repos -\n[MELPA Stable][] and [MELPA][] repos.\n\nMELPA Stable is recommended as it has the latest stable version.\nMELPA has a development snapshot for users who don't mind breakage but\ndon't want to run from a git checkout.\n\nYou can install `crux` using the following command:\n\n\u003ckbd\u003eM-x package-install [RET] crux [RET]\u003c/kbd\u003e\n\nIf the installation doesn't work try refreshing the package list:\n\n\u003ckbd\u003eM-x package-refresh-contents\u003c/kbd\u003e\n\nAlternatively, you can add the following code to your Emacs config:\n\n```el\n(unless (package-installed-p 'crux)\n  (package-refresh-contents)\n  (package-install 'crux))\n```\n\n## Keybindings\n\ncrux doesn't setup any keybindings for its commands out-of-the-box.\nThere are several reasons for this:\n\n* Most users probably won't need all the commands, so it'd be an overkill to\ndefine a minor mode consuming a lot of valuable keybindings\n* Many of the optimal keybindings are in the user space anyways (e.g. `C-c some-letter`)\n* Everyone has their own preferences when it comes to keybindings\n\nHere's the list of some suggested keybindings. Feel free to bind\nindividual commands to whatever keybindings you prefer.\n\nCommand                                             | Suggested Keybinding(s)         | Description\n----------------------------------------------------|---------------------------------|------------------------\n`crux-open-with`                                    | \u003ckbd\u003eC-c o\u003c/kbd\u003e   | Open the currently visited file with an external program.\n`crux-smart-kill-line`                              | \u003ckbd\u003eC-k\u003c/kbd\u003e or \u003ckbd\u003eSuper-k\u003c/kbd\u003e | First kill to end of line, then kill the whole line.\n`crux-smart-open-line-above`                        | \u003ckbd\u003eC-S-RET\u003c/kbd\u003e or \u003ckbd\u003eSuper-o\u003c/kbd\u003e | Insert an empty line above the current line and indent it properly.\n`crux-smart-open-line`                              | \u003ckbd\u003eS-RET\u003c/kbd\u003e or \u003ckbd\u003eM-o\u003c/kbd\u003e | Insert an empty line and indent it properly (as in most IDEs).\n`crux-cleanup-buffer-or-region`                     | \u003ckbd\u003eC-c n\u003c/kbd\u003e | Fix indentation in buffer and strip whitespace.\n`crux-recentf-find-file`                            | \u003ckbd\u003eC-c f\u003c/kbd\u003e or \u003ckbd\u003eSuper-r\u003c/kbd\u003e | Open recently visited file.\n`crux-recentf-find-directory`                       | \u003ckbd\u003eC-c F\u003c/kbd\u003e | Open recently visited directory.\n`crux-view-url`                                     | \u003ckbd\u003eC-c u\u003c/kbd\u003e | Open a new buffer containing the contents of URL.\n`crux-eval-and-replace`                             | \u003ckbd\u003eC-c e\u003c/kbd\u003e | Eval a bit of Emacs Lisp code and replace it with its result.\n`crux-transpose-windows`                            | \u003ckbd\u003eC-x 4 t\u003c/kbd\u003e | Transpose the buffers between two windows.\n`crux-delete-file-and-buffer`                       | \u003ckbd\u003eC-c D\u003c/kbd\u003e | Delete current file and buffer.\n`crux-copy-file-preserve-attributes`                | \u003ckbd\u003eC-c c\u003c/kbd\u003e | Copy current file with file attributes preserved\n`crux-duplicate-current-line-or-region`             | \u003ckbd\u003eC-c d\u003c/kbd\u003e | Duplicate the current line (or region).\n`crux-duplicate-and-comment-current-line-or-region` | \u003ckbd\u003eC-c M-d\u003c/kbd\u003e | Duplicate and comment the current line (or region).\n`crux-rename-file-and-buffer`                       | \u003ckbd\u003eC-c r\u003c/kbd\u003e | Rename the current buffer and its visiting file if any.\n`crux-visit-term-buffer`                            | \u003ckbd\u003eC-c t\u003c/kbd\u003e | Open a terminal emulator (`ansi-term`).\n`crux-kill-other-buffers`                           | \u003ckbd\u003eC-c k\u003c/kbd\u003e | Kill all open buffers except the one you're currently in.\n`crux-indent-defun`                                 | \u003ckbd\u003eC-M z\u003c/kbd\u003e | Indent the definition at point.\n`crux-indent-rigidly-and-copy-to-clipboard`         | \u003ckbd\u003eC-c TAB\u003c/kbd\u003e | Indent and copy region to clipboard\n`crux-find-user-init-file`                          | \u003ckbd\u003eC-c I\u003c/kbd\u003e | Open user's init file.\n`crux-find-user-custom-file`                        | \u003ckbd\u003eC-c ,\u003c/kbd\u003e | Open user's custom file.\n`crux-find-shell-init-file`                         | \u003ckbd\u003eC-c S\u003c/kbd\u003e | Open shell's init file.\n`crux-find-current-directory-dir-locals-file`       | \u003ckbd\u003eC-c D\u003c/kbd\u003e | Open current directory's `.dir-locals.el` file.\n`crux-top-join-line`                                | \u003ckbd\u003eSuper-j\u003c/kbd\u003e or \u003ckbd\u003eC-^\u003c/kbd\u003e | Join lines\n`crux-kill-whole-line`                              | \u003ckbd\u003eSuper-k\u003c/kbd\u003e | Kill whole line\n`crux-kill-line-backwards`                          | \u003ckbd\u003eC-Backspace\u003c/kbd\u003e | Kill line backwards\n`crux-kill-and-join-forward`                        | \u003ckbd\u003eC-S-Backspace\u003c/kbd\u003e or \u003ckbd\u003eC-k\u003c/kbd\u003e | If at end of line, join with following; otherwise kill line.\n`crux-kill-buffer-truename `                        | \u003ckbd\u003eC-c P\u003c/kbd\u003e | Kill absolute path of file visited in current buffer.\n`crux-ispell-word-then-abbrev`                      | \u003ckbd\u003eC-c i\u003c/kbd\u003e | Fix word using `ispell` and then save to `abbrev`.\n`crux-upcase-region`                                | \u003ckbd\u003eC-x C-u\u003c/kbd\u003e | `upcase-region` when `transient-mark-mode` is on and region is active.\n`crux-downcase-region`                              | \u003ckbd\u003eC-x C-l\u003c/kbd\u003e | `downcase-region` when `transient-mark-mode` is on and region is active.\n`crux-capitalize-region`                            | \u003ckbd\u003eC-x M-c\u003c/kbd\u003e | `capitalize-region` when `transient-mark-mode` is on and region is active.\n`crux-other-window-or-switch-buffer`                | \u003ckbd\u003eM-o\u003c/kbd\u003e     | Select other window, or switch to most recent buffer if only one windows.\n\nHere's how you'd bind some of the commands to keycombos:\n\n```el\n(global-set-key [remap move-beginning-of-line] #'crux-move-beginning-of-line)\n(global-set-key (kbd \"C-c o\") #'crux-open-with)\n(global-set-key [(shift return)] #'crux-smart-open-line)\n(global-set-key (kbd \"s-r\") #'crux-recentf-find-file)\n(global-set-key (kbd \"C-\u003cbackspace\u003e\") #'crux-kill-line-backwards)\n(global-set-key [remap kill-whole-line] #'crux-kill-whole-line)\n```\n\nFor `crux-ispell-word-then-abbrev` to be most effective you'll also need to add this to your config:\n\n```el\n(setq save-abbrevs 'silently)\n(setq-default abbrev-mode t)\n```\n\n## Using the bundled advices\n\ncrux ships with some handy advises that can enhance the operation of existing commands.\n\n#### `(crux-with-region-or-buffer)` ####\n\nYou can use `crux-with-region-or-buffer` to make a command acting\nnormally on a region to operate on the entire buffer in the absence of\na region. Here are a few examples you can stuff in your config:\n\n```el\n(crux-with-region-or-buffer indent-region)\n(crux-with-region-or-buffer untabify)\n```\n\n#### `(crux-with-region-or-line)` ####\n\nLikewise, you can use `crux-with-region-or-line` to make a command\nalternately act on the current line if the mark is not active:\n\n```el\n(crux-with-region-or-line comment-or-uncomment-region)\n```\n\n#### `(crux-with-region-or-sexp-or-line)` ####\n\nSimilarly, `crux-with-region-or-sexp-or-line` makes a command that acts on the active region, or else\nthe current list (or string), or finally the current line:\n\n```el\n(crux-with-region-or-sexp-or-line kill-region)\n```\n\n#### `(crux-with-region-or-point-to-eol)` ####\n\nSometimes you might want to act on the point until the end of the\ncurrent line, rather than the whole line, in the absence of a region:\n\n``` el\n(crux-with-region-or-point-to-eol kill-ring-save)\n```\n\n## Minor modes\n\n#### `(crux-reopen-as-root-mode)` ####\n\nCrux provides a `crux-reopen-as-root` command for reopening a file as\nroot. This global minor mode changes `find-file` so all root files are\nautomatically opened as root.\n\n## License\n\nCopyright © 2015-2025 Bozhidar Batsov and [contributors][].\n\nDistributed under the GNU General Public License; type \u003ckbd\u003eC-h C-c\u003c/kbd\u003e to view it.\n\n[badge-license]: https://img.shields.io/badge/license-GPL_3-green.svg\n[melpa-badge]: http://melpa.org/packages/crux-badge.svg\n[melpa-stable-badge]: http://stable.melpa.org/packages/crux-badge.svg\n[melpa-package]: http://melpa.org/#/crux\n[melpa-stable-package]: http://stable.melpa.org/#/crux\n[COPYING]: http://www.gnu.org/copyleft/gpl.html\n[contributors]: https://github.com/bbatsov/crux/contributors\n[melpa]: http://melpa.org\n[melpa stable]: http://stable.melpa.org\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbbatsov%2Fcrux","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbbatsov%2Fcrux","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbbatsov%2Fcrux/lists"}