diff --git a/.github/ISSUE_TEMPLATE b/.github/ISSUE_TEMPLATE deleted file mode 100644 index ed296fa16..000000000 --- a/.github/ISSUE_TEMPLATE +++ /dev/null @@ -1,36 +0,0 @@ -Please check off the following before submitting your issue: - -+ [ ] I ran `make clean && make` and restarted Emacs, but the issue persists. -+ [ ] I ran `make doctor` and it produced nothing conclusive. -+ [ ] [The troubleshooting section of the FAQ](/wiki/FAQ#troubleshooting) says - nothing about my issue. -+ [ ] I read the README.org files of any modules that are relevant (that I am - aware of). -+ [ ] I filled out the four fields in the template below. -+ [ ] I have deleted this checklist and message. - ---- - -### Observed behavior - -Describe what happened. - -### Expected behavior - -Describe what you expected to happen. - -### Steps to reproduce - -1. Select these example steps, -2. Delete them, -3. And replace them with precise steps to reproduce your issue. - -### System information - -
-Click to expand - -``` -Replace this line with the output of `M-x doom/info` OR `DEBUG=1 make doctor` -``` -
diff --git a/README.md b/README.md index c9d504d69..90fec667e 100644 --- a/README.md +++ b/README.md @@ -1,137 +1,197 @@ +Main screenshot + +Current release + + build status (master) + + + build status (develop) + + + Discord Server + +

- Current release - build status (master) - build status (develop) - Chat on discord - Main screenshot + wiki  |  + screenshots  |  + faq  |  + troubleshooting +

- - - -

- Wiki | - Screenshots | - Troubleshooting | - FAQ | - Changelog -

+Quick start +----------- -- - - +```bash +git clone https://github.com/hlissner/doom-emacs ~/.emacs.d +~/.emacs.d/bin/doom quickstart +``` + +> Doom supports Emacs 25.3 and newer, but **Emacs 26.1 is recommended.** Doom +> works best on Linux & MacOS. Your mileage may vary on Windows. + + +Table of Contents +================== +- [What is Doom Emacs](#what-is-doom-emacs) + - [Doom's mantras](#dooms-mantras) + - [Feature highlights](#feature-highlights) +- [Getting Help](#getting-help) +- [Contributing](#contributing) + + +What is Doom Emacs +================== - + It is a story as old as time. A stubborn, shell-dwelling, and melodramatic vimmer -- envious of the features of modern text editors -- spirals into despair -before finally succumbing to the [dark side][evil-mode]. This is his config. +before succumbing to the [dark side][url:evil-mode]. This is his config. -Doom strives to be fast, fabulous and hacker friendly. It is tailored for -neckbeards with blue belts or better in command-line-fu, Elisp and git. +Doom is a configuration for [GNU Emacs](https://www.gnu.org/software/emacs/). It +can be used as framework for your own configuration, or as a resource for fellow +Emacs enthusiasts who want to learn more about our favorite OS. -> Doom **only** supports Emacs >= 25.1, and is tested on Arch Linux 4.7+ and -> MacOS 10.11. YMMV on other platforms. +Doom's mantras +-------------- +- **Gotta go fast.** Startup and runtime speed are high priorities; many + expensive, heavy-handed features and packages have been fine-tuned to that + end. +- **Hacker-friendly.** Doom caters to the command line denizen unafraid of + writing a little (or a lot of) code to tailor their editor. It also inherits + your shell configuration, warts 'n all, and expects frequent trips into the + terminal to manage Doom with its `bin/doom` utility. +- **Opinionated, but not stubborn.** Doom has _many_ opinions spread out across + its 120+ modules designed to iron out idiosynchrosies and provide a better and + more consistent baseline experience of Emacs and its plugins. However, they + mustn't ever compromise your ability to change, rewrite or disable any or all + of it, if you ask nicely. +- **Written to be read.** Doom's source ought to be self documenting and easy to + grok. Modules should be syntactically sweet and concise, and backend logic + should be explicit and abstraction-light. Where complexity arises, comments + and documentation shouldn't be far away. -- - - +Feature Highlights +------------------ +- A declarative [package management system][doom:packages] with a command line + interface that combines package.el, [use-package] and [quelpa], allowing you + to install packages from anywhere. +- A [popup management system][doom:popups] with customizable rules to dictate + how temporary/disposable buffers are displayed. +- A vim-centric (and optional) experience with [evil-mode][url:evil-mode], + including ports of several popular vim plugins, C-x omnicompletion + and a slew of [custom ex commands][doom:commands]. +- A Spacemacs-esque [keybinding scheme][doom:bindings], centered around leader + and localleader prefix keys (SPC and SPCm, by + default). +- Indentation detection and optional integration with + [editorconfig][url:editorconfig]. Let someone else argue about tabs vs + ___***spaces***___. +- Code completion for many languages, powered by + [company-mode][url:company-mode] (some may have external dependencies). +- Project-awareness powered by [projectile][url:projectile], with tools and an + API to navigate and manage projects, as well as project/framework-specific + minor modes and snippets libraries (and the ability to define your own). +- Project search (and replace) utilities, powered by + [the_silver_searcher][url:ag], [ripgrep][url:rg], git-grep and + [wgrep][url:wgrep], with integration for [ivy][url:ivy] (the default) and + [helm][url:helm]. +- Isolated and persistent workspaces powered by [persp-mode][url:persp-mode]. + Also substitutes as vim tabs. +- Inline/live code evaluation (using [quickrun][url:quickrun]), with REPL + support for a variety of languages. +- A jump-to-definition/references implementation for all languages that tries to + "just work," resorting to mode-specific functionality, before falling back on + [dump-jump][url:dumb-jump]. -## Quick start -```bash -git clone https://github.com/hlissner/doom-emacs ~/.emacs.d -cd ~/.emacs.d -make quickstart -``` +Troubleshooting +=============== -Don't forget to run `make` each time you modify init.el or update Doom! +Encountered strange behavior or an error? Here are some things to try before you +shoot off that bug report: -Visit the wiki for [a more detailed guide on installing, customizing and -grokking Doom][wiki]. +- Run `bin/doom refresh`. This ensures Doom is properly set up and its autoloads + files are up-to-date. +- If you have byte-compiled your config (with `bin/doom compile`), see if + `bin/doom clean` makes your issue go away. Never debug issues with a + byte-compiled config, it will only make your job harder. +- Run `bin/doom doctor` to detect common issues in your development environment. +- Search Doom's issue tracker for mention of any error messages you've received. +- [Visit our FAQ][docs:faq] to see if your issue is listed. -## Feature highlights +If all else fails, [file that bug report][github:new-issue]! Please include the +behavior you've observed, the behavior you expected, and any error message in +the \*Messages\* buffer (can be opened with SPC h m or `M-x +view-echo-area-messages`). It'd be a great help if you included a backtrace with +them as well. -+ A fast, organized and opinionated Emacs configuration with a command line - interface. -+ A custom, declarative [package management system][doom-packages] that combines - package.el, [use-package] and [quelpa], allowing you to manage packages from - the command line and install packages from sources other than ELPA. -+ A [popup management system][doom-popups] (powered by [shackle]) that minimizes - the presence and footprint of temporary and/or disposable buffers. -+ A vim-like experience with [evil-mode], including ports for several vim - plugins, C-x omnicompletion and a slew of [custom ex - commands][doom-my-commands]. -+ Integration with [editorconfig]. Let someone else argue about tabs and spaces. - (spaces, duh). -+ Code completion for many languages, powered by [company-mode] (some languages - may have external dependencies). -+ Project-awareness powered by [projectile], with tools and an API to navigate - and manage projects and their files. -+ Fast project search (and replace) utilities, powered by [the_silver_searcher], - [ripgrep] and [wgrep], with integration for [ivy] (the default), [helm] and - ido. -+ Isolated and persistent workspaces powered by [persp-mode]. Also substitutes - for vim tabs. -+ Inline/live code evaluation (using [quickrun]), including REPLs for a variety - of languages. +We've also got [a Discord server][url:discord]. Hop on! We can help! -## Troubleshooting -Found a problem? Here are some things to try: - -+ Run `make install` to ensure all plugins are installed. -+ `void-function` or `void-variable` errors could signal an out-of-date - autoloads file. Run `make autoloads` or `M-x doom//reload-autoloads` to update - it. -+ Scan for common OS/environment issues with `make doctor`. -+ **Never debug byte-compiled code. It will interfere in subtle ways.** Clean up - \*.elc files with `make clean` or `M-x doom//clean-byte-compiled-files`. -+ Check [the FAQ][wiki-troubleshooting] to see if your issue is mentioned. -+ Check the relevant module's README.org, if one exists. There may be extra - steps to getting certain features to work. - -If all else has failed, [file a bug report][doom-new-issue]. - -## Contribute +Contributing +============ Doom (and my Emacs work in general) is a labor of love and incurable madness, -done on my spare time. It wasn't intended for public use, but I enjoy making -Doom a resource for others. +done on my spare time. If you'd like to support my work, I welcome +contributions: -If you'd like to support my efforts, I welcome contributions of any kind: - -+ I love pull requests and bug reports. Elisp pointers are especially welcome. - Seriously, don't hesitate to [tell me my Elisp-fu sucks][doom-new-issue]! -+ Talk to me about Emacs workflow, ideas or tooling. Or talk to me about - gamedev, or pixel art, or anime, or programming, or the weather, or band camp. - Whatever. I don't mind. Holler at henrik@lissner.net. +- I love pull requests and bug reports. Check out the [Contributing + Guidelines][docs:contributing] (WIP) to find out how you can help out. +- I welcome Elisp pointers! Don't hesitate to [tell me my Elisp-fu + sucks][github:new-issue] (but please tell me why). +- Hop on [our Discord server][url:discord] and say hi! Help others out, hang out + or talk to me about Emacs, or gamedev, or programming, machine learning, + physics, pixel art, anime, gaming -- anything you like. Nourish this lonely + soul! +- If you'd like to support my work financially, consider buying me a drink + through [liberapay][url:liberapay] or [paypal][url:paypal]. Donations are a + great help. My work here contends with full-time studies, my ventures in indie + gamedev, and my freelance work. -[wiki]: /../../wiki -[wiki-conventions]: /../../wiki/Conventions -[wiki-modules]: /../../wiki/Modules -[wiki-customization]: /../../wiki/Customization -[wiki-troubleshooting]: /../../wiki/FAQ#troubleshooting + + + + + + +[docs:faq]: /../../wiki/FAQ -[doom-my-bindings]: modules/private/hlissner/+bindings.el -[doom-my-commands]: modules/private/hlissner/+commands.el -[doom-new-issue]: https://github.com/hlissner/doom-emacs/issues/new -[doom-packages]: core/autoload/packages.el -[doom-popups]: modules/ui/popup -[doom-theme]: https://github.com/hlissner/emacs-doom-theme +[github:new-issue]: https://github.com/hlissner/doom-emacs/issues/new +[doom:bindings]: modules/config/default/+bindings.el +[doom:commands]: modules/config/default/+evil-commands.el +[doom:packages]: core/autoload/packages.el +[doom:popups]: modules/feature/popup/README.org -[company-mode]: https://github.com/company-mode/company-mode -[editorconfig]: http://editorconfig.org/ -[evil-mode]: https://github.com/emacs-evil/evil -[git-gutter-fringe]: https://github.com/syohex/emacs-git-gutter-fringe -[helm]: https://github.com/emacs-helm/helm -[ivy]: https://github.com/abo-abo/swiper -[persp-mode]: https://github.com/Bad-ptr/persp-mode.el -[projectile]: https://github.com/bbatsov/projectile -[quelpa]: https://github.com/quelpa/quelpa -[quickrun]: https://github.com/syohex/emacs-quickrun -[ripgrep]: https://github.com/BurntSushi/ripgrep -[shackle]: https://github.com/wasamasa/shackle -[the_silver_searcher]: https://github.com/ggreer/the_silver_searcher -[use-package]: https://github.com/jwiegley/use-package -[vim]: https://github.com/hlissner/.vim -[wgrep]: https://github.com/mhayashi1120/Emacs-wgrep +[url:discord]: https://discord.gg/bcZ6P3y +[url:liberapay]: https://liberapay.com/hlissner/donate +[url:paypal]: https://paypal.me/henriklissner/10 +[url:company-mode]: https://github.com/company-mode/company-mode +[url:doom-themes]: https://github.com/hlissner/emacs-doom-themes +[url:editorconfig]: http://editorconfig.org/ +[url:evil-mode]: https://github.com/emacs-evil/evil +[url:helm]: https://github.com/emacs-helm/helm +[url:ivy]: https://github.com/abo-abo/swiper +[url:persp-mode]: https://github.com/Bad-ptr/persp-mode.el +[url:projectile]: https://github.com/bbatsov/projectile +[url:quelpa]: https://github.com/quelpa/quelpa +[url:quickrun]: https://github.com/syohex/emacs-quickrun +[url:ripgrep]: https://github.com/BurntSushi/ripgrep +[url:the_silver_searcher]: https://github.com/ggreer/the_silver_searcher +[url:use-package]: https://github.com/jwiegley/use-package +[url:wgrep]: https://github.com/mhayashi1120/Emacs-wgrep diff --git a/core/autoload/ui.el b/core/autoload/ui.el index 168a5fa8f..2b6ee3f52 100644 --- a/core/autoload/ui.el +++ b/core/autoload/ui.el @@ -88,7 +88,9 @@ See `display-line-numbers' for what these values mean." (let ((theme (or (car-safe custom-enabled-themes) doom-theme))) (when theme (mapc #'disable-theme custom-enabled-themes)) - (doom|init-theme) + (when (and doom-theme (not (memq doom-theme custom-enabled-themes))) + (let (doom--prefer-theme-elc) + (load-theme doom-theme t))) (doom|init-fonts))) ;;;###autoload diff --git a/core/cli/upgrade.el b/core/cli/upgrade.el index 09329cb87..cf7b55c73 100644 --- a/core/cli/upgrade.el +++ b/core/cli/upgrade.el @@ -67,6 +67,7 @@ (unless (equal (vc-git-working-revision doom-emacs-dir) rev) (error "Failed to checkout latest commit.\n\n%s" (buffer-string))) (doom-refresh 'force) + (doom-packages-update doom-auto-accept) (message "Done! Please restart Emacs for changes to take effect"))) (user-error (message "%s Aborting." (error-message-string e))) diff --git a/core/core-keybinds.el b/core/core-keybinds.el index e8f6cdb0f..082971d79 100644 --- a/core/core-keybinds.el +++ b/core/core-keybinds.el @@ -58,7 +58,7 @@ If any hook returns non-nil, all hooks after it are ignored.") (defvar doom-leader-alist `((t . ,doom-leader-map))) (add-to-list 'emulation-mode-map-alists 'doom-leader-alist) -;; We avoid `general-create-definer' to ensure that :states, :wk-full-keys and +;; We avoid `general-create-definer' to ensure that :states, :prefix and ;; :keymaps cannot be overwritten. (defmacro define-leader-key! (&rest args) `(general-define-key @@ -148,7 +148,6 @@ For example, :nvi will map to (list 'normal 'visual 'insert). See (put :mode 'lisp-indent-function 'defun) (put :prefix 'lisp-indent-function 'defun) (put :unless 'lisp-indent-function 'defun) -(put :if 'lisp-indent-function 'defun) (put :when 'lisp-indent-function 'defun) ;; specials @@ -190,7 +189,7 @@ For example, :nvi will map to (list 'normal 'visual 'insert). See collect (intern (concat (symbol-name m) "-map"))) rest) (push :map rest)) - ((or :if :when :unless) + ((or :when :unless) (doom--map-nested (list (intern (doom-keyword-name key)) (pop rest)) rest) (setq rest nil)) (:prefix @@ -251,7 +250,7 @@ For example, :nvi will map to (list 'normal 'visual 'insert). See ((setq def (cons 'list (if (and (equal key "") (null def)) - `(nil :which-key ,desc) + `(:ignore t :which-key ,desc) (plist-put (general--normalize-extended-def def) :which-key desc)))))))) (dolist (state states) diff --git a/core/core-os.el b/core/core-os.el index 6a45a20d6..4ca91a5d8 100644 --- a/core/core-os.el +++ b/core/core-os.el @@ -20,13 +20,9 @@ (when (featurep 'exec-path-from-shell) `(exec-path-from-shell-copy-envs ,@vars))) -;; key conventions: -;; alt/option = meta -;; windows/command = super - (cond (IS-MAC - (setq mac-command-modifier 'super - mac-option-modifier 'meta + (setq mac-command-modifier 'meta + mac-option-modifier 'alt ;; sane trackpad/mouse scroll settings mac-redisplay-dont-reset-vscroll t mac-mouse-wheel-smooth-scroll nil @@ -68,12 +64,7 @@ x-underline-at-descent-line t)) ; draw underline lower (IS-WINDOWS - (setq w32-get-true-file-attributes nil ; fix file io slowdowns - ;; map window keys to super (unreliable) - w32-pass-lwindow-to-system nil - w32-pass-rwindow-to-system nil - w32-lwindow-modifier 'super - w32-rwindow-modifier 'super) + (setq w32-get-true-file-attributes nil) ; fix file io slowdowns (when (display-graphic-p) (setenv "GIT_ASKPASS" "git-gui--askpass")))) diff --git a/core/core-packages.el b/core/core-packages.el index 438c524a3..94908abc4 100644 --- a/core/core-packages.el +++ b/core/core-packages.el @@ -226,7 +226,9 @@ packages at once. Only use this macro in a module's packages.el file." (doom--assert-stage-p 'packages #'packages!) - `(progn ,@(cl-loop for desc in packages collect `(package! ,@(doom-enlist desc))))) + (macroexp-progn + (cl-loop for desc in packages + collect (macroexpand `(package! ,@(doom-enlist desc)))))) (defmacro disable-packages! (&rest packages) "A convenience macro like `package!', but allows you to disable multiple @@ -234,7 +236,9 @@ packages at once. Only use this macro in a module's packages.el file." (doom--assert-stage-p 'packages #'disable-packages!) - `(setq doom-disabled-packages (append ',packages doom-disabled-packages))) + (macroexp-progn + (cl-loop for pkg in packages + collect (macroexpand `(package! ,pkg :disable t))))) (defmacro depends-on! (module submodule &optional flags) "Declares that this module depends on another. diff --git a/core/core-ui.el b/core/core-ui.el index 7c5595028..9eca1a770 100644 --- a/core/core-ui.el +++ b/core/core-ui.el @@ -53,6 +53,10 @@ size.") (defvar doom-init-ui-hook nil "List of hooks to run when the UI has been initialized.") +(defvar doom--prefer-theme-elc nil + "If non-nil, `load-theme' will prefer the compiled theme (unlike its default +behavior). Do not set this directly, this is let-bound in `doom|init-theme'.") + (setq-default ansi-color-for-comint-mode t bidi-display-reordering nil ; disable bidirectional text for tiny performance boost @@ -360,7 +364,8 @@ frame's window-system, the theme will be reloaded.") (defun doom|init-theme () "Set the theme and load the font, in that order." (when (and doom-theme (not (memq doom-theme custom-enabled-themes))) - (load-theme doom-theme t))) + (let ((doom--prefer-theme-elc t)) + (load-theme doom-theme t)))) ;; Getting themes to remain consistent across GUI Emacs, terminal Emacs and ;; daemon Emacs is hairy. `doom|init-theme' sorts out the initial GUI frame. @@ -477,12 +482,15 @@ instead). Meant for `kill-buffer-query-functions'." (advice-add #'load-theme :around #'doom*disable-old-themes-first) (defun doom*prefer-compiled-theme (orig-fn &rest args) - "Make `load-theme' prioritize the byte-compiled theme (if it exists) for a -moderate boost in startup (or theme switch) time." - (cl-letf* ((old-locate-file (symbol-function 'locate-file)) - ((symbol-function 'locate-file) - (lambda (filename path &optional _suffixes predicate) - (funcall old-locate-file filename path '("c" "") predicate)))) + "Make `load-theme' prioritize the byte-compiled theme for a moderate boost in +startup (or theme switch) time, so long as `doom--prefer-theme-elc' is non-nil." + (if (or (null after-init-time) + doom--prefer-theme-elc) + (cl-letf* ((old-locate-file (symbol-function 'locate-file)) + ((symbol-function 'locate-file) + (lambda (filename path &optional _suffixes predicate) + (funcall old-locate-file filename path '("c" "") predicate)))) + (apply orig-fn args)) (apply orig-fn args))) (advice-add #'load-theme :around #'doom*prefer-compiled-theme) diff --git a/core/core.el b/core/core.el index eb7c1d0aa..52a299c74 100644 --- a/core/core.el +++ b/core/core.el @@ -1,8 +1,8 @@ ;;; core.el --- the heart of the beast -*- lexical-binding: t; -*- (eval-when-compile - (and (version< emacs-version "25") - (error "Detected Emacs %s. Doom only supports Emacs 25.1 and higher" + (and (version< emacs-version "25.3") + (error "Detected Emacs %s. Doom only supports Emacs 25.3 and higher" emacs-version))) (defvar doom-debug-mode (or (getenv "DEBUG") init-file-debug) diff --git a/core/test/test-core-keybinds.el b/core/test/test-core-keybinds.el index 4a0c97774..294cc1ea7 100644 --- a/core/test/test-core-keybinds.el +++ b/core/test/test-core-keybinds.el @@ -173,9 +173,9 @@ :to-expand-into `(general-define-key "a" (list :def #'a :which-key "A"))))) - (describe ":if/:when/:unless" + (describe ":when/:unless" (it "wraps keys in a conditional block" - (dolist (prop '(:if :when :unless)) + (dolist (prop '(:when :unless)) (let ((prop-fn (intern (doom-keyword-name prop)))) (expect `(map! ,prop t "a" #'a "b" #'b) :to-expand-into diff --git a/docs/ISSUE_TEMPLATE.md b/docs/ISSUE_TEMPLATE.md new file mode 100644 index 000000000..a09ea6ab4 --- /dev/null +++ b/docs/ISSUE_TEMPLATE.md @@ -0,0 +1,30 @@ ++ [ ] I've checked for duplicates of this issue. ++ [ ] `bin/doom clean` and `bin/doom refresh` (then restarting Emacs) did not + fix my issue. ++ [ ] I ran `make doctor` and it produced no leads. ++ [ ] My issue cannot be found [in the FAQ](/../../wiki/FAQ) ++ [ ] I filled out the four fields in the template below. ++ [ ] I have deleted this checklist and message. + +### Observed behavior + +(Describe what happened) + +### Expected behavior + +(Describe what you expected to happen) + +### Steps to reproduce + +1. Select these example steps, +2. Delete them, +3. And replace them with precise steps to reproduce your issue. +4. Fill in "system information" below. + +### System information + +
+Click to expand + +Replace this line with the output of `M-x doom/info` OR `~/.emacs.d/bin/doom info` +
diff --git a/.github/PULL_REQUEST_TEMPLATE b/docs/PULL_REQUEST_TEMPLATE.md similarity index 100% rename from .github/PULL_REQUEST_TEMPLATE rename to docs/PULL_REQUEST_TEMPLATE.md diff --git a/modules/app/email/README.org b/modules/app/email/README.org index 0e4fd9728..a5ead06c7 100644 --- a/modules/app/email/README.org +++ b/modules/app/email/README.org @@ -36,7 +36,7 @@ sudo pacman --noconfirm --needed -S offlineimap mu * Dependencies You need to do the following: -1. Write a ~\~/.offlineimaprc~. Mine can be found [[https://github.com/hlissner/dotfiles/tree/master/shell/+mu][in my dotfiles repository]]. It is configured to download mail to ~\~/.mail~. I use [[https://www.passwordstore.org/][unix pass]] to securely store my login credentials. +1. Write a ~\~/.offlineimaprc~. Mine can be found [[https://github.com/hlissner/dotfiles/tree/master/shell/mu][in my dotfiles repository]]. It is configured to download mail to ~\~/.mail~. I use [[https://www.passwordstore.org/][unix pass]] to securely store my login credentials. 2. Download your email: ~offlineimap -o~ (may take a while) 3. Index it with mu: ~mu index --maildir ~/.mail~ diff --git a/modules/app/email/config.el b/modules/app/email/config.el index ebcabf5b2..53f539f2c 100644 --- a/modules/app/email/config.el +++ b/modules/app/email/config.el @@ -11,6 +11,9 @@ ;; ;; Packages +(add-to-list 'auto-mode-alist '("\\.\\(?:offlineimap\\|mbsync\\)rc\\'" . conf-mode)) + + (def-package! mu4e :commands (mu4e mu4e-compose-new) :init diff --git a/modules/completion/company/README.org b/modules/completion/company/README.org index f2a1bc6fc..48973f228 100644 --- a/modules/completion/company/README.org +++ b/modules/completion/company/README.org @@ -1,48 +1,148 @@ -#+TITLE: :completion company +#+TITLE: completion/company +#+DATE: February 19, 2017 +#+SINCE: v2.0 +#+STARTUP: inlineimages -This module adds code-completion support, powered by [[https://github.com/company-mode/company-mode][company]]. +* Table of Contents :TOC_3:noexport: +- [[Description][Description]] + - [[Module Flags][Module Flags]] + - [[Plugins][Plugins]] +- [[Prerequisites][Prerequisites]] +- [[Features][Features]] + - [[Code completion][Code completion]] + - [[Vim-esque omni-completion prefix (C-x)][Vim-esque omni-completion prefix (C-x)]] +- [[Configuration][Configuration]] + - [[Enable as-you-type code completion][Enable as-you-type code completion]] + - [[Enable company backend(s) in certain modes][Enable company backend(s) in certain modes]] +- [[Troubleshooting][Troubleshooting]] + - [[Code-completion doesn't pop up automatically.][Code-completion doesn't pop up automatically.]] + - [[X-mode doesn't have code completion support or requires extra setup.][X-mode doesn't have code completion support or requires extra setup.]] + - [[No backends (or the incorrect ones) have been registered for X-mode.][No backends (or the incorrect ones) have been registered for X-mode.]] -+ Uses ~company-quickhelp~ for documentation tooltips -+ Uses ~company-statistics~ to order results by usage frequency +* Description +This module provides code completion, powered by [[https://github.com/company-mode/company-mode][company-mode]]. It is required +for code completion in many of Doom's :lang modules. -[[/../screenshots/company.png]] +https://assets.doomemacs.org/completion/company/overlay.png -* Table of Contents :TOC: -- [[#install][Install]] -- [[#configure][Configure]] - - [[#auto-completion][Auto-completion]] -- [[#troubleshooting][Troubleshooting]] +** Module Flags ++ =+auto= Enables as-you-type completion. ++ =+childframe= Enables displaying completion candidates in a child frame, + rather than an overlay or tooltip (among with other UI enhancements). *This + requires GUI Emacs 26.1+.* -* Install -Some languages require additional setup, and some languages may have no -completion support at all. +** Plugins ++ [[https://github.com/company-mode/company-mode][company-mode]] ++ [[https://github.com/hlissner/emacs-company-dict][company-dict]] ++ [[https://github.com/raxod502/prescient.el][company-prescient]] ++ [[https://github.com/sebastiencs/company-box][company-box]] -Check the README.org in that language's module for details. +* Prerequisites +This module has no direct prerequisites. -* Configure -** Auto-completion -By default, I've disabled auto-completion. This is my preference. I prefer to -invoke company when I need it by calling ~company-complete~ manually (typically, -bound to =C-SPC= in insert mode). However, some may not share my preference. +However, some major modes may require additional setup for code completion to +work in them. Some major modes may have no completion support at all. Check that +major mode's module's documentation for details. -To enable auto-completion you must: +* Features +** Code completion +Ccompletion must be triggered manually with the =C-SPC= key. If you want +as-you-type code completion, the ~+auto~ module flag will enable it. -1. Load ~company~, -2. and change ~company-idle-delay~ to a non-nil float (the default is 0.5) +| Keybind | Description | +|---------+------------------------------------------| +| =C-SPC= | Invoke code completion manually | +| =C-n= | Go to next candidate | +| =C-p= | Go to previous candidate | +| =C-j= | (evil) Go to next candidate | +| =C-k= | (evil) Go to previous candidate | +| =C-h= | Display documentation (if available) | +| =C-u= | Move to previous page of candidates | +| =C-d= | Move to next page of candidates | +| =C-s= | Filter candidates | +| =C-S-s= | Search candidates with helm/ivy | +| =C-SPC= | Complete common | +| =TAB= | Complete common or select next candidate | +| =S-TAB= | Select previous candidate | -For example: +** Vim-esque omni-completion prefix (C-x) +In the spirit of Vim's omni-completion, the following insert mode keybinds are +available to evil users to access specific company backends: + +| Keybind | Description | +|-----------+-----------------------------------| +| =C-x C-]= | Complete etags | +| =C-x C-f= | Complete file path | +| =C-x C-k= | Complete from dictionary/keyword | +| =C-x C-l= | Complete full line | +| =C-x C-o= | Invoke complete-at-point function | +| =C-x C-n= | Complete next symbol at point | +| =C-x C-p= | Complete previous symbol at point | +| =C-x C-s= | Complete snippet | +| =C-x s= | Complete spelling suggestions | + +* Configuration +** Enable as-you-type code completion +The =+auto= module flag enables this. You may customize ~company-idle-delay~ to +control how quickly the popup should appear. + +The ~+company/toggle-auto-completion~ command is also available to toggle this +interactively. + +** Enable company backend(s) in certain modes +The ~set-company-backend!~ function exists for setting ~company-backends~ +buffer-locally in MODES, which is either a major-mode symbol, a minor-mode +symbol, or a list of either. BACKENDS are prepended to ~company-backends~ for +those modes. #+BEGIN_SRC emacs-lisp -(require 'company) -(setq company-idle-delay 0.2 - company-minimum-prefix-length 3) +(after! js2-mode + (set-company-backend! 'js2-mode 'company-tide 'company-yasnippet)) + +(after! sh-script + (set-company-backend! 'sh-mode + '(company-shell :with company-yasnippet))) + +(after! cc-mode + (set-company-backend! 'c-mode + '(:separate company-irony-c-headers company-irony))) +#+END_SRC + +To unset the backends for a particular mode, pass ~nil~ to it: + +#+BEGIN_SRC emacs-lisp +(after! sh-script + (set-company-backend! 'sh-mode nil)) #+END_SRC * Troubleshooting -If completion isn't working for you, please consider the following before -posting a bug report: +If code completion isn't working for you, consider the following common causes +before you file a bug report: -+ If what you are expecting is popup-as-you-type completion (which is disabled - by default), see the "Configure > Auto-completion" section above, which will - instruct you on how to enable this. -+ Some languages don't have any auto-completion support at all. +** Code-completion doesn't pop up automatically. +This is by design. The expectation is that you invoke completion manually with +=C-SPC=. This was decided because code-completion backends can be slow, some +dreadfully so, and invoking them every time you move your cursor can add pauses +and delays while editing. + +If, despite that, you still want this functionality, use the =+auto= flag to +enable it. + +** X-mode doesn't have code completion support or requires extra setup. +There is no guarantee your language mode will have completion support. + +Some, like ~lua-mode~, don't have completion support in Emacs at all. Others may +requires additional setup to get code completion working. For instance, +~go-mode~ requires ~guru~ to be installed on your system, and ~enh-ruby-mode~ +requires that you have a Robe server running (~M-x robe-start~). + +Check the relevant module's documentation for this kind of information. + +** No backends (or the incorrect ones) have been registered for X-mode. +Doom expects every mode to have an explicit list of company-backends (and as +short a list as possible). This may mean you aren't getting all the completion +you want or any at all. + +Check the value of ~company-backends~ (=SPC h v company-backends=) from that +mode to see what backends are available. Check the [[*Assigning company backend(s) to modes][Configuration section]] for +details on changing what backends are available for that mode. diff --git a/modules/completion/ivy/README.org b/modules/completion/ivy/README.org index 974545c19..f4702a357 100644 --- a/modules/completion/ivy/README.org +++ b/modules/completion/ivy/README.org @@ -1,128 +1,57 @@ -#+TITLE: :completion ivy +#+TITLE: completion/ivy +#+DATE: February 13, 2017 +#+SINCE: v2.0 +#+STARTUP: inlineimages -This module adds Ivy, a completion backend. +* Table of Contents :TOC_3:noexport: +- [[Description][Description]] + - [[Module Flags][Module Flags]] + - [[Plugins][Plugins]] + - [[Hacks][Hacks]] +- [[Prerequisites][Prerequisites]] + - [[Install][Install]] + - [[MacOS][MacOS]] + - [[Arch Linux][Arch Linux]] +- [[Features][Features]] + - [[Jump-to-file project navigation][Jump-to-file project navigation]] + - [[Project search & replace][Project search & replace]] + - [[In-buffer searching][In-buffer searching]] + - [[Task lookup][Task lookup]] + - [[Ivy integration for various completing commands][Ivy integration for various completing commands]] + - [[General][General]] + - [[Jump to files, buffers or projects)][Jump to files, buffers or projects)]] + - [[Search][Search]] +- [[Configuration][Configuration]] + - [[Enable fuzzy/non-fuzzy search for specific commands][Enable fuzzy/non-fuzzy search for specific commands]] + - [[Change the position of the ivy childframe][Change the position of the ivy childframe]] +- [[Troubleshooting][Troubleshooting]] + +* Description +This module provides Ivy integration for a variety of Emacs commands, as well as +a unified interface for project search and replace, powered by ag, rg, pt, +git-grep & grep (whichever is available). #+begin_quote I prefer ivy over ido for its flexibility. I prefer ivy over helm because it's -lighter. +lighter, simpler and faster in many cases. #+end_quote -+ Project-wide search & replace powered by ~rg~ or ~ag~ -+ Project jump-to navigation ala Command-T, Sublime Text's Jump-to-anywhere or - Vim's CtrlP plugin. -+ Ivy integration for ~M-x~, ~imenu~, ~recentf~ and others. -+ A powerful, interactive in-buffer search using ~swiper~. -+ Ivy-powered TODO/FIXME navigation +** Module Flags ++ =+fuzzy= Enables the fuzzy method for ivy searches. ++ =+childframe= Causes Ivy to display in a floating child frame, above Emacs. + *This requires GUI Emacs 26.1+* -* Table of Contents :TOC: -- [[#install][Install]] - - [[#macos][MacOS]] - - [[#arch-linux][Arch Linux]] -- [[#usage][Usage]] - - [[#project-search--replace][Project search & replace]] - - [[#jump-to-file-project-navigation][Jump-to-file project navigation]] - - [[#in-buffer-searching][In-buffer searching]] - - [[#task-lookup][Task lookup]] -- [[#appendix][Appendix]] - - [[#commands][Commands]] - - [[#hacks][Hacks]] - -* Install -This module optionally depends on [[https://github.com/BurntSushi/ripgrep][ripgrep]] and [[https://github.com/ggreer/the_silver_searcher][the_silver_searcher]]. - -~rg~ is faster, but its results aren't deterministic, neither does it support -multiline search or full PCRE (at the time of writing), that's where ~ag~ is -useful. - -** MacOS -#+BEGIN_SRC sh :tangle (if (doom-system-os 'macos) "yes") -brew install ripgrep the_silver_searcher -#+END_SRC - -** Arch Linux -#+BEGIN_SRC sh :dir /sudo:: :tangle (if (doom-system-os 'arch) "yes") -sudo pacman --needed --noconfirm -S ripgrep the_silver_searcher -#+END_SRC - -* Usage -Here is some insight into how I use this module. - -** Project search & replace -There are four Ex interfaces for the silver searcher and ripgrep. They are: - -+ ~:ag[!]~ -+ ~:agcwd[!]~ -+ ~:rg[!]~ -+ ~:rgcwd[!]~ - -The optional BANG tells ag/rg to include ignored files in the search. And the -\*cwd variant of each command will only search in the current directory -(non-recursively). - -[[/../screenshots/modules/completion/ivy/ivy-search.gif]] - -Now, how do we do text replacements? With the ivy popup open you can press -=S+Tab= to create an wgrep buffer out of the results. - -[[/../screenshots/modules/completion/ivy/ivy-search-replace.gif]] - -Make your modifications and press =C-c C-c= to commit them, or =C-c C-k= to -abort. - -** Jump-to-file project navigation -Inspired by Sublime Text's jump-to-anywhere, Vim's CtrlP/Unite plugins, and -Textmate's Command-T, a marriage of ~projectile~ and ~ivy~ makes this available -in Emacs. - -Invoke it with =SPC f /=, =SPC SPC= or ~M-x counsel-projectile-find-file~. - -[[/../screenshots/modules/completion/ivy/ivy-projectile.gif]] - -** In-buffer searching -I use ~evil-search~ (invoked by pressing =/= in normal mode) when jumping -small/moderate (or predictable) distances. However, there are occasions where I -need more feedback, so I turn to ~swiper~ (available directly with =M-x swiper -RET=, or via ~:sw[iper]~). - -[[/../screenshots/modules/completion/ivy/ivy-swiper.gif]] - -** Task lookup -I sprinkle my projects with TODO's & FIXME's. You can navigate to and peruse -them via ~M-x +ivy/tasks~ or ~:todo[!]~ (ex command). - -[[/../screenshots/modules/completion/ivy/ivy-todo.gif]] - -* Appendix -** Commands -Here is a list of my commonly used commands, their default keybinds (defined in -[[../../private/default/+bindings.el][private/default/+bindings.el]]), and their corresponding ex command (defined in -[[../../private/default/+evil-commands.el][private/default/+evil-commands.el]]). - -| command | key / ex command | description | -|-------------------------------------+------------------------+------------------------------------------------------------------| -| ~counsel-M-x~ | =M-x= | Smarter, smex-powered M-x | -| ~counsel-bookmark~ | =SPC RET= | Find bookmark | -| ~counsel-find-file~ | =SPC f .= or =SPC .= | Browse from current directory | -| ~counsel-projectile-find-file~ | =SPC f /= or =SPC SPC= | Find file in project | -| ~counsel-projectile-switch-project~ | =SPC p p= | Open another project | -| ~counsel-recentf~ | =SPC f r= | Find recently opened file | -| ~+ivy/switch-workspace-buffer~ | =SPC b b= | Jump to buffer in current workspace | -| ~ivy-switch-buffer~ | =SPC b B= | Jump to buffer across workspaces | -| ~+ivy:ag~ | ~:ag[!] [QUERY]~ | Search project (BANG = ignore gitignore) | -| ~+ivy:ag-cwd~ | ~:agcwd[!] [QUERY]~ | Search this directory (BANG = don't recurse into subdirectories) | -| ~+ivy:rg~ | ~:rg[!] [QUERY]~ | Search project (if BANG, ignore gitignore) | -| ~+ivy:rg-cwd~ | ~:rgcwd[!] [QUERY]~ | Search this directory (BANG = don't recurse into subdirectories) | -| ~+ivy:swiper~ | ~:sw[iper] [QUERY]~ | Search current buffer | -| ~+ivy:todo~ | ~:todo[!]~ | List all TODO/FIXMEs in project (or current file if BANG) | - -While in a search (e.g. invoked from ~+ivy:ag~ or ~+ivy:rg~), these new -keybindings are available to you: - -| key | description | -|-------------+--------------------------------------------------------------------------------| -| == | Perform search/replace on the search results (open occur buffer in wgrep mode) | -| =C-SPC= | Preview the current candidate | -| =M-RET= | Open the selected candidate in other-window | +** Plugins ++ [[https://github.com/abo-abo/swiper][ivy]] ++ [[https://github.com/abo-abo/swiper][counsel]] ++ [[https://github.com/ericdanan/counsel-projectile][counsel-projectile]] ++ [[https://github.com/abo-abo/swiper][swiper]] ++ [[https://github.com/abo-abo/swiper][ivy-hydra]] ++ [[https://github.com/yevgnen/ivy-rich][ivy-rich]] ++ [[https://github.com/mhayashi1120/Emacs-wgrep][wgrep]] ++ [[https://github.com/DarwinAwardWinner/amx][amx]] ++ [[https://github.com/lewang/flx][flx]]* (=+fuzzy=) ++ [[https://github.com/tumashu/ivy-posframe][ivy-posframe]]* (=+childframe=) ** Hacks + Functions with ivy/counsel equivalents have been globally remapped (like @@ -131,4 +60,161 @@ keybindings are available to you: + ~counsel-[arp]g~'s 3-character limit was reduced to 1 (mainly for the ex command) +* Prerequisites +This module optionally depends on one of: ++ [[https://github.com/BurntSushi/ripgrep][ripgrep]] (rg) ++ [[https://github.com/ggreer/the_silver_searcher][the_silver_searcher]] (ag) ++ [[https://github.com/monochromegane/the_platinum_searcher][the_platinum_searcher]] (pt) + +Ripgrep is recommended, but the order of its results aren't deterministic and it +doesn't support full PCRE (at the time of writing). The_silver_searcher is a +good alternative if either of these bother you. + +If none of these are installed, file search commands will use git-grep (falling +back to grep, otherwise). + +** Install +*** MacOS +#+BEGIN_SRC sh +brew install ripgrep the_silver_searcher +#+END_SRC + +*** Arch Linux +#+BEGIN_SRC sh :dir /sudo:: +sudo pacman --needed --noconfirm -S ripgrep the_silver_searcher +#+END_SRC + +* Features +Ivy and its ilk are large plugins. Covering everything about them is outside of +this documentation's scope, so only Doom-specific Ivy features are listed here: + +** Jump-to-file project navigation +Inspired by Sublime Text's jump-to-anywhere, CtrlP/Unite in Vim, and Textmate's +Command-T, this module provides similar functionality by bringing ~projectile~ +and ~ivy~ together. + +https://assets.doomemacs.org/completion/ivy/projectile.png + +| Keybind | Description | +|----------------------+-------------------------------------| +| =SPC f /=, =SPC SPC= | Jump to file in project | +| =SPC f .=, =SPC .= | Jump to file from current directory | + +** Project search & replace +This module provides interactive text search and replace using the first search +program available on your system (rg, ag, pt, git-grep or grep). + +| Keybind | Description | +|----------------------+-------------------------------------| +| =SPC / b=, =M-f= | Search the current buffer | +| =SPC / p= | Search project | +| =SPC / d= | Search this directory | +| =SPC p t= | List all TODO/FIXMEs in project | + +https://assets.doomemacs.org/completion/ivy/search.png + +The ~+ivy-project-search-engines~ variable is consulted to determine which +underlying program to check for (and in what order). It's default value is ~'(rg +ag pt)~. If none of these are available, it will resort to =git-grep= (falling +back to =grep= after that). + +To use a specific program, the following engine-specific commands are available +(but not bound to any key by default) for searching from the project root or the +current directory (recursively), respectively: + ++ ~+ivy/ag~ / ~+ivy/ag-from-cwd~ ++ ~+ivy/rg~ / ~+ivy/rg-from-cwd~ ++ ~+ivy/pt~ / ~+ivy/pt-from-cwd~ ++ ~+ivy/grep~ / ~+ivy/grep-from-cwd~ + +The universal argument (=SPC u= for evil users; =C-u= otherwise) changes the +behavior of these commands, instructing the underlying search engine to include +ignored files. + +This module also provides Ex Commands for evil users: + +| Ex command | Description | +|-----------------------+------------------------------------------------| +| ~:ag[!] [QUERY]~ | Search project w/ ag[fn:1] | +| ~:rg[!] [QUERY]~ | Search project w/ rg[fn:1] | +| ~:pt[!] [QUERY]~ | Search project w/ pt[fn:1] | +| ~:grep[!] [QUERY]~ | Search project w/ git-grep/grep[fn:1] | +| ~:agcwd[!] [QUERY]~ | Search this directory w/ the_silver_searcher | +| ~:rgcwd[!] [QUERY]~ | Search this directory w/ ripgrep | +| ~:ptcwd[!] [QUERY]~ | Search this directory w/ the_platinum_searcher | +| ~:grepcwd[!] [QUERY]~ | Search this directory w/ git-grep/grep | + +The optional BANG functions is equivalent to the universal argument for the +previous commands. + +----- + +While in a search (e.g. invoked from ~+ivy:ag~ or ~:rg~), these extra +keybindings are available to you: + +| Keybind | Description | +|---------+------------------------------------------------| +| =S-TAB= | Open a writable buffer of your search results | +| =C-SPC= | Preview the current candidate | +| =M-RET= | Open the selected candidate in other-window | + +Changes to the resulting wgrep buffer (opened by =S-TAB=) can be committed with +=C-c C-c= and aborted with =C-c C-k=. + +https://assets.doomemacs.org/completion/ivy/search-replace.png + +** In-buffer searching +The =swiper= package provides an interactive buffer search powered by ivy. It +can be invoked with: + ++ =SPC / b= ++ =M-f= ++ ~:sw[iper] [QUERY]~ + +https://assets.doomemacs.org/completion/ivy/swiper.png + +A wgrep buffer can be opened from swiper with =S-TAB=. + +** Task lookup +Some projects have TODO's and FIXME's littered across them. The ~+ivy/tasks~ +command allows you to search and jump to them. It can be invoked with: + ++ =SPC p t= (C-u = restrict search to current file) ++ ~:todo[!]~ (BANG = restrict search to current file) + +https://assets.doomemacs.org/completion/ivy/todo.png + +** Ivy integration for various completing commands +*** General +| Keybind | Description | +|----------------+---------------------------| +| =M-x=, =SPC := | Smarter, smex-powered M-x | +| =SPC '= | Resume last ivy session | + +*** Jump to files, buffers or projects) +| Keybind | Description | +|---------------------------------+---------------------------------------| +| =SPC RET= | Find bookmark | +| =SPC f .=, =SPC .= | Browse from current directory | +| =SPC f /=, =SPC p /=, =SPC SPC= | Find file in project | +| =SPC f r= | Find recently opened file | +| =SPC p p= | Open another project | +| =SPC b b=, =SPC ,= | Switch to buffer in current workspace | +| =SPC b B=, =SPC <= | Switch to buffer | + +*** Search +| Keybind | Description | +|------------------+------------------------------------------| +| =SPC / i= | Search for symbol in current buffer | +| =SPC / I= | Search for symbol in all similar buffers | +| =SPC / b=, =M-f= | Search the current buffer | +| =SPC / p= | Search project | +| =SPC / d= | Search this directory | +| =SPC p t= | List all TODO/FIXMEs in project | + +* Configuration +** TODO Enable fuzzy/non-fuzzy search for specific commands +** TODO Change the position of the ivy childframe + +* TODO Troubleshooting diff --git a/modules/config/default/+evil-bindings.el b/modules/config/default/+evil-bindings.el index 5e295c331..be17cf668 100644 --- a/modules/config/default/+evil-bindings.el +++ b/modules/config/default/+evil-bindings.el @@ -17,17 +17,15 @@ ;; Global keybindings (map! (:map override - ;; Make M-x more accessible - "s-x" 'execute-extended-command - "M-x" 'execute-extended-command ;; A little sandbox to run code in - "s-;" 'eval-expression) + "A-;" 'eval-expression + "M-;" 'eval-expression) [remap evil-jump-to-tag] #'projectile-find-tag [remap find-tag] #'projectile-find-tag ;; Smart tab - :i [tab] (general-predicate-dispatch nil + :i [tab] (general-predicate-dispatch nil ; fall back to nearest keymap (and (featurep! :feature snippets) (yas-maybe-expand-abbrev-key-filter 'yas-expand)) 'yas-expand @@ -68,7 +66,7 @@ :m "B" #'realgud:cmd-clear) (:when (featurep! :feature eval) - :g "s-r" #'+eval/buffer + :g "M-r" #'+eval/buffer :nv "gr" #'+eval:region :n "gR" #'+eval/buffer :v "gR" #'+eval:replace-region) @@ -83,8 +81,8 @@ :n "zx" #'kill-this-buffer :n "ZX" #'bury-buffer :n "gp" #'+evil/reselect-paste - :nv "g=" #'widen - :nv "g-" #'+evil:narrow-buffer + :n "g=" #'widen + :v "g=" #'+evil:narrow-buffer :nv "g@" #'+evil:apply-macro :nv "gc" #'evil-commentary :nv "gx" #'evil-exchange @@ -189,9 +187,9 @@ (:map yas-keymap "C-e" #'+snippets/goto-end-of-field "C-a" #'+snippets/goto-start-of-field - [s-right] #'+snippets/goto-end-of-field - [s-left] #'+snippets/goto-start-of-field - [s-backspace] #'+snippets/delete-to-start-of-field + [M-right] #'+snippets/goto-end-of-field + [M-left] #'+snippets/goto-start-of-field + [M-backspace] #'+snippets/delete-to-start-of-field [backspace] #'+snippets/delete-backward-char [delete] #'+snippets/delete-forward-char-or-field) (:map yas-minor-mode-map @@ -219,7 +217,17 @@ :n "gt" #'+workspace/switch-right :n "gT" #'+workspace/switch-left :n "]w" #'+workspace/switch-right - :n "[w" #'+workspace/switch-left)) + :n "[w" #'+workspace/switch-left + :g "M-1" (λ! (+workspace/switch-to 0)) + :g "M-2" (λ! (+workspace/switch-to 1)) + :g "M-3" (λ! (+workspace/switch-to 2)) + :g "M-4" (λ! (+workspace/switch-to 3)) + :g "M-5" (λ! (+workspace/switch-to 4)) + :g "M-6" (λ! (+workspace/switch-to 5)) + :g "M-7" (λ! (+workspace/switch-to 6)) + :g "M-8" (λ! (+workspace/switch-to 7)) + :g "M-9" (λ! (+workspace/switch-to 8)) + :g "M-0" #'+workspace/switch-to-last)) ;;; :completion (map! (:when (featurep! :completion company) @@ -246,8 +254,8 @@ "C-u" #'company-previous-page "C-d" #'company-next-page "C-s" #'company-filter-candidates - "C-S-s" `(,(cond ((featurep! :completion helm) #'helm-company) - ((featurep! :completion ivy) #'counsel-company))) + "C-S-s" (cond ((featurep! :completion helm) #'helm-company) + ((featurep! :completion ivy) #'counsel-company)) "C-SPC" #'company-complete-common [tab] #'company-complete-common-or-cycle [backtab] #'company-select-previous) @@ -448,9 +456,7 @@ :after markdown-mode :map markdown-mode-map ;; fix conflicts with private bindings - "" nil - "" nil - "" nil)) + [backspace] nil)) ;; @@ -468,7 +474,12 @@ :desc "Toggle last popup" "~" #'+popup/toggle :desc "Find file" "." #'find-file - :desc "Switch to buffer" "," #'switch-to-buffer + + (:when (featurep! :feature workspaces) + :desc "Switch workspace buffer" "," #'persp-switch-to-buffer + :desc "Switch buffer" "<" #'switch-to-buffer) + (:unless (featurep! :feature workspaces) + :desc "Switch buffer" "," #'switch-to-buffer) :desc "Resume last search" "'" (cond ((featurep! :completion ivy) #'ivy-resume) @@ -544,7 +555,11 @@ :desc "Sudo edit this file" "S" #'doom/sudo-this-file :desc "Previous buffer" "[" #'previous-buffer :desc "Next buffer" "]" #'next-buffer - :desc "Switch buffer" "b" #'switch-to-buffer + (:when (featurep! :feature workspaces) + :desc "Switch workspace buffer" "b" #'persp-switch-to-buffer + :desc "Switch buffer" "B" #'switch-to-buffer) + (:unless (featurep! :feature workspaces) + :desc "Switch buffer" "b" #'switch-to-buffer) :desc "Kill buffer" "k" #'kill-this-buffer :desc "Next buffer" "n" #'next-buffer :desc "Kill other buffers" "o" #'doom/kill-other-buffers @@ -700,7 +715,7 @@ :desc "Find other file" "o" #'projectile-find-other-file :desc "Switch project" "p" #'projectile-switch-project :desc "Recent project files" "r" #'projectile-recentf - :desc "List project tasks" "t" #'+ivy/tasks ; TODO: Add +helm/tasks + :desc "List project tasks" "t" #'+default/project-tasks :desc "Invalidate cache" "x" #'projectile-invalidate-cache) (:prefix ("q" . "quit/restart") @@ -755,7 +770,7 @@ customized by changing `+default-repeat-forward-key' and (let ((fn-sym (intern (format "+default*repeat-%s" (doom-unquote command))))) `(progn (defun ,fn-sym (&rest _) - (define-key! 'motion + (define-key! :states 'motion (car +default-repeat-keys) #',next-func (cdr +default-repeat-keys) #',prev-func)) (advice-add #',command :before #',fn-sym)))) diff --git a/modules/config/default/autoload/default.el b/modules/config/default/autoload/default.el index 966872055..9d9bbd56f 100644 --- a/modules/config/default/autoload/default.el +++ b/modules/config/default/autoload/default.el @@ -84,3 +84,10 @@ If ARG (universal argument), runs `compile' from the current directory." (set-window-buffer nil buffer) (with-current-buffer buffer (funcall (default-value 'major-mode)))))) + +;;;###autoload +(defun +default/project-tasks () + "Invokes `+ivy/tasks' or `+helm/tasks', depending on which is available." + (interactive) + (cond ((featurep! :completion ivy) (+ivy/tasks) + (featurep! :completion helm) (+helm/tasks)))) diff --git a/modules/config/default/config.el b/modules/config/default/config.el index 85f35fc7f..09e10fedc 100644 --- a/modules/config/default/config.el +++ b/modules/config/default/config.el @@ -127,44 +127,48 @@ (when IS-MAC ;; Fix MacOS shift+tab (define-key input-decode-map [S-iso-lefttab] [backtab]) - - (define-key! - ;; Buffer-local font scaling - "s-+" (λ! (text-scale-set 0)) - "s-=" #'text-scale-increase - "s--" #'text-scale-decrease - ;; Fix frame-switching on MacOS - "s-`" #'other-frame - ;; Simple window/frame navigation/manipulation - "s-w" #'delete-window - "s-W" #'delete-frame - "s-n" #'+default/new-buffer - "s-N" #'make-frame - ;; Textmate-esque bindings - "s-a" #'mark-whole-buffer - "s-b" #'+default/compile - "s-f" #'swiper - "s-q" (if (daemonp) #'delete-frame #'evil-quit-all) - ;; Restore OS undo, save, copy, & paste keys (without cua-mode, because - ;; it imposes some other functionality and overhead we don't need) - "s-z" #'undo - "s-s" #'save-buffer - "s-c" (if (featurep 'evil) 'evil-yank 'copy-region-as-kill) - "s-v" #'yank - ;; textmate-esque newline insertion - [s-return] #'evil-open-below - [S-s-return] #'evil-open-above - ;; textmate-esque deletion - [s-backspace] #'doom/backward-kill-to-bol-and-indent)) + ;; Fix frame-switching key on MacOS + (global-set-key (kbd "M-`") #'other-frame)) ;; ;; Doom's keybinding scheme (when (featurep! +bindings) - ;; Ensure Emacsien motions are available - (map! "C-b" #'backward-word - "C-f" #'forward-word) + ;; Make M-x more accessible + (define-key! 'override + "M-x" #'execute-extended-command + "A-x" #'execute-extended-command) + + (define-key! + ;; Ensure Emacsien motions are available + "C-b" #'backward-word + "C-f" #'forward-word + ;; Buffer-local font scaling + "M-+" (λ! (text-scale-set 0)) + "M-=" #'text-scale-increase + "M--" #'text-scale-decrease + ;; Simple window/frame navigation/manipulation + "M-w" #'delete-window + "M-W" #'delete-frame + "M-n" #'+default/new-buffer + "M-N" #'make-frame + ;; Restore OS undo, save, copy, & paste keys (without cua-mode, because + ;; it imposes some other functionality and overhead we don't need) + "M-z" #'undo + "M-s" #'save-buffer + "M-c" (if (featurep 'evil) 'evil-yank 'copy-region-as-kill) + "M-v" #'yank + ;; Textmate-esque bindings + "M-a" #'mark-whole-buffer + "M-b" #'+default/compile + "M-f" #'swiper + "M-q" (if (daemonp) #'delete-frame #'evil-quit-all) + ;; textmate-esque newline insertion + [M-return] #'evil-open-below + [M-S-return] #'evil-open-above + ;; textmate-esque deletion + [M-backspace] #'doom/backward-kill-to-bol-and-indent) (if (featurep 'evil) (load! "+evil-bindings") diff --git a/modules/feature/eval/README.org b/modules/feature/eval/README.org index 851ea6a48..2dfa8fac8 100644 --- a/modules/feature/eval/README.org +++ b/modules/feature/eval/README.org @@ -1,52 +1,80 @@ -#+TITLE: :feature eval +#+TITLE: feature/eval +#+DATE: February 13, 2017 +#+SINCE: v2.0 +#+STARTUP: inlineimages -This modules adds support for evaluating code from inside Emacs, including -REPLs. +* Table of Contents :TOC_3:noexport: +- [[Description][Description]] + - [[Module Flags][Module Flags]] + - [[Plugins][Plugins]] + - [[Hacks][Hacks]] +- [[Prerequisites][Prerequisites]] +- [[Features][Features]] + - [[Inline Code Evaluation][Inline Code Evaluation]] + - [[REPLs][REPLs]] +- [[Configuration][Configuration]] + - [[Register a REPL for a major-mode][Register a REPL for a major-mode]] + - [[Change how code is evaluated in a major mode][Change how code is evaluated in a major mode]] +- [[Troubleshooting][Troubleshooting]] -* Table of Contents :TOC: -- [[#install][Install]] -- [[#usage][Usage]] - - [[#repls][REPLs]] - - [[#code-evaluation][*Code Evaluation*]] -- [[#configuration][Configuration]] - - [[#repls-1][REPLs]] - - [[#code-evaluation-1][Code Evaluation]] +* Description +This modules adds inline code evaluation support to Emacs, and supplies a +universal interface for opening and interacting with REPLs. -* Install -This module has no external dependencies. However, specific languages may -require additional setup. +** Module Flags +This module has no flags. -Check the README.org in that language's module for details. +** Plugins ++ [[https://github.com/syohex/emacs-quickrun][quickrun]] -* Usage -** REPLs -Invoked via: -+ ~:repl~ (evil ex-command) -+ = o r= in normal mode (or visual mode, which sends the selection to - the open REPL) -+ ~M-x +eval/open-repl~ -+ ~M-x +eval/send-region-to-repl~ while a selection (and REPL) is active +** Hacks ++ Quickrun has been modified to: + + Use only one output window, in case of consecutive execution of code. + + The quickrun window will resize itself to fit its output, once the + underlying process is finished executing the code. -** *Code Evaluation* +* Prerequisites +This module has no direct prerequisites. + +However, specific languages may require additional setup. Check the +documentation of that language's module for details. + +* Features +** Inline Code Evaluation Quickrun can be invoked via: + ~M-x +eval/buffer~ (or ~gR~, or ~M-r~) + ~M-x +eval/region~ + ~M-x +eval/region-and-replace~ + Evil users can use the ~gr~ operator to select and run a region. -* Configuration ** REPLs -REPLs are defined for most of the languages Doom supports (check its README.org -to see if it does). +Invoked via: ++ =SPC o r= or ~:repl~ will open a REPL in a popup window. =C-u SPC o r= or + ~:repl!~ will open a REPL in the current window. If a REPL is already open and + a selection is active, it will be sent to the REPL. ++ ~M-x +eval/open-repl~ ++ ~M-x +eval/send-region-to-repl~ while a selection (and REPL) is active + +* Configuration +** Register a REPL for a major-mode +REPLs are defined for most languages Doom supports. Check that language module's +README.org to see if it does (and if it requires additional setup). + +To use them, you may use ~M-x +eval/open-repl~, ~:repl~ (for evil users) or the +default binding: =SPC o r=. These will open a REPL in a popup window. + +#+begin_quote +You can simply call that mode's REPL command manually. e.g. ~M-x ielm~, but +#+end_quote Otherwise, you can define your own for a specified major-mode with the =:repl= setting. ~(set! :repl MAJOR-MODE FUNCTION)~ -FUNCTION must return the repl buffer. Any window changes are ignored, then -handed off to shackle (assuming shackle-mode is on) to display in a popup -window. +FUNCTION should be a command that opens a repl buffer. Any window changes are +ignored, then handed off to shackle (assuming shackle-mode is on) to display in +a popup window. #+BEGIN_SRC emacs-lisp (defun +emacs-lisp/repl () @@ -58,10 +86,10 @@ window. (bury-buffer buf) buf))))) -(set! :repl 'emacs-lisp-mode #'+emacs-lisp/repl) +(set-repl-handler! 'emacs-lisp-mode #'+emacs-lisp/repl) #+END_SRC -** Code Evaluation +** Change how code is evaluated in a major mode Run regions or entire buffers with [[https://github.com/syohex/emacs-quickrun][Quickrun]]. Output is show in a popup window. Quickrun includes support for many languages, usually by sending text directly @@ -72,21 +100,22 @@ without support (like [[https://crystal-lang.org/][Crystal]]), or a language wit Here's how you define a "runner": #+BEGIN_SRC emacs-lisp -(set! :eval 'crystal-mode - '((:command . "crystal") - (:exec . "%c %s") - (:description . "Run Crystal script"))) +(set-eval-handler! 'crystal-mode + '((:command . "crystal") + (:exec . "%c %s") + (:description . "Run Crystal script"))) #+END_SRC A simpler version is simply to use the path to the binary: #+BEGIN_SRC emacs-lisp -(set! :eval 'groovy-mode "groovy") +(set-eval-handler! 'groovy-mode "groovy") #+END_SRC Or if you'd rather run an elisp command: #+BEGIN_SRC emacs-lisp -(set! :eval 'emacs-lisp-mode #'+emacs-lisp-eval) +(set-eval-handler! 'emacs-lisp-mode #'+emacs-lisp-eval) #+END_SRC +* Troubleshooting diff --git a/modules/feature/evil/README.org b/modules/feature/evil/README.org index 4093c770a..b3b089d1d 100644 --- a/modules/feature/evil/README.org +++ b/modules/feature/evil/README.org @@ -1,61 +1,127 @@ -#+TITLE: :feature evil +#+TITLE: feature/evil +#+DATE: February 2, 2017 +#+SINCE: v2.0 +#+STARTUP: inlineimages +* Table of Contents :TOC_3:noexport: +- [[Description][Description]] + - [[Module Flags][Module Flags]] + - [[Plugins][Plugins]] + - [[Hacks][Hacks]] +- [[Prerequisites][Prerequisites]] +- [[Features][Features]] + - [[Ported vim plugins][Ported vim plugins]] + - [[Custom Text Objects][Custom Text Objects]] + - [[Custom Ex Commands][Custom Ex Commands]] + - [[A hybrid code-folding system][A hybrid code-folding system]] + - [[Differences from vim][Differences from vim]] +- [[Configuration][Configuration]] + - [[Removing evil-mode][Removing evil-mode]] + +* Description This holy module brings the vim experience to Emacs. -* Table of Contents :TOC: -- [[#removing-evil-mode][Removing evil-mode]] -- [[#features][Features]] - - [[#multiple-cursors][Multiple-cursors]] - - [[#a-hybrid-code-folding-system][A hybrid code-folding system]] - - [[#hacks][Hacks]] - - [[#differences-from-vim][Differences from vim]] +** Module Flags ++ =+everywhere= Enables evilified keybinds everywhere possible, utilizing the + ~evil-collection~ plugin. -* Removing evil-mode -See the [[https://github.com/hlissner/doom-emacs/wiki/FAQ#remove-vimevil-for-a-more-vanilla-emacs-experience][corresponding question in the FAQ]]. +** Plugins ++ [[https://github.com/emacs-evil/evil][evil]] ++ [[https://github.com/wcsmith/evil-args][evil-args]] ++ [[https://github.com/linktohack/evil-commentary][evil-commentary]] ++ [[https://github.com/PythonNut/evil-easymotion][evil-easymotion]] ++ [[https://github.com/cute-jumper/evil-embrace.el][evil-embrace]] ++ [[https://github.com/syl20bnr/evil-escape][evil-escape]] ++ [[https://github.com/Dewdrops/evil-exchange][evil-exchange]] ++ [[https://github.com/TheBB/evil-indent-plus][evil-indent-plus]] ++ [[https://github.com/redguardtoo/evil-matchit][evil-matchit]] ++ [[https://github.com/cofi/evil-numbers][evil-numbers]] ++ [[https://github.com/noctuid/evil-textobj-anyblock][evil-textobj-anyblock]] ++ [[https://github.com/hlissner/evil-snipe][evil-snipe]] ++ [[https://github.com/emacs-evil/evil-surround][evil-surround]] ++ [[https://github.com/alexmurray/evil-vimish-fold][evil-vimish-fold]] ++ [[https://github.com/bling/evil-visualstar][evil-visualstar]] ++ [[https://github.com/ninrod/exato][exato]] ++ [[https://github.com/emacs-evil/evil-collection][evil-collection]]* + +** Hacks ++ When a window is split, the new window will be focused. ++ The o/O keys will respect and continue commented lines (can be disabled by + setting ~+evil-want-o/O-to-continue-comments~ to ~nil~). ++ From visual mode, =*= and =#= will search for the current selection instead of + the word-at-point. ++ The ~:g[lobal]~ ex command has been modified to highlight matches + incrementally. ++ More of vim's filename modifiers are supported in ex commands (like ~:p~, + ~:p:h~ or ~:t~) than vanilla evil-mode offers. ++ A custom filename modifier is available in Doom: ~:P~, which expands to the + project root (throws an error if not in a project). + +* Prerequisites +This module has no external prerequisites. * Features -+ A better ~:g[lobal]~ command with incremental highlighting. -+ Adds the ~:al[ign]~ ex command: offers an ex interface to ~align-regexp~ with - incremental highlighting. -+ Support for more of vim's filename modifiers in ex commands (like ~:p~, ~:p:h~ - or ~:t~) than vanilla evil-mode offers. +** Ported vim plugins +The following vim plugins have been ported to evil: + +| Vim Plugin | Emacs Plugin | Keybind(s) | +|-----------------------+--------------------------------+---------------------| +| vim-commentary | evil-commentary | omap =gc= | +| vim-easymotion | evil-easymotion | omap =gs= | +| vim-seek or vim-sneak | evil-snipe | mmap =s=/=S= | +| vim-surround | evil-embrace and evil-surround | vmap =S=, omap =ys= | + +In other modules: ++ The tools/neotree & tools/treemacs modules contain a =NERDTree= equivalent. ++ The editor/multiple-cursors module contains: + + ~vim-multiedit~ => evil-multiedit + + ~vim-multiple-cursors~ => evil-mc + +** Custom Text Objects + A list of new text objects: + Blocks: ~B~ (from ~evil-textobj-anyblock~) + Args: ~a~ (from ~evil-args~) + Indentation: ~i~ / ~I~ / ~J~ (from ~evil-indent-plus~) -+ Incorporates vim functionality ported to evil: - + ~vim-commentary~ => ~evil-commentary~ - + ~vim-easymotion~ => ~evil-easymotion~ - + ~vim-multiedit~ => ~evil-multiedit~ - + ~vim-multiple-cursors~ => ~evil-mc~ & ~evil-multiedit~ - + ~vim-seek~ or ~vim-sneak~ => ~evil-snipe~ - + ~vim-surround~ => ~evil-embrace~ & ~evil-surround~ -+ =NERDTree= equivalent is available in =:tools neotree= -** Multiple-cursors -Two multiple-cursor implementations exist in this module: ~evil-mc~ and -~evil-multiedit~. Together, these provide the functionality of -~vim-multiple-cursors~. - -The former lets you place "clone" cursors. The latter lets you interactively -edit many regions at once (like an interactive version of ~:%s~). +** Custom Ex Commands +| Ex Command | Description | +|----------------------+----------------------------------------------------------------------------------| +| ~:al[ign][!] REGEXP~ | Align text to the first match of REGEXP. If BANG, align all matches on each line | +| ~:mv[!] NEWPATH~ | Move the current file to NEWPATH | +| ~:cp[!] NEWPATH~ | Copy the current file to NEWPATH | +| ~:rm[!] [PATH]~ | Delete the current buffer's file and buffer | ** A hybrid code-folding system -This module combines ~evil-vimish-fold~ and ~hideshow~. The former allows -arbitrary folds and the latter allows folds on markers and indentation. -Together, they create a more consistent (and feature-complete) code-folding -system. +This module combines ~vimish-fold~ and ~hideshow~. The former allows arbitrary +folds and the latter allows folds on markers and indentation. Together, they +create a more consistent (and feature-complete) code-folding system. Most vim folding keys should work, e.g. =zr=, =zm=, =za=, =zo=, etc. -** Hacks -+ Automatically moves to new window when splitting -+ From visual mode, =*= and =#= will search for the current selection instead of - the word-at-point. - ** Differences from vim + Column-wise ranges in ex commands are enabled by default. i.e. the range in =:'<,'>s/a/b= will only affects the visual selection, not full lines (see ~evil-ex-visual-char-range~). + =:g= will incrementally highlight buffer matches. +* Configuration +** Removing evil-mode +You must do two things to remove Evil: + +1. Remove =:feature evil= from =~/.doom.d/init.el=, +2. Run ~bin/doom refresh~ to clean up lingering dependencies and refresh yuor + autoloads files. +3. [OPTIONAL] You may want a new ~doom-leader-alt-key~ and + ~doom-localleader-alt-key~. By default, these are bound to =M-SPC= and =M-SPC + m=. + +#+begin_quote +Ignore ~doom-leader-key~ and ~doom-localleader-key~, they don't apply to +non-evil sessions. +#+end_quote + +Note that evil-specific configuration and keybinds (defined with ~map!~) will be +ignored without evil present (and stripped out when byte-compiling). + +Unfortunately, since Doom was designed by a vimmer, for vimmers, little +consideration into a keybinding scheme for vanilla Emacs users. diff --git a/modules/feature/file-templates/README.org b/modules/feature/file-templates/README.org new file mode 100644 index 000000000..8e47464eb --- /dev/null +++ b/modules/feature/file-templates/README.org @@ -0,0 +1,79 @@ +#+TITLE: feature/file-templates +#+DATE: February 11, 2017 +#+SINCE: v2.0 +#+STARTUP: inlineimages + +* Table of Contents :TOC_2:noexport: +- [[Description][Description]] + - [[Module Flags][Module Flags]] + - [[Plugins][Plugins]] +- [[Prerequisites][Prerequisites]] +- [[Usage][Usage]] + - [[Inserting OSS licenses][Inserting OSS licenses]] +- [[Configuration][Configuration]] + - [[Registering a new file template][Registering a new file template]] + - [[Changing existing file templates][Changing existing file templates]] + - [[Adding new OSS licenses][Adding new OSS licenses]] +- [[Troubleshooting][Troubleshooting]] +- [[Appendix][Appendix]] + - [[API][API]] + - [[Commands][Commands]] + - [[Variables][Variables]] + +* Description +This module adds file templates for blank files, powered by yasnippet. + +** Module Flags +This module provides no flags. + +** Plugins +This module installs no plugins. + +* Prerequisites +This module has no prerequisites. + +* Usage +File templates are automatically expanded when opening empty files. + +They are also regular yasnippet snippets, which can be expanded by typing their +trigger and pressing =TAB=. By convention, the triggers for file templates are +prefixed with two underscores ~__~. + +** Inserting OSS licenses +A special command is available for inserting software licenses: ~M-x ++file-templates/insert-license~. + +#+begin_quote +Licenses with a ~-bp~ suffix are boilerplate templates; shorter versions meant +for comment headers in code. +#+end_quote + +* Configuration +** TODO Registering a new file template +** TODO Changing existing file templates +** Adding new OSS licenses +The ~+file-templates/insert-license~ command searches for snippets under +~text-mode~ that are named ~__license-ABC~, where ABC is the short name of the +license. e.g. ~__license-mit~. + +So long as these files exist, ~+file-templates/insert-license~ will recognize +them. + +* Troubleshooting +If a file template isn't expanding where you expect it to, run ~M-x ++file-templates/debug~. This will report to you what file template rule would +apply for the correct file. + +* Appendix +** API ++ ~set-file-template! PRED &rest PLIST~ ++ ~set-file-templates! &rest TEMPLATES~ + +** Commands ++ ~+file-templates/insert-license~ ++ ~+file-templates/debug~ + +** Variables ++ ~+file-templates-dir~ ++ ~+file-templates-default-trigger~ ++ ~+file-templates-alist~ diff --git a/modules/feature/snippets/README.org b/modules/feature/snippets/README.org index d22278f1b..7f28da666 100644 --- a/modules/feature/snippets/README.org +++ b/modules/feature/snippets/README.org @@ -1,12 +1,36 @@ -#+TITLE: :feature snippets - -This module adds snippets to Emacs, powered by yasnippet. +#+TITLE: feature/snippets +#+DATE: February 11, 2017 +#+SINCE: v2.0 +#+STARTUP: inlineimages * Table of Contents :TOC: -- [[#install][Install]] +- [[Description][Description]] + - [[Module Flags][Module Flags]] + - [[Plugins][Plugins]] + - [[Hacks][Hacks]] +- [[Prerequisites][Prerequisites]] +- [[Features][Features]] +- [[Configuration][Configuration]] +- [[Troubleshooting][Troubleshooting]] -* Install -There are no extra dependencies for this module. +* Description +This module adds snippets to Emacs, powered by yasnippet. -By default, =private/default= installs a snippet library tailored exclusively -for Doom Emacs. +** Module Flags +This module exposes no flags. + +** Plugins ++ [[https://github.com/joaotavora/yasnippet][yasnippet]] ++ [[https://github.com/abo-abo/auto-yasnippet][auto-yasnippet]] ++ [[https://github.com/hlissner/emacs-snippets][emacs-snippets]] + +** TODO Hacks + +* Prerequisites +This module has no external dependencies. + +* TODO Features + +* TODO Configuration + +* TODO Troubleshooting diff --git a/modules/lang/csharp/config.el b/modules/lang/csharp/config.el index 0e38143b1..5ba7960d7 100644 --- a/modules/lang/csharp/config.el +++ b/modules/lang/csharp/config.el @@ -1,9 +1,5 @@ ;;; lang/csharp/config.el -*- lexical-binding: t; -*- -;; `shader-mode' --- unity shaders -(add-to-list 'auto-mode-alist '("\\.shader$" . shader-mode)) - - (def-package! omnisharp :hook (csharp-mode . omnisharp-mode) :commands omnisharp-install-server @@ -51,3 +47,12 @@ "r" (λ! (omnisharp-unit-test "fixture")) "s" (λ! (omnisharp-unit-test "single")) "a" (λ! (omnisharp-unit-test "all"))))) + + +(when (featurep! +unity) + ;; `shader-mode' --- unity shaders + (add-to-list 'auto-mode-alist '("\\.shader$" . shader-mode)) + + (def-project-mode! +csharp-unity-mode + :modes (csharp-mode shader-mode) + :files (and "Assets" "Library/MonoManager.asset" "Library/ScriptMapper"))) diff --git a/modules/lang/csharp/packages.el b/modules/lang/csharp/packages.el index 57ba0f02e..49b94bed4 100644 --- a/modules/lang/csharp/packages.el +++ b/modules/lang/csharp/packages.el @@ -3,5 +3,6 @@ (package! csharp-mode) (package! omnisharp) -(package! shader-mode) +(when (featurep! +unity) + (package! shader-mode)) diff --git a/modules/lang/go/README.org b/modules/lang/go/README.org index 827d0ce25..39f9c2832 100644 --- a/modules/lang/go/README.org +++ b/modules/lang/go/README.org @@ -1,5 +1,20 @@ -#+TITLE: :lang go +#+TITLE: lang/go +#+DATE: January 16, 2017 +#+SINCE: v2.0 +#+STARTUP: inlineimages +* Table of Contents :TOC: +- [[Description][Description]] + - [[Module Flags][Module Flags]] + - [[Plugins][Plugins]] +- [[Prerequisites][Prerequisites]] + - [[Go][Go]] + - [[Dependencies][Dependencies]] +- [[Features][Features]] +- [[Configuration][Configuration]] +- [[Troubleshooting][Troubleshooting]] + +* Description This module adds [[https://golang.org][Go]] support. + Code completion (~gocode~) @@ -12,29 +27,28 @@ This module adds [[https://golang.org][Go]] support. + [[../../feature/file-templates/templates/go-mode][File templates]] + [[https://github.com/hlissner/emacs-snippets/tree/master/go-mode][Snippets]] -#+begin_quote -I have mixed feelings about Go. It's a decent compromise between C and higher-level languages, is pleasantly straight-forward and elegant, but lacks /native/ support for luxuries I miss from other languages, like generics, optional arguments, and function overloading. You've got to learn to love ~interface{}~. +** Module Flags +This module provides no flags. -Still, Go is a remarkably useful (and fast!) companion for a variety of small-to-medium backend web and CLI projects. -#+end_quote +** Plugins ++ [[https://github.com/dominikh/go-mode.el][go-mode]] ++ [[https://github.com/syohex/emacs-go-eldoc][go-eldoc]] ++ [[https://github.com/dominikh/go-mode.el][go-guru]] ++ [[https://github.com/manute/gorepl-mode][gorepl-mode]] ++ [[https://github.com/mdempsky/gocode][company-go]]* -* Table of Contents :TOC: -- [[#install][Install]] - - [[#go][Go]] - - [[#dependencies][Dependencies]] - -* Install +* Prerequisites ** Go To get started with Go, you need the ~go~ tool: *** MacOS -#+BEGIN_SRC sh :tangle (if (doom-system-os 'macos) "yes") +#+BEGIN_SRC bash brew install go #+END_SRC *** Arch Linux -#+BEGIN_SRC sh :dir /sudo:: :tangle (if (doom-system-os 'arch) "yes") -sudo pacman --needed --noconfirm -S go +#+BEGIN_SRC bash +sudo pacman -S go #+END_SRC ** Dependencies @@ -42,10 +56,10 @@ This module requires a valid ~GOPATH~, and the following Go packages: + ~gocode~ (for code completion & eldoc support) + ~godoc~ (for documentation lookup) -+ ~goimports~ (for auto-formatting code on save and fixing imports) + ~gorename~ (for extra refactoring commands) + ~gore~ (for the REPL) + ~guru~ (for code navigation & refactoring commands) ++ ~goimports~ (optional: for auto-formatting code on save & fixing imports) #+BEGIN_SRC sh export GOPATH=~/work/go @@ -58,3 +72,8 @@ go get -u golang.org/x/tools/cmd/gorename go get -u golang.org/x/tools/cmd/guru #+END_SRC +* TODO Features + +* TODO Configuration + +* TODO Troubleshooting diff --git a/modules/lang/haskell/config.el b/modules/lang/haskell/config.el index ec1c8cbee..28daa4e64 100644 --- a/modules/lang/haskell/config.el +++ b/modules/lang/haskell/config.el @@ -12,8 +12,7 @@ (when (featurep! :feature syntax-checker) (setq haskell-process-show-overlays nil)) ; flycheck makes this unnecessary (add-hook! 'haskell-mode-hook - #'(subword-mode ; improves text navigation with camelCase - haskell-collapse-mode ; support folding haskell code blocks + #'(haskell-collapse-mode ; support folding haskell code blocks interactive-haskell-mode)) (set-lookup-handlers! 'haskell-mode :definition #'haskell-mode-jump-to-def-or-tag) (set-file-template! 'haskell-mode :trigger #'haskell-auto-insert-module-template :project t) diff --git a/modules/lang/javascript/+screeps.el b/modules/lang/javascript/+screeps.el deleted file mode 100644 index 179ebb54b..000000000 --- a/modules/lang/javascript/+screeps.el +++ /dev/null @@ -1,174 +0,0 @@ -;;; lang/javascript/+screeps.el -*- lexical-binding: t; -*- - -;; TODO Constants may be out-of-date - -(defconst screeps-objects - '("ConstructionSite" "Creep" "Flag" "Game" "Memory" "Mineral" "Nuke" - "OwnedStructure" "PathFinder" "RawMemory" "Resource" "Room" - "RoomObject" "RoomPosition" "Source" - - "Structure" "StructureController" "StructureExtension" - "StructureExtractor" "StructureKeeperLair" "StructureLab" - "StructureLink" "StructureNuker" "StructureObserver" - "StructurePortal" "StructurePowerBank" "StructurePowerSpawn" - "StructureRampart" "StructureRoad" "StructureSpawn" - "StructureStorage" "StructureTerminal" "StructureTower" - "StructureWall")) - -(defconst screeps-constants - '("OK" "ERR_NOT_OWNER" "ERR_NO_PATH" "ERR_NAME_EXISTS" "ERR_BUSY" - "ERR_NOT_FOUND" "ERR_NOT_ENOUGH_ENERGY" "ERR_NOT_ENOUGH_RESOURCES" - "ERR_INVALID_TARGET" "ERR_FULL" "ERR_NOT_IN_RANGE" - "ERR_INVALID_ARGS" "ERR_TIRED" "ERR_NO_BODYPART" - "ERR_NOT_ENOUGH_EXTENSIONS" "ERR_RCL_NOT_ENOUGH" - "ERR_GCL_NOT_ENOUGH" - - "FIND_EXIT_TOP" "FIND_EXIT_RIGHT" "FIND_EXIT_BOTTOM" - "FIND_EXIT_LEFT" "FIND_EXIT" "FIND_CREEPS" "FIND_MY_CREEPS" - "FIND_HOSTILE_CREEPS" "FIND_SOURCES_ACTIVE" "FIND_SOURCES" - "FIND_DROPPED_ENERGY" "FIND_DROPPED_RESOURCES" "FIND_STRUCTURES" - "FIND_MY_STRUCTURES" "FIND_HOSTILE_STRUCTURES" "FIND_FLAGS" - "FIND_CONSTRUCTION_SITES" "FIND_MY_SPAWNS" "FIND_HOSTILE_SPAWNS" - "FIND_MY_CONSTRUCTION_SITES" "FIND_HOSTILE_CONSTRUCTION_SITES" - "FIND_MINERALS" "FIND_NUKES" - - "TOP" "TOP_RIGHT" "RIGHT" "BOTTOM_RIGHT" "BOTTOM" "BOTTOM_LEFT" - "LEFT" "TOP_LEFT" - - "COLOR_RED" "COLOR_PURPLE" "COLOR_BLUE" "COLOR_CYAN" "COLOR_GREEN" - "COLOR_YELLOW" "COLOR_ORANGE" "COLOR_BROWN" "COLOR_GREY" - "COLOR_WHITE" - - "LOOK_CREEPS" "LOOK_ENERGY" "LOOK_RESOURCES" "LOOK_SOURCES" - "LOOK_MINERALS" "LOOK_STRUCTURES" "LOOK_FLAGS" - "LOOK_CONSTRUCTION_SITES" "LOOK_NUKES" "LOOK_TERRAIN" - - "OBSTACLE_OBJECT_TYPES" - - "MOVE" "WORK" "CARRY" "ATTACK" "RANGED_ATTACK" "TOUGH" "HEAL" - "CLAIM" - - "BODYPART_COST" - - "CREEP_LIFE_TIME" "CREEP_CLAIM_LIFE_TIME" "CREEP_CORPSE_RATE" - - "CARRY_CAPACITY" "HARVEST_POWER" "HARVEST_MINERAL_POWER" - "REPAIR_POWER" "DISMANTLE_POWER" "BUILD_POWER" "ATTACK_POWER" - "UPGRADE_CONTROLLER_POWER" "RANGED_ATTACK_POWER" "HEAL_POWER" - "RANGED_HEAL_POWER" "REPAIR_COST" "DISMANTLE_COST" - - "RAMPART_DECAY_AMOUNT" "RAMPART_DECAY_TIME" "RAMPART_HITS" - "RAMPART_HITS_MAX" - - "ENERGY_REGEN_TIME" "ENERGY_DECAY" - - "SPAWN_HITS" "SPAWN_ENERGY_START" "SPAWN_ENERGY_CAPACITY" - "CREEP_SPAWN_TIME" - - "SOURCE_ENERGY_CAPACITY" "SOURCE_ENERGY_NEUTRAL_CAPACITY" - "SOURCE_ENERGY_KEEPER_CAPACITY" - - "WALL_HITS" "WALL_HITS_MAX" - - "EXTENSION_HITS" "EXTENSION_ENERGY_CAPACITY" - - "ROAD_HITS" "ROAD_WEAROUT" "ROAD_DECAY_AMOUNT" "ROAD_DECAY_TIME" - - "LINK_HITS" "LINK_HITS_MAX" "LINK_CAPACITY" "LINK_COOLDOWN" - "LINK_LOSS_RATIO" - - "STORAGE_CAPACITY" "STORAGE_HITS" - - "STRUCTURE_SPAWN" "STRUCTURE_EXTENSION" "STRUCTURE_ROAD" - "STRUCTURE_WALL" "STRUCTURE_RAMPART" "STRUCTURE_KEEPER_LAIR" - "STRUCTURE_PORTAL" "STRUCTURE_CONTROLLER" "STRUCTURE_LINK" - "STRUCTURE_STORAGE" "STRUCTURE_TOWER" "STRUCTURE_OBSERVER" - "STRUCTURE_POWER_BANK" "STRUCTURE_POWER_SPAWN" "STRUCTURE_EXTRACTOR" - "STRUCTURE_LAB" "STRUCTURE_TERMINAL" "STRUCTURE_CONTAINER" - "STRUCTURE_NUKER" - - "CONSTRUCTION_COST" - "CONSTRUCTION_COST_ROAD_SWAMP_RATIO" - - "CONTROLLER_LEVELS" "CONTROLLER_STRUCTURES" "CONTROLLER_DOWNGRADE" - "CONTROLLER_CLAIM_DOWNGRADE" "CONTROLLER_RESERVE" - "CONTROLLER_RESERVE_MAX" "CONTROLLER_MAX_UPGRADE_PER_TICK" - "CONTROLLER_ATTACK_BLOCKED_UPGRADE" - - "TOWER_HITS" "TOWER_CAPACITY" "TOWER_ENERGY_COST" - "TOWER_POWER_ATTACK" "TOWER_POWER_HEAL" "TOWER_POWER_REPAIR" - "TOWER_OPTIMAL_RANGE" "TOWER_FALLOFF_RANGE" "TOWER_FALLOFF" - - "OBSERVER_HITS" "OBSERVER_RANGE" - - "POWER_BANK_HITS" "POWER_BANK_CAPACITY_MAX" - "POWER_BANK_CAPACITY_MIN" "POWER_BANK_CAPACITY_CRIT" - "POWER_BANK_DECAY" "POWER_BANK_HIT_BACK" - - "POWER_SPAWN_HITS" "POWER_SPAWN_ENERGY_CAPACITY" - "POWER_SPAWN_POWER_CAPACITY" "POWER_SPAWN_ENERGY_RATIO" - - "EXTRACTOR_HITS" - - "LAB_HITS" "LAB_MINERAL_CAPACITY" - "LAB_ENERGY_CAPACITY" "LAB_BOOST_ENERGY" "LAB_BOOST_MINERAL" - "LAB_COOLDOWN" - - "GCL_POW" "GCL_MULTIPLY" "GCL_NOVICE" - - "MODE_SIMULATION" "MODE_SURVIVAL" "MODE_WORLD" "MODE_ARENA" - - "TERRAIN_MASK_WALL" "TERRAIN_MASK_SWAMP" "TERRAIN_MASK_LAVA" - - "MAX_CONSTRUCTION_SITES" "MAX_CREEP_SIZE" - - "MINERAL_REGEN_TIME" "MINERAL_MIN_AMOUNT" "MINERAL_RANDOM_FACTOR" - - "TERMINAL_CAPACITY" "TERMINAL_HITS" "TERMINAL_SEND_COST" - "TERMINAL_MIN_SEND" - - "CONTAINER_HITS" "CONTAINER_CAPACITY" "CONTAINER_DECAY" - "CONTAINER_DECAY_TIME" "CONTAINER_DECAY_TIME_OWNED" - - "NUKER_HITS" "NUKER_COOLDOWN" "NUKER_ENERGY_CAPACITY" - "NUKER_GHODIUM_CAPACITY" "NUKE_LAND_TIME" "NUKE_RANGE" "NUKE_DAMAGE" - - "RESOURCE_ENERGY" "RESOURCE_POWER" - - "RESOURCE_HYDROGEN" "RESOURCE_OXYGEN" "RESOURCE_UTRIUM" - "RESOURCE_LEMERGIUM" "RESOURCE_KEANIUM" "RESOURCE_ZYNTHIUM" - "RESOURCE_CATALYST" "RESOURCE_GHODIUM" - - "RESOURCE_HYDROXIDE" "RESOURCE_ZYNTHIUM_KEANITE" - "RESOURCE_UTRIUM_LEMERGITE" - - "RESOURCE_UTRIUM_HYDRIDE" "RESOURCE_UTRIUM_OXIDE" - "RESOURCE_KEANIUM_HYDRIDE" "RESOURCE_KEANIUM_OXIDE" - "RESOURCE_LEMERGIUM_HYDRIDE" "RESOURCE_LEMERGIUM_OXIDE" - "RESOURCE_ZYNTHIUM_HYDRIDE" "RESOURCE_ZYNTHIUM_OXIDE" - "RESOURCE_GHODIUM_HYDRIDE" "RESOURCE_GHODIUM_OXIDE" - - "RESOURCE_UTRIUM_ACID" "RESOURCE_UTRIUM_ALKALIDE" - "RESOURCE_KEANIUM_ACID" "RESOURCE_KEANIUM_ALKALIDE" - "RESOURCE_LEMERGIUM_ACID" "RESOURCE_LEMERGIUM_ALKALIDE" - "RESOURCE_ZYNTHIUM_ACID" "RESOURCE_ZYNTHIUM_ALKALIDE" - "RESOURCE_GHODIUM_ACID" "RESOURCE_GHODIUM_ALKALIDE" - - "RESOURCE_CATALYZED_UTRIUM_ACID" - "RESOURCE_CATALYZED_UTRIUM_ALKALIDE" - "RESOURCE_CATALYZED_KEANIUM_ACID" - "RESOURCE_CATALYZED_KEANIUM_ALKALIDE" - "RESOURCE_CATALYZED_LEMERGIUM_ACID" - "RESOURCE_CATALYZED_LEMERGIUM_ALKALIDE" - "RESOURCE_CATALYZED_ZYNTHIUM_ACID" - "RESOURCE_CATALYZED_ZYNTHIUM_ALKALIDE" - "RESOURCE_CATALYZED_GHODIUM_ACID" - "RESOURCE_CATALYZED_GHODIUM_ALKALIDE" - - "REACTIONS" "BODYPARTS_ALL" "RESOURCES_ALL" "COLORS_ALL")) - -(defun +javascript|init-screeps-mode () - (when (eq major-mode 'js2-mode) - (push 'javascript-jshint flycheck-disabled-checkers) - (setq js2-additional-externs (append '("_") screeps-objects screeps-constants)))) - diff --git a/modules/lang/javascript/config.el b/modules/lang/javascript/config.el index c01b837af..f01e5b011 100644 --- a/modules/lang/javascript/config.el +++ b/modules/lang/javascript/config.el @@ -234,9 +234,3 @@ (def-project-mode! +javascript-gulp-mode :when (locate-dominating-file default-directory "gulpfile.js")) - -(def-project-mode! +javascript-screeps-mode - :match "/screeps\\(?:-ai\\)?/.+$" - :modes (+javascript-npm-mode) - :add-hooks (+javascript|init-screeps-mode) - :on-load (load! "+screeps")) diff --git a/modules/lang/latex/config.el b/modules/lang/latex/config.el index f405b20db..45b29a792 100644 --- a/modules/lang/latex/config.el +++ b/modules/lang/latex/config.el @@ -66,7 +66,7 @@ If no viewers are found, `latex-preview-pane' is used.") ;; Enable rainbow mode after applying styles to the buffer (add-hook 'TeX-update-style-hook #'rainbow-delimiters-mode) (when (featurep! :feature spellcheck) - (add-hook 'TeX-mode-local-vars-hook #'flyspell-mode)) + (add-hook 'latex-mode-local-vars-hook #'flyspell-mode)) ;; All these excess pairs dramatically slow down typing in latex buffers, so ;; we remove them. Let snippets do their job. (after! smartparens-latex diff --git a/modules/lang/org/config.el b/modules/lang/org/config.el index e47b79016..1bfaecb67 100644 --- a/modules/lang/org/config.el +++ b/modules/lang/org/config.el @@ -364,12 +364,11 @@ between the two." ;; more intuitive RET keybinds :i [return] #'org-return-indent :n [return] #'+org/dwim-at-point + ;; textmate-esque newline insertion :nvi [C-return] (λ! (+org/insert-item 'below)) :nvi [C-S-return] (λ! (+org/insert-item 'above)) - (:when IS-MAC - ;; textmate-esque newline insertion - :nvi [s-return] (λ! (+org/insert-item 'below)) - :nvi [S-s-return] (λ! (+org/insert-item 'above))) + :nvi [M-return] (λ! (+org/insert-item 'below)) + :nvi [M-S-return] (λ! (+org/insert-item 'above)) ;; more vim-esque org motion keys (not covered by evil-org-mode) :m "]]" (λ! (org-forward-heading-same-level nil) (org-beginning-of-line)) :m "[[" (λ! (org-backward-heading-same-level nil) (org-beginning-of-line)) diff --git a/modules/tools/ein/README.org b/modules/tools/ein/README.org index bd54c8474..7f1c3147a 100644 --- a/modules/tools/ein/README.org +++ b/modules/tools/ein/README.org @@ -1,20 +1,34 @@ -#+TITLE: :tools ein - -* EIN -- Emacs IPython Notebook - -Tool to work with Jupyter notebooks within emacs. +#+TITLE: tools/ein +#+DATE: April 11, 2018 +#+SINCE: v2.0 +#+STARTUP: inlineimages * Table of Contents :TOC: -- [[EIN -- Emacs IPython Notebook][EIN -- Emacs IPython Notebook]] -- [[Install][Install]] -- [[Usage][Usage]] +- [[Description][Description]] + - [[Module Flags][Module Flags]] + - [[Plugins][Plugins]] +- [[Prerequisites][Prerequisites]] +- [[Features][Features]] + - [[Interaction with a Jupyter server][Interaction with a Jupyter server]] - [[Configuration][Configuration]] + - [[Setting the default location of your notebooks][Setting the default location of your notebooks]] -* Install -Add =:tool ein= to your ~doom!~ call in your private ~init.el~. +* Description +Adds Jupyter notebook integration into emacs. -* Usage +** Module Flags +This module provides no flags. + +** Plugins ++ [[https://github.com/millejoh/emacs-ipython-notebook][ein]] + +* Prerequisites +This module has no prereqisites. + +* Features +** Interaction with a Jupyter server Three functions are available to start EIN: + 1. ~ein:jupyter-server-start~ --- Start a jupyter server within emacs 2. ~ein:notebooklist-login~ --- Login to an existing jupyter server 3. ~ein:notebooklist-open~ --- Open the list of jupyter notebooks @@ -25,15 +39,15 @@ When ~ein:jupyter-server-start~ is called, after successfully finishing, ~ein:notebooklist-login~ and ~ein:notebooklist-open~ will be automatically called. -When in the ~Notebook List~ buffer, the key ~o~ calls ~ace-link~ to speed up the +When in the ~Notebook List~ buffer, the key =o= calls ~ace-link~ to speed up the process of selecting links in the buffer. -If ~company-mode~ is enabled as a module, ~company-ein~ will be used for -completion purposes. +If ~company-mode~ is enabled as a module, ~company-ein~ will handle completion. * Configuration -Specify the default directory where EIN searches for notebooks using: - -~(set! :ein-notebook-dir "~/my-notebooks")~ - +** Setting the default location of your notebooks +Change ~+ein-notebook-dir~ to tell ein where to find your Jupityr notebooks. +#+BEGIN_SRC emacs-lisp +(setq +ein-notebook-dir "~/my-notebooks") +#+END_SRC diff --git a/modules/tools/magit/config.el b/modules/tools/magit/config.el index 97af76ff2..5250cbe6b 100644 --- a/modules/tools/magit/config.el +++ b/modules/tools/magit/config.el @@ -58,6 +58,7 @@ what features are available.") (def-package! magithub :after magit + :when (not (featurep! :tools magit +forge)) :preface ;; Magithub is not well-behaved, so this needs to be set early (setq magithub-dir (concat doom-etc-dir "magithub/")) @@ -100,3 +101,9 @@ what features are available.") (evil-define-key* evil-magit-state git-rebase-mode-map "gj" #'git-rebase-move-line-down "gk" #'git-rebase-move-line-up))) + +(def-package! forge + :when (featurep! :tools magit +forge) + :config + (map! :leader + :desc "Forge ""gF" #'forge-dispatch)) diff --git a/modules/tools/password-store/autoload.el b/modules/tools/password-store/autoload.el index a464569e9..073a4526c 100644 --- a/modules/tools/password-store/autoload.el +++ b/modules/tools/password-store/autoload.el @@ -126,7 +126,7 @@ fields in `+pass-url-fields' is used to find the url field." '+pass/ivy '(("o" password-store-copy "copy password") ("e" +pass/edit-entry "edit entry") - ("u" +pass/copy-login "copy username") + ("u" +pass/copy-user "copy username") ("b" +pass/copy-url "open url in browser") ("f" +pass/copy-field "get field")))) diff --git a/modules/tools/pdf/+modeline.el b/modules/tools/pdf/+modeline.el index 916886aae..f3fe0532c 100644 --- a/modules/tools/pdf/+modeline.el +++ b/modules/tools/pdf/+modeline.el @@ -6,8 +6,8 @@ (if (featurep! :ui modeline) (def-modeline-format! '+pdf - '(+mode-line-bar " " +mode-line-buffer-id " " +pdf-pages) - '(+mode-line-major-mode +mode-line-vcs)) + '(+modeline-matches " " +modeline-buffer-id " " +pdf-pages) + '(+modeline-major-mode (vc-mode (" " +modeline-vcs)))) (def-modeline! '+pdf '(bar matches " " buffer-info " " +pdf-pages) '(major-mode vcs))) diff --git a/modules/tools/pdf/config.el b/modules/tools/pdf/config.el index b4ce9e2d0..7ff08b179 100644 --- a/modules/tools/pdf/config.el +++ b/modules/tools/pdf/config.el @@ -34,8 +34,7 @@ (load! "+modeline")) ;; Handle PDF-tools related popups better (set-popup-rule! "^\\*Outline*" :side 'right :size 40 :select nil) - ;; TODO: Add additional important windows that should be handled differently - ;; TODO: These two next rules don't work (they should), investigate + ;; The next rules are not needed, they are defined in modules/ui/popups/+hacks.el ;; (set-popup-rule! "\\*Contents\\*" :side 'right :size 40) ;; (set-popup-rule! "* annots\\*$" :side 'left :size 40 :select nil) ) diff --git a/modules/ui/modeline/README.org b/modules/ui/modeline/README.org index e69de29bb..2b0c0f76b 100644 --- a/modules/ui/modeline/README.org +++ b/modules/ui/modeline/README.org @@ -0,0 +1,116 @@ +#+TITLE: ui/modeline +#+DATE: July 29, 2018 +#+SINCE: v2.0.9 +#+STARTUP: inlineimages + +* Table of Contents :TOC_2:noexport: +- [[Description][Description]] + - [[Module Flags][Module Flags]] + - [[Plugins][Plugins]] +- [[Prerequisites][Prerequisites]] +- [[Usage][Usage]] + - [[Hiding the modeline][Hiding the modeline]] + - [[Switching the modeline and header line][Switching the modeline and header line]] +- [[Configuration][Configuration]] + - [[Changing the default modeline][Changing the default modeline]] + - [[Activating a format][Activating a format]] + - [[Defining a modeline format][Defining a modeline format]] + - [[Defining a modeline segment][Defining a modeline segment]] + - [[Extracting Doom's modeline into your config][Extracting Doom's modeline into your config]] +- [[Troubleshooting][Troubleshooting]] + - [[Where are my minor modes?][Where are my minor modes?]] + - [[Icons in my modeline look strange][Icons in my modeline look strange]] +- [[Appendix][Appendix]] + - [[Commands][Commands]] + - [[Autodefs][Autodefs]] + - [[Functions][Functions]] + - [[Variables][Variables]] + - [[Faces][Faces]] + - [[Modeline segments][Modeline segments]] + +* Description +This module provides an Atom-inspired, minimalistic modeline for Doom Emacs, as +well as an API for building your own. + ++ A match count panel (for ~evil-search~, ~iedit~ and ~evil-substitute~) ++ An indicator for recording a macro ++ Local python/ruby version in the major-mode ++ A customizable mode-line height (see ~+doom-modeline-height~) ++ An error/warning count segment for flycheck + +[[/../screenshots/ml.png]] +[[/../screenshots/ml-search.png]] +[[/../screenshots/ml-subst.png]] +[[/../screenshots/ml-macro.png]] +[[/../screenshots/ml-version.png]] +[[/../screenshots/ml-errors.png]] + +** Module Flags +This module provides no flags. + +** Plugins ++ [[https://github.com/syohex/emacs-anzu][anzu]] ++ [[https://github.com/syohex/emacs-evil-anzu][evil-anzu]] ++ [[https://gitlab.com/bennya/shrink-path.el][shrink-path]] + +* Prerequisites +This module has no prerequisites. + +* Usage +** TODO Hiding the modeline + +** TODO Switching the modeline and header line + +* Configuration +** TODO Changing the default modeline + +** TODO Activating a format + +** TODO Defining a modeline format + +** TODO Defining a modeline segment + +** TODO Extracting Doom's modeline into your config + +* Troubleshooting +** Where are my minor modes? +I rarely need to know what minor modes are active, so I removed them. ~M-x +doom/what-minor-mode~ was written to substitute for it. + +** TODO Icons in my modeline look strange + +* Appendix +** Commands +This module exposes no public commands. +** Autodefs ++ ~def-modeline-format! NAME LEFT &optional RIGHT~ ++ ~def-modeline-segment! NAME &rest REST~ ++ ~set-modeline! NAME &optional DEFAULT~ +** Functions ++ +modeline-file-path +** Variables ++ +modeline-width ++ +modeline-height ++ +modeline-buffer-path-function ++ +modeline-format-left ++ +modeline-format-rigth +** Faces ++ doom-modeline-buffer-path ++ doom-modeline-buffer-file ++ doom-modeline-buffer-modified ++ doom-modeline-buffer-major-mode ++ doom-modeline-highlight ++ doom-modeline-panel ++ doom-modeline-info ++ doom-modeline-warning ++ doom-modeline-urgent ++ doom-modeline-bar +** Modeline segments ++ +modeline-buffer-state ++ +modeline-buffer-id ++ +modeline-buffer-directory ++ +modeline-vcs ++ +modeline-encoding ++ +modeline-major-mode ++ +modeline-matches ++ +modeline-selection-info diff --git a/modules/ui/modeline/config.el b/modules/ui/modeline/config.el index e25aa9fd0..a7212ee61 100644 --- a/modules/ui/modeline/config.el +++ b/modules/ui/modeline/config.el @@ -503,8 +503,8 @@ Meant for `+modeline-buffer-path-function'." (cond ((eq category 'coding-category-undecided) "") ((or (eq category 'coding-category-utf-8) - (eq (plist-get sys :name) 'prefer-utf-8)) - "UTF-8 ") + (string-match-p "utf-8" (symbol-name (plist-get sys :name)))) + "") ((concat (upcase (symbol-name (plist-get sys :name))) " "))) 'help-echo (plist-get (coding-system-plist buffer-file-coding-system) :docstring))))) diff --git a/modules/ui/vc-gutter/config.el b/modules/ui/vc-gutter/config.el index 1a3979bcd..9ee858511 100644 --- a/modules/ui/vc-gutter/config.el +++ b/modules/ui/vc-gutter/config.el @@ -25,9 +25,9 @@ to the right fringe.") (defun +version-control|git-gutter-maybe () "Enable `git-gutter-mode' in non-remote buffers." (when (and buffer-file-name - (vc-backend buffer-file-name) (or +vc-gutter-in-remote-files - (not (file-remote-p buffer-file-name)))) + (not (file-remote-p buffer-file-name))) + (vc-backend buffer-file-name)) (if (display-graphic-p) (progn (require 'git-gutter-fringe)