General refactor of modules
General code and comment improvements. Also, removed the :desc's for csv-mode because map! is currently unable to set which-key descriptions mode-locally, and should be avoided for anything but global keybinds. This will be fixed when General is introduced into Doom.
This commit is contained in:
parent
89b83f2457
commit
c58077810d
15 changed files with 59 additions and 57 deletions
|
@ -2,7 +2,7 @@
|
||||||
;;;###if (featurep! :feature evil)
|
;;;###if (featurep! :feature evil)
|
||||||
|
|
||||||
;;;###autoload (autoload '+format:region "editor/format/autoload/evil" nil t)
|
;;;###autoload (autoload '+format:region "editor/format/autoload/evil" nil t)
|
||||||
(evil-define-operator +format:region (beg end type)
|
(evil-define-operator +format:region (beg end)
|
||||||
"Evil ex interface to `+format/region'."
|
"Evil ex interface to `+format/region'."
|
||||||
(interactive "<R>")
|
(interactive "<r>")
|
||||||
(+format/region beg end))
|
(+format/region beg end))
|
||||||
|
|
|
@ -22,8 +22,9 @@ ignored. This makes it easy to override built-in snippets with private ones."
|
||||||
(let* ((gc-cons-threshold doom-gc-cons-upper-limit)
|
(let* ((gc-cons-threshold doom-gc-cons-upper-limit)
|
||||||
(choices (cl-remove-duplicates choices :test #'+snippets--remove-p)))
|
(choices (cl-remove-duplicates choices :test #'+snippets--remove-p)))
|
||||||
(if (cdr choices)
|
(if (cdr choices)
|
||||||
(let ((prompt-functions (remq '+snippets-prompt-private yas-prompt-functions)))
|
(cl-loop for fn in (cdr (memq '+snippets-prompt-private yas-prompt-functions))
|
||||||
(run-hook-with-args-until-success 'prompt-functions prompt choices fn))
|
if (funcall prompt choices fn)
|
||||||
|
return it)
|
||||||
(car choices)))))
|
(car choices)))))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
|
|
|
@ -27,14 +27,14 @@
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun +cc-c++-lineup-inclass (langelem)
|
(defun +cc-c++-lineup-inclass (langelem)
|
||||||
"Indent inclass lines one level further than access modifier keywords."
|
"Indent inclass lines one level further than access modifier keywords."
|
||||||
(when (and (eq major-mode 'c++-mode)
|
(and (eq major-mode 'c++-mode)
|
||||||
(or (assoc 'access-label c-syntactic-context)
|
(or (assoc 'access-label c-syntactic-context)
|
||||||
(save-excursion
|
(save-excursion
|
||||||
(save-match-data
|
(save-match-data
|
||||||
(re-search-backward
|
(re-search-backward
|
||||||
"\\(?:p\\(?:ublic\\|r\\(?:otected\\|ivate\\)\\)\\)"
|
"\\(?:p\\(?:ublic\\|r\\(?:otected\\|ivate\\)\\)\\)"
|
||||||
(c-langelem-pos langelem) t)))))
|
(c-langelem-pos langelem) t))))
|
||||||
'++))
|
'++))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun +cc-lineup-arglist-close (langlem)
|
(defun +cc-lineup-arglist-close (langlem)
|
||||||
|
@ -55,10 +55,9 @@ preceded by the opening brace or a comma (disregarding whitespace in between)."
|
||||||
(re-search-forward regexp magic-mode-regexp-match-limit t)))))
|
(re-search-forward regexp magic-mode-regexp-match-limit t)))))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun +cc-c-c++-objc-mode (&optional file)
|
(defun +cc-c-c++-objc-mode ()
|
||||||
"Sets either `c-mode', `objc-mode' or `c++-mode', whichever is appropriate."
|
"Sets either `c-mode', `objc-mode' or `c++-mode', whichever is appropriate."
|
||||||
(let ((base (file-name-sans-extension buffer-file-name))
|
(let ((base (file-name-sans-extension (buffer-file-name (buffer-base-buffer)))))
|
||||||
file)
|
|
||||||
(cond ((file-exists-p! (or (concat base ".cpp")
|
(cond ((file-exists-p! (or (concat base ".cpp")
|
||||||
(concat base ".cc")))
|
(concat base ".cc")))
|
||||||
(c++-mode))
|
(c++-mode))
|
||||||
|
@ -83,6 +82,8 @@ preceded by the opening brace or a comma (disregarding whitespace in between)."
|
||||||
"\\|" "#include" ws-maybe "<\\(?:string\\|iostream\\|map\\)>"
|
"\\|" "#include" ws-maybe "<\\(?:string\\|iostream\\|map\\)>"
|
||||||
"\\)")))
|
"\\)")))
|
||||||
(c++-mode))
|
(c++-mode))
|
||||||
|
((functionp +cc-default-header-file-mode)
|
||||||
|
(funcall +cc-default-header-file-mode))
|
||||||
((c-mode)))))
|
((c-mode)))))
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,10 @@
|
||||||
C/C++. Paths can be absolute. This is ignored if your project has a compilation
|
C/C++. Paths can be absolute. This is ignored if your project has a compilation
|
||||||
database.")
|
database.")
|
||||||
|
|
||||||
|
(defvar +cc-default-header-file-mode 'c-mode
|
||||||
|
"Fallback major mode for .h files if all other heuristics fail (in
|
||||||
|
`+cc-c-c++-objc-mode').")
|
||||||
|
|
||||||
(defvar +cc-default-compiler-options
|
(defvar +cc-default-compiler-options
|
||||||
`((c-mode . nil)
|
`((c-mode . nil)
|
||||||
(c++-mode
|
(c++-mode
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
;;; lang/crystal/config.el -*- lexical-binding: t; -*-
|
;;; lang/crystal/config.el -*- lexical-binding: t; -*-
|
||||||
|
|
||||||
(def-package! crystal-mode
|
(after! crystal-mode
|
||||||
:defer t
|
|
||||||
:config
|
|
||||||
(set-lookup-handlers! 'crystal-mode
|
(set-lookup-handlers! 'crystal-mode
|
||||||
:definition #'crystal-def-jump
|
:definition #'crystal-def-jump
|
||||||
:references #'crystal-tool-imp)
|
:references #'crystal-tool-imp)
|
||||||
|
@ -17,4 +15,5 @@
|
||||||
:after crystal-mode)
|
:after crystal-mode)
|
||||||
|
|
||||||
|
|
||||||
(def-package! inf-crystal :commands crystal-switch-to-inf)
|
(def-package! inf-crystal
|
||||||
|
:commands crystal-switch-to-inf)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
;;; lang/csharp/config.el -*- lexical-binding: t; -*-
|
;;; lang/csharp/config.el -*- lexical-binding: t; -*-
|
||||||
|
|
||||||
;; unity shaders
|
;; `shader-mode' --- unity shaders
|
||||||
(add-to-list 'auto-mode-alist '("\\.shader$" . shader-mode))
|
(add-to-list 'auto-mode-alist '("\\.shader$" . shader-mode))
|
||||||
|
|
||||||
|
|
||||||
|
@ -15,9 +15,10 @@
|
||||||
"Clean up the omnisharp server once you kill the last csharp-mode buffer."
|
"Clean up the omnisharp server once you kill the last csharp-mode buffer."
|
||||||
(unless (doom-buffers-in-mode 'csharp-mode (buffer-list))
|
(unless (doom-buffers-in-mode 'csharp-mode (buffer-list))
|
||||||
(omnisharp-stop-server)))
|
(omnisharp-stop-server)))
|
||||||
(add-hook! csharp-mode (add-hook 'kill-buffer-hook #'omnisharp-stop-server nil t))
|
(add-hook! csharp-mode
|
||||||
|
(add-hook 'kill-buffer-hook #'omnisharp-stop-server nil t))
|
||||||
|
|
||||||
(set-company-backend! 'csharp-mode '(company-omnisharp))
|
(set-company-backend! 'csharp-mode 'company-omnisharp)
|
||||||
|
|
||||||
(set-lookup-handlers! 'csharp-mode
|
(set-lookup-handlers! 'csharp-mode
|
||||||
:definition #'omnisharp-go-to-definition
|
:definition #'omnisharp-go-to-definition
|
||||||
|
|
|
@ -1,28 +1,27 @@
|
||||||
;;; lang/data/config.el -*- lexical-binding: t; -*-
|
;;; lang/data/config.el -*- lexical-binding: t; -*-
|
||||||
|
|
||||||
;; Built in plugins
|
;; Built in plugins
|
||||||
(unless after-init-time
|
(add-to-list 'auto-mode-alist '("/sxhkdrc\\'" . conf-mode))
|
||||||
(push '("/sxhkdrc\\'" . conf-mode) auto-mode-alist)
|
(add-to-list 'auto-mode-alist '("\\.\\(?:hex\\|nes\\)\\'" . hexl-mode))
|
||||||
(push '("\\.\\(?:hex\\|nes\\)\\'" . hexl-mode) auto-mode-alist)
|
(add-to-list 'auto-mode-alist '("\\.plist\\'" . nxml-mode))
|
||||||
(push '("\\.plist\\'" . nxml-mode) auto-mode-alist))
|
|
||||||
|
|
||||||
(after! nxml-mode
|
(after! nxml-mode
|
||||||
(set-company-backend! 'nxml-mode '(company-nxml company-yasnippet)))
|
(set-company-backend! 'nxml-mode '(company-nxml company-yasnippet)))
|
||||||
|
|
||||||
|
|
||||||
;; Third-party plugins
|
|
||||||
;;
|
;;
|
||||||
|
;; Third-party plugins
|
||||||
|
|
||||||
;; `csv-mode'
|
;; `csv-mode'
|
||||||
(map! :after csv-mode
|
(map! :after csv-mode
|
||||||
:map csv-mode-map
|
:map csv-mode-map
|
||||||
(:localleader
|
:localleader
|
||||||
:desc "Align fields" :nvm "a" #'csv-align-fields
|
:nvm "a" #'csv-align-fields
|
||||||
:desc "Unalign fields" :nvm "u" #'csv-unalign-fields
|
:nvm "u" #'csv-unalign-fields
|
||||||
:desc "Sort fields" :nvm "s" #'csv-sort-fields
|
:nvm "s" #'csv-sort-fields
|
||||||
:desc "Sort fields (n)" :nvm "S" #'csv-sort-numeric-fields
|
:nvm "S" #'csv-sort-numeric-fields
|
||||||
:desc "Kill fields" :nvm "k" #'csv-kill-fields
|
:nvm "k" #'csv-kill-fields
|
||||||
:desc "Transpose fields" :nvm "t" #'csv-transpose))
|
:nvm "t" #'csv-transpose)
|
||||||
|
|
||||||
(def-package! graphql-mode
|
(def-package! graphql-mode
|
||||||
:mode "\\.gql\\'")
|
:mode "\\.gql\\'")
|
||||||
|
@ -36,8 +35,8 @@
|
||||||
:mode "\\.?vimperatorrc\\'")
|
:mode "\\.?vimperatorrc\\'")
|
||||||
|
|
||||||
|
|
||||||
;; Frameworks
|
|
||||||
;;
|
;;
|
||||||
|
;; Frameworks
|
||||||
|
|
||||||
(def-project-mode! +data-ansible-mode
|
(def-project-mode! +data-ansible-mode
|
||||||
:modes (yaml-mode)
|
:modes (yaml-mode)
|
||||||
|
|
|
@ -16,7 +16,8 @@ to a pop up buffer."
|
||||||
(read-only-mode +1)
|
(read-only-mode +1)
|
||||||
(erase-buffer)
|
(erase-buffer)
|
||||||
(setq-local scroll-margin 0)
|
(setq-local scroll-margin 0)
|
||||||
(delay-mode-hooks (emacs-lisp-mode))
|
(let (emacs-lisp-mode-hook)
|
||||||
|
(emacs-lisp-mode))
|
||||||
(prin1 result buf)
|
(prin1 result buf)
|
||||||
(pp-buffer)
|
(pp-buffer)
|
||||||
(setq lines (count-lines (point-min) (point-max)))
|
(setq lines (count-lines (point-min) (point-max)))
|
||||||
|
|
|
@ -29,7 +29,6 @@
|
||||||
|
|
||||||
;;
|
;;
|
||||||
;; Major modes
|
;; Major modes
|
||||||
;;
|
|
||||||
|
|
||||||
(def-package! js2-mode
|
(def-package! js2-mode
|
||||||
:mode "\\.js\\'"
|
:mode "\\.js\\'"
|
||||||
|
@ -125,7 +124,6 @@
|
||||||
|
|
||||||
;;
|
;;
|
||||||
;; Tools
|
;; Tools
|
||||||
;;
|
|
||||||
|
|
||||||
(def-package! tide
|
(def-package! tide
|
||||||
:defer t
|
:defer t
|
||||||
|
@ -211,6 +209,7 @@
|
||||||
:localleader
|
:localleader
|
||||||
:n "se" #'skewer-html-eval-tag))
|
:n "se" #'skewer-html-eval-tag))
|
||||||
|
|
||||||
|
|
||||||
;; `npm-mode'
|
;; `npm-mode'
|
||||||
(map! :after npm-mode
|
(map! :after npm-mode
|
||||||
:map npm-mode-keymap
|
:map npm-mode-keymap
|
||||||
|
@ -224,9 +223,9 @@
|
||||||
:n "nr" #'npm-mode-npm-run
|
:n "nr" #'npm-mode-npm-run
|
||||||
:n "nv" #'npm-mode-visit-project-file)
|
:n "nv" #'npm-mode-visit-project-file)
|
||||||
|
|
||||||
|
|
||||||
;;
|
;;
|
||||||
;; Projects
|
;; Projects
|
||||||
;;
|
|
||||||
|
|
||||||
(def-project-mode! +javascript-npm-mode
|
(def-project-mode! +javascript-npm-mode
|
||||||
:modes (html-mode css-mode web-mode js2-mode rjsx-mode json-mode markdown-mode)
|
:modes (html-mode css-mode web-mode js2-mode rjsx-mode json-mode markdown-mode)
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
;; -*- no-byte-compile: t; -*-
|
;; -*- no-byte-compile: t; -*-
|
||||||
;;; lang/javascript/packages.el
|
;;; lang/javascript/packages.el
|
||||||
|
|
||||||
;; requires node npm js-beautify eslint eslint-plugin-react
|
|
||||||
|
|
||||||
(package! coffee-mode)
|
(package! coffee-mode)
|
||||||
(package! eslintd-fix)
|
(package! eslintd-fix)
|
||||||
(package! js2-mode)
|
(package! js2-mode)
|
||||||
|
|
|
@ -11,8 +11,8 @@
|
||||||
(set-company-backend! 'lua-mode '(company-lua company-yasnippet)))
|
(set-company-backend! 'lua-mode '(company-lua company-yasnippet)))
|
||||||
|
|
||||||
|
|
||||||
(after! moonscript
|
;; `moonscript'
|
||||||
(defvaralias 'moonscript-indent-offset 'tab-width))
|
(setq-hook! 'moonscript-mode-hook moonscript-indent-offset tab-width)
|
||||||
|
|
||||||
|
|
||||||
;;
|
;;
|
||||||
|
|
|
@ -42,7 +42,9 @@
|
||||||
|
|
||||||
(define-key python-mode-map (kbd "DEL") nil) ; interferes with smartparens
|
(define-key python-mode-map (kbd "DEL") nil) ; interferes with smartparens
|
||||||
(sp-with-modes 'python-mode
|
(sp-with-modes 'python-mode
|
||||||
(sp-local-pair "'" nil :unless '(sp-point-before-word-p sp-point-after-word-p sp-point-before-same-p)))
|
(sp-local-pair "'" nil :unless '(sp-point-before-word-p
|
||||||
|
sp-point-after-word-p
|
||||||
|
sp-point-before-same-p)))
|
||||||
|
|
||||||
(when (featurep! +ipython)
|
(when (featurep! +ipython)
|
||||||
(setq python-shell-interpreter "ipython"
|
(setq python-shell-interpreter "ipython"
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
'("tidy" "-q" "-indent"
|
'("tidy" "-q" "-indent"
|
||||||
"--tidy-mark" "no"
|
"--tidy-mark" "no"
|
||||||
"--drop-empty-elements" "no"
|
"--drop-empty-elements" "no"
|
||||||
"--show-body-only" "auto"
|
"--show-body-only" "auto" ; don't inject html/body tags
|
||||||
("--indent-spaces" "%d" tab-width)
|
("--indent-spaces" "%d" tab-width)
|
||||||
("--indent-with-tabs" "%s" (if indent-tabs-mode "yes" "no"))
|
("--indent-with-tabs" "%s" (if indent-tabs-mode "yes" "no"))
|
||||||
("-xml" (memq major-mode '(nxml-mode xml-mode))))
|
("-xml" (memq major-mode '(nxml-mode xml-mode))))
|
||||||
|
|
|
@ -1,14 +1,6 @@
|
||||||
;; -*- no-byte-compile: t; -*-
|
;; -*- no-byte-compile: t; -*-
|
||||||
;;; lang/web/packages.el
|
;;; lang/web/packages.el
|
||||||
|
|
||||||
;; requires js-beautify stylelint stylelint-scss
|
|
||||||
|
|
||||||
(package! rainbow-mode)
|
|
||||||
(when (featurep! :completion ivy)
|
|
||||||
(package! counsel-css))
|
|
||||||
(when (featurep! :completion helm)
|
|
||||||
(package! helm-css-scss))
|
|
||||||
|
|
||||||
;; +html.el
|
;; +html.el
|
||||||
(package! emmet-mode)
|
(package! emmet-mode)
|
||||||
(package! haml-mode)
|
(package! haml-mode)
|
||||||
|
@ -22,4 +14,8 @@
|
||||||
(package! less-css-mode)
|
(package! less-css-mode)
|
||||||
(package! sass-mode)
|
(package! sass-mode)
|
||||||
(package! stylus-mode)
|
(package! stylus-mode)
|
||||||
|
(package! rainbow-mode)
|
||||||
|
(when (featurep! :completion ivy)
|
||||||
|
(package! counsel-css))
|
||||||
|
(when (featurep! :completion helm)
|
||||||
|
(package! helm-css-scss))
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
(enh-ruby-mode enh-ruby-indent-level))
|
(enh-ruby-mode enh-ruby-indent-level))
|
||||||
editorconfig-indentation-alist)))
|
editorconfig-indentation-alist)))
|
||||||
|
|
||||||
(defun doom*editorconfig-smart-detection (orig-fn &rest args)
|
(defun doom*editorconfig-smart-detection (orig-fn)
|
||||||
"Retrieve the properties for the current file. If it doesn't have an
|
"Retrieve the properties for the current file. If it doesn't have an
|
||||||
extension, try to guess one."
|
extension, try to guess one."
|
||||||
(let ((buffer-file-name
|
(let ((buffer-file-name
|
||||||
|
@ -40,12 +40,13 @@ extension, try to guess one."
|
||||||
(if-let* ((ext (cdr (assq major-mode +editorconfig-mode-alist))))
|
(if-let* ((ext (cdr (assq major-mode +editorconfig-mode-alist))))
|
||||||
(concat "." ext)
|
(concat "." ext)
|
||||||
"")))))
|
"")))))
|
||||||
(apply orig-fn args)))
|
(funcall orig-fn)))
|
||||||
(advice-add #'editorconfig-call-editorconfig-exec :around #'doom*editorconfig-smart-detection)
|
(advice-add #'editorconfig-call-editorconfig-exec :around #'doom*editorconfig-smart-detection)
|
||||||
|
|
||||||
(defun +editorconfig|disable-ws-butler-maybe (props)
|
(defun +editorconfig|disable-ws-butler-maybe (props)
|
||||||
"Disable `ws-butler-mode' if trim_trailing_whitespace is true."
|
"Disable `ws-butler-mode' if trim_trailing_whitespace is true."
|
||||||
(when (equal (gethash 'trim_trailing_whitespace props) "true")
|
(when (and (equal (gethash 'trim_trailing_whitespace props) "true")
|
||||||
|
(bound-and-true-p ws-butler-mode))
|
||||||
(ws-butler-mode -1)))
|
(ws-butler-mode -1)))
|
||||||
(add-hook 'editorconfig-custom-hooks #'+editorconfig|disable-ws-butler-maybe)
|
(add-hook 'editorconfig-custom-hooks #'+editorconfig|disable-ws-butler-maybe)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue