General, minor refactor & reformatting

This commit is contained in:
Henrik Lissner 2020-03-27 18:06:31 -04:00
parent bcdadcd45d
commit 296cbff097
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
7 changed files with 63 additions and 60 deletions

View file

@ -353,8 +353,8 @@ windows, switch to `doom-fallback-buffer'. Otherwise, delegate to original
;; while we're in the minibuffer. ;; while we're in the minibuffer.
(setq enable-recursive-minibuffers t) (setq enable-recursive-minibuffers t)
;; Show current key-sequence in minibuffer, like vim does. Any feedback after ;; Show current key-sequence in minibuffer ala 'set showcmd' in vim. Any
;; typing is better UX than no feedback at all. ;; feedback after typing is better UX than no feedback at all.
(setq echo-keystrokes 0.02) (setq echo-keystrokes 0.02)
;; Expand the minibuffer to fit multi-line text displayed in the echo-area. This ;; Expand the minibuffer to fit multi-line text displayed in the echo-area. This
@ -364,7 +364,7 @@ windows, switch to `doom-fallback-buffer'. Otherwise, delegate to original
max-mini-window-height 0.15) max-mini-window-height 0.15)
;; Typing yes/no is obnoxious when y/n will do ;; Typing yes/no is obnoxious when y/n will do
(fset #'yes-or-no-p #'y-or-n-p) (advice-add #'yes-or-no-p :override #'y-or-n-p)
;; Try really hard to keep the cursor from getting stuck in the read-only prompt ;; Try really hard to keep the cursor from getting stuck in the read-only prompt
;; portion of the minibuffer. ;; portion of the minibuffer.
@ -421,17 +421,17 @@ windows, switch to `doom-fallback-buffer'. Otherwise, delegate to original
;; Temporarily disable `hl-line' when selection is active, since it doesn't ;; Temporarily disable `hl-line' when selection is active, since it doesn't
;; serve much purpose when the selection is so much more visible. ;; serve much purpose when the selection is so much more visible.
(defvar doom-buffer-hl-line-mode nil) (defvar doom--hl-line-mode nil)
(add-hook! '(evil-visual-state-entry-hook activate-mark-hook) (add-hook! '(evil-visual-state-entry-hook activate-mark-hook)
(defun doom-disable-hl-line-h () (defun doom-disable-hl-line-h ()
(when hl-line-mode (when hl-line-mode
(setq-local doom-buffer-hl-line-mode t) (setq-local doom--hl-line-mode t)
(hl-line-mode -1)))) (hl-line-mode -1))))
(add-hook! '(evil-visual-state-exit-hook deactivate-mark-hook) (add-hook! '(evil-visual-state-exit-hook deactivate-mark-hook)
(defun doom-enable-hl-line-maybe-h () (defun doom-enable-hl-line-maybe-h ()
(when doom-buffer-hl-line-mode (when doom--hl-line-mode
(hl-line-mode +1))))) (hl-line-mode +1)))))
@ -681,8 +681,8 @@ This offers a moderate boost in startup (or theme switch) time, so long as
(after! whitespace (after! whitespace
(defun doom-disable-whitespace-mode-in-childframes-a (orig-fn) (defun doom-disable-whitespace-mode-in-childframes-a (orig-fn)
"`whitespace-mode' inundates child frames with whitspace markers, so disable "`whitespace-mode' inundates child frames with whitespace markers, so
it to fix all that visual noise." disable it to fix all that visual noise."
(unless (frame-parameter nil 'parent-frame) (unless (frame-parameter nil 'parent-frame)
(funcall orig-fn))) (funcall orig-fn)))
(add-function :around whitespace-enable-predicate #'doom-disable-whitespace-mode-in-childframes-a)) (add-function :around whitespace-enable-predicate #'doom-disable-whitespace-mode-in-childframes-a))

View file

@ -22,24 +22,24 @@
It is fast and optimized for UI, Famous for the [[https://flutter.io/][Flutter]] framework, also It is fast and optimized for UI, Famous for the [[https://flutter.io/][Flutter]] framework, also
made by Google. Both Flutter and Dart are free and open-source. made by Google. Both Flutter and Dart are free and open-source.
This module wraps ~dart-mode~, with LSP code completion for =.dart= files,
syntax highlighting, etc.
** Maintainers ** Maintainers
This module has no dedicated maintainers. This module has no dedicated maintainers.
** Module Flags ** Module Flags
The `dart` module wraps `dart-mode`, with LSP code completion for `.dart` files, + =+lsp= Enable LSP server integration.
syntax highlighting, etc. Included is a `+lsp` flag for enabling LSP features, + =+flutter= Adds ~flutter~ integration and some sane defaults for Flutter
and a `+flutter` flag for working with Flutter. development.
+ =+lsp= Will start LSP automatically in `dart-mode-hook`.
+ =+flutter= Adds the `flutter` package and some settings for Flutter development.
** Plugins ** Plugins
+ [[https://github.com/bradyt/dart-mode][dart-mode]] + [[https://github.com/bradyt/dart-mode][dart-mode]]
+ [[https://github.com/amake/flutter.el][flutter.el]] + [[https://github.com/amake/flutter.el][flutter.el]]
* Prerequisites * Prerequisites
Make sure that the Dart SDK is on your `PATH`, and if using Flutter, make sure Make sure that the Dart SDK is on your ~PATH~, and if using Flutter, make sure
the Flutter binary is on your `PATH` as well. the Flutter binary is on your ~PATH~ as well.
** Installing Dart SDK ** Installing Dart SDK
Before starting note that Flutter SDK will have a version of Dart. Therefore, Before starting note that Flutter SDK will have a version of Dart. Therefore,
@ -50,20 +50,19 @@ The stable version of the SDK is in most major distributions repositories.
If you find it necessary to install any other version or build from source, If you find it necessary to install any other version or build from source,
please refer to the official website at: https://dart.dev/get-dart please refer to the official website at: https://dart.dev/get-dart
On Debian (also Ubuntu and its derivations), you can simply install the SDK via: + *On Debian (also Ubuntu and its derivations):*
#+BEGIN_SRC shell #+BEGIN_SRC shell
sudo apt-get install dart sudo apt-get install dart
#+END_SRC #+END_SRC
Or on Arch (and its derivations, like Manjaro), you can install it using: + *On Arch Linux (and derivations like Manjaro):*
#+BEGIN_SRC shell #+BEGIN_SRC shell
sudo pacman -S dart sudo pacman -S dart
#+END_SRC #+END_SRC
And finally in MacOS, the [[https://brew.sh/][Homebrew]] can come in handy. If you have it installed + *On macOS*:
just run: #+BEGIN_SRC shell
#+BEGIN_SRC shell brew tap dart-lang/dart
brew tap dart-lang/dart brew install dart#+END_SRC
brew install dart#+END_SRC #+END_SRC
#+END_SRC
** Installing Flutter SDK ** Installing Flutter SDK
Due to complications with permissions, it is suggested not to use AUR or any Due to complications with permissions, it is suggested not to use AUR or any
@ -71,6 +70,7 @@ automatic installation tools for Flutter SDK.
On any system just run the following commands to install Flutter, once you have On any system just run the following commands to install Flutter, once you have
met dependencies named on [[https://flutter.dev/docs/get-started/install/][the site]]: met dependencies named on [[https://flutter.dev/docs/get-started/install/][the site]]:
#+BEGIN_SRC shell #+BEGIN_SRC shell
git clone https://github.com/flutter/flutter --branch stable # to download Flutter git clone https://github.com/flutter/flutter --branch stable # to download Flutter
export PATH="$PATH:$(pwd)/flutter/bin" # to add it to PATH export PATH="$PATH:$(pwd)/flutter/bin" # to add it to PATH
@ -78,13 +78,13 @@ flutter doctor # for Dependency check and further instructions
#+END_SRC #+END_SRC
* Features * Features
+ Syntax highlighting and formatting for `.dart` files provided by LSP + Syntax highlighting and formatting for ~.dart~ files provided by LSP
+ Emacs functions for running and debugging Flutter projects + Emacs functions for running and debugging Flutter projects
* Configuration * Configuration
** Dart & Flutter ** Dart & Flutter
On Linux, the installers for Dart and Flutter use the `/opt` directory, and this On Linux, the installers for Dart and Flutter use the ~/opt~ directory, and this
module assumes that. However, you may set `lsp-dart-sdk-dir` to your Dart module assumes that. However, you may set ~lsp-dart-sdk-dir~ to your Dart
install directory, if it differs, to make sure LSP can find the language server install directory, if it differs, to make sure LSP can find the language server
included with the Dart SDK. included with the Dart SDK.
@ -93,12 +93,12 @@ and Flutter on your `PATH` variable.
** Android ** Android
You will also need to setup your system for Android development if you intend to You will also need to setup your system for Android development if you intend to
use Flutter to develop mobile applications. Refer to your distributions package use Flutter to develop mobile applications. Refer to your distributions package
manager for details. In most distributions the `/opt/android-sdk` directory is manager for details. In most distributions the ~/opt/android-sdk~ directory is
used, and you might have to change some permissions in this directory since it's used, and you might have to change some permissions in this directory since it's
owned by root. The [[https://wiki.archlinux.org/index.php/Android][Arch Linux wiki has a great guide on this here.]] owned by root. The [[https://wiki.archlinux.org/index.php/Android][Arch Linux wiki has a great guide on this here.]]
* Troubleshooting * Troubleshooting
See the configuration section for information on the binaries for Dart and See the configuration section for information on the binaries for Dart and
Flutter. On new installs to the `/opt` directory, you will likely need to edit Flutter. On new installs to the ~/opt~ directory, you will likely need to edit
the permissions of the `/opt/dart-sdk` and `/opt/flutter` directories (not to the permissions of the ~/opt/dart-sdk~ and ~/opt/flutter~ directories (not to
mention the Android SDK, as discussed above). mention the Android SDK, as discussed above).

View file

@ -11,6 +11,8 @@
- [[#macos][MacOS]] - [[#macos][MacOS]]
- [[#arch-linux][Arch Linux]] - [[#arch-linux][Arch Linux]]
- [[#opensuse][openSUSE]] - [[#opensuse][openSUSE]]
- [[#troubleshooting][Troubleshooting]]
- [[#tide-sort-completions-by-kind-isnt-respected][~tide-sort-completions-by-kind~ isn't respected]]
- [[#appendix][Appendix]] - [[#appendix][Appendix]]
- [[#commands][Commands]] - [[#commands][Commands]]
@ -62,6 +64,12 @@ sudo pacman --needed --noconfirm -S nodejs npm
sudo zypper install nodejs npm sudo zypper install nodejs npm
#+END_SRC #+END_SRC
* Troubleshooting
** ~tide-sort-completions-by-kind~ isn't respected
The =:completion company= module uses =company-prescient= to sort completion by
[[https://developer.mozilla.org/en-US/docs/Mozilla/Tech/Places/Frecency_algorithm][frecency]], which overrules specialized sorting provided by some company backends
(like ~company-tide~).
* Appendix * Appendix
** Commands ** Commands
*** JS2-mode *** JS2-mode

View file

@ -233,11 +233,7 @@ Is relative to `org-directory', unless it is absolute. Is used in Doom's default
(add-to-list 'org-babel-load-languages (cons lang t))) (add-to-list 'org-babel-load-languages (cons lang t)))
t)) t))
(defadvice! +org--noop-org-babel-do-load-languages-a (&rest _) (advice-add #'org-babel-do-load-languages :override #'ignore))
:override #'org-babel-do-load-languages
(message
(concat "`org-babel-do-load-languages' is redundant with Doom's lazy loading mechanism for babel "
"packages. There is no need to use it, so it has been disabled"))))
(defun +org-init-capture-defaults-h () (defun +org-init-capture-defaults-h ()

View file

@ -10,6 +10,7 @@
(use-package! rustic (use-package! rustic
:mode ("\\.rs$" . rustic-mode) :mode ("\\.rs$" . rustic-mode)
:commands rustic-run-cargo-command rustic-cargo-outdated :commands rustic-run-cargo-command rustic-cargo-outdated
:hook (rustic-mode . rainbow-delimiters-mode)
:config :config
(set-docsets! 'rustic-mode "Rust") (set-docsets! 'rustic-mode "Rust")
(set-popup-rule! "^\\*rustic-compilation" :vslot -1) (set-popup-rule! "^\\*rustic-compilation" :vslot -1)
@ -18,8 +19,6 @@
;; use :editor format instead ;; use :editor format instead
rustic-format-trigger nil) rustic-format-trigger nil)
(add-hook 'rustic-mode-hook #'rainbow-delimiters-mode)
(if (featurep! +lsp) (if (featurep! +lsp)
(add-hook 'rustic-mode-local-vars-hook #'lsp!) (add-hook 'rustic-mode-local-vars-hook #'lsp!)
(setq rustic-lsp-server nil) (setq rustic-lsp-server nil)

View file

@ -1,7 +1,7 @@
#+TITLE: ui/doom #+TITLE: ui/doom
#+DATE: October 9, 2019 #+DATE: October 9, 2019
#+SINCE: v1.3 #+SINCE: v1.3
#+STARTUP: inlineimages #+STARTUP: inlineimages nofold
* Table of Contents :TOC_3:noexport: * Table of Contents :TOC_3:noexport:
- [[#description][Description]] - [[#description][Description]]

View file

@ -55,19 +55,19 @@
(skip-chars-forward " \t\r")) (skip-chars-forward " \t\r"))
(map! :map neotree-mode-map (map! :map neotree-mode-map
:n [tab] (neotree-make-executor :n [tab] (neotree-make-executor
:dir-fn #'neo-open-dir :dir-fn #'neo-open-dir
:file-fn #'neotree-quick-look) :file-fn #'neotree-quick-look)
:n "DEL" #'evil-window-prev :n "DEL" #'evil-window-prev
:n "n" #'neotree-next-line :n "n" #'neotree-next-line
:n "p" #'neotree-previous-line :n "p" #'neotree-previous-line
:m "h" #'+neotree/collapse-or-up :m "h" #'+neotree/collapse-or-up
:m "l" #'+neotree/expand-or-open :m "l" #'+neotree/expand-or-open
:n "J" #'neotree-select-next-sibling-node :n "J" #'neotree-select-next-sibling-node
:n "K" #'neotree-select-previous-sibling-node :n "K" #'neotree-select-previous-sibling-node
:n "H" #'neotree-select-up-node :n "H" #'neotree-select-up-node
:n "L" #'neotree-select-down-node :n "L" #'neotree-select-down-node
:n "G" #'evil-goto-line :n "G" #'evil-goto-line
:n "gg" #'evil-goto-first-line :n "gg" #'evil-goto-first-line
:n "v" (neotree-make-executor :file-fn 'neo-open-file-vertical-split) :n "v" (neotree-make-executor :file-fn 'neo-open-file-vertical-split)
:n "s" (neotree-make-executor :file-fn 'neo-open-file-horizontal-split))) :n "s" (neotree-make-executor :file-fn 'neo-open-file-horizontal-split)))