Commit 8fc65b90 authored by David Sveningsson's avatar David Sveningsson
Browse files

emacs: some restructure

parent a4e4cd04
...@@ -82,10 +82,11 @@ ...@@ -82,10 +82,11 @@
solarized-high-contrast-mode-line t solarized-high-contrast-mode-line t
solarized-scale-org-headlines nil)) solarized-scale-org-headlines nil))
#+END_SRC #+END_SRC
* Swiper / Ivy / Counsel * Editor
** Swiper / Ivy / Counsel
Swiper gives us a really efficient incremental search with regular expressions Swiper gives us a really efficient incremental search with regular expressions
and Ivy / Counsel replace a lot of ido or helms completion functionality and Ivy / Counsel replace a lot of ido or helms completion functionality
** Counsel *** Counsel
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(use-package counsel (use-package counsel
:ensure t :ensure t
...@@ -106,7 +107,7 @@ ...@@ -106,7 +107,7 @@
"\\|\\(?:\\`.+?[#~]\\'\\)"))) ;; File names ending with # or ~ "\\|\\(?:\\`.+?[#~]\\'\\)"))) ;; File names ending with # or ~
#+END_SRC #+END_SRC
** Ivy *** Ivy
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(use-package ivy (use-package ivy
:ensure t :ensure t
...@@ -121,7 +122,7 @@ ...@@ -121,7 +122,7 @@
ivy-count-format "%d/%d " ivy-count-format "%d/%d "
ivy-display-style 'fancy)) ivy-display-style 'fancy))
#+END_SRC #+END_SRC
** Swiper *** Swiper
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(use-package swiper (use-package swiper
:ensure t :ensure t
...@@ -138,8 +139,31 @@ ...@@ -138,8 +139,31 @@
(define-key read-expression-map (kbd "C-r") 'counsel-expression-history) (define-key read-expression-map (kbd "C-r") 'counsel-expression-history)
)) ))
#+END_SRC #+END_SRC
* Navigation ** Mode-line: minions / moody
** Avy *** Minions
A minor-mode menu for the mode line.
#+BEGIN_SRC emacs-lisp
(use-package minions
:if window-system
:ensure t
:init (minions-mode)
:config
(setq x-underline-at-descent-line t)
(moody-replace-mode-line-buffer-identification)
(moody-replace-vc-mode))
#+END_SRC
*** Moody
Tabs and ribbons for the mode line.
#+BEGIN_SRC emacs-lisp
(use-package moody
:if window-system
:ensure t
:config
(moody-replace-mode-line-buffer-identification)
(moody-replace-vc-mode))
#+END_SRC
** Navigation
*** Avy
Navigate by searching for a letter on the screen and jumping to it. Navigate by searching for a letter on the screen and jumping to it.
See https://github.com/abo-abo/avy for more info See https://github.com/abo-abo/avy for more info
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
...@@ -148,7 +172,7 @@ ...@@ -148,7 +172,7 @@
:bind :bind
("M-s" . avy-goto-word-1)) ("M-s" . avy-goto-word-1))
#+END_SRC #+END_SRC
** Ace-window *** Ace-window
Quickly switch windows in Emacs Quickly switch windows in Emacs
See https://github.com/abo-abo/ace-window for more info See https://github.com/abo-abo/ace-window for more info
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
...@@ -158,19 +182,33 @@ ...@@ -158,19 +182,33 @@
(progn (progn
(global-set-key [remap other-window] 'ace-window))) (global-set-key [remap other-window] 'ace-window)))
#+END_SRC #+END_SRC
* Cua ** Cua
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
; Activate CUA by default (without C-z as it interferes with suspend) ; Activate CUA by default (without C-z as it interferes with suspend)
(setq cua-remap-control-z 'nil) (setq cua-remap-control-z 'nil)
(setq cua-auto-tabify-rectangles nil) (setq cua-auto-tabify-rectangles nil)
(cua-mode 1) (cua-mode 1)
#+END_SRC #+END_SRC
* Editorconfig ** String inflection
Cycle camelCase, snake_case etc.
#+BEGIN_SRC emacs-lisp
(global-set-key (kbd "C-c C-u") 'ext/string-inflection-all-cycle)
(defvar ext/string-inflection-map
(let ((map (make-sparse-keymap)))
(define-key map (kbd "C-u") 'ext/string-inflection-all-cycle)
map))
(defun ext/string-inflection-all-cycle ()
(interactive)
(string-inflection-all-cycle)
(set-transient-map ext/string-inflection-map t))
#+END_SRC
* Development
** Editorconfig
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(use-package editorconfig (use-package editorconfig
:ensure t) :ensure t)
#+END_SRC #+END_SRC
* Flycheck ** Flycheck
Syntax checking. https://www.flycheck.org/en/latest/ Syntax checking. https://www.flycheck.org/en/latest/
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(use-package flycheck (use-package flycheck
...@@ -186,8 +224,18 @@ Jump to errors with ~avy~. ~C-c ! g~. ...@@ -186,8 +224,18 @@ Jump to errors with ~avy~. ~C-c ! g~.
:ensure t :ensure t
:hook (global-flycheck-mode . avy-flycheck-setup)) :hook (global-flycheck-mode . avy-flycheck-setup))
#+END_SRC #+END_SRC
* Javascript * Project management
** add-node-modules-path ** Projectile
#+BEGIN_SRC emacs-lisp
(use-package projectile
:init
(projectile-mode +1)
:config
(define-key projectile-mode-map (kbd "C-c p") 'projectile-command-map))
#+END_SRC
* Languages
** Javascript
*** add-node-modules-path
Adds the ~node_modules/.bin~ directory to exec_path. Adds the ~node_modules/.bin~ directory to exec_path.
See https://github.com/codesuki/add-node-modules-path for more info. See https://github.com/codesuki/add-node-modules-path for more info.
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
...@@ -196,7 +244,7 @@ Jump to errors with ~avy~. ~C-c ! g~. ...@@ -196,7 +244,7 @@ Jump to errors with ~avy~. ~C-c ! g~.
:hook :hook
((typescript-mode js2-mode) . 'add-node-modules-path)) ((typescript-mode js2-mode) . 'add-node-modules-path))
#+END_SRC #+END_SRC
** tide - Typescript IDE *** tide - Typescript IDE
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(use-package tide (use-package tide
:ensure t :ensure t
...@@ -214,7 +262,7 @@ Jump to errors with ~avy~. ~C-c ! g~. ...@@ -214,7 +262,7 @@ Jump to errors with ~avy~. ~C-c ! g~.
:hook :hook
((typescript-mode js2-mode) . 'ext/setup-tide-mode)) ((typescript-mode js2-mode) . 'ext/setup-tide-mode))
#+END_SRC #+END_SRC
** js2-mode *** js2-mode
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(use-package js2-mode (use-package js2-mode
:mode "\\.js\\'" :mode "\\.js\\'"
...@@ -230,8 +278,8 @@ Jump to errors with ~avy~. ~C-c ! g~. ...@@ -230,8 +278,8 @@ Jump to errors with ~avy~. ~C-c ! g~.
(setq-default js2-basic-offset 2) (setq-default js2-basic-offset 2)
(setq-default js2-mode-show-strict-warnings nil)) (setq-default js2-mode-show-strict-warnings nil))
#+END_SRC #+END_SRC
* Web ** Web
** web-mode *** web-mode
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(use-package web-mode (use-package web-mode
:ensure t :ensure t
...@@ -270,7 +318,7 @@ Jump to errors with ~avy~. ~C-c ! g~. ...@@ -270,7 +318,7 @@ Jump to errors with ~avy~. ~C-c ! g~.
:demand t :demand t
:after web-mode) :after web-mode)
#+END_SRC #+END_SRC
** Emmet *** Emmet
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(use-package emmet-mode (use-package emmet-mode
:ensure t :ensure t
...@@ -280,7 +328,7 @@ Jump to errors with ~avy~. ~C-c ! g~. ...@@ -280,7 +328,7 @@ Jump to errors with ~avy~. ~C-c ! g~.
:config :config
(setq emmet-self-closing-tag-style "")) (setq emmet-self-closing-tag-style ""))
#+END_SRC #+END_SRC
* Markdown ** Markdown
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(use-package markdown-mode (use-package markdown-mode
:ensure t :ensure t
...@@ -338,15 +386,6 @@ _p_rev _u_pper _=_: upper/lower _r_esolve ...@@ -338,15 +386,6 @@ _p_rev _u_pper _=_: upper/lower _r_esolve
(use-package hydra (use-package hydra
:ensure hydra) :ensure hydra)
#+END_SRC #+END_SRC
* Project management
** Projectile
#+BEGIN_SRC emacs-lisp
(use-package projectile
:init
(projectile-mode +1)
:config
(define-key projectile-mode-map (kbd "C-c p") 'projectile-command-map))
#+END_SRC
* Org mode * Org mode
** Pin repo ** Pin repo
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
...@@ -446,37 +485,6 @@ Default configuration. ...@@ -446,37 +485,6 @@ Default configuration.
:after treemacs magit :after treemacs magit
:ensure t) :ensure t)
#+END_SRC #+END_SRC
* Minions / moody
#+BEGIN_SRC emacs-lisp
(use-package minions
:if window-system
:ensure t
:init (minions-mode)
:config
(setq x-underline-at-descent-line t)
(moody-replace-mode-line-buffer-identification)
(moody-replace-vc-mode))
(use-package moody
:if window-system
:ensure t
:config
(moody-replace-mode-line-buffer-identification)
(moody-replace-vc-mode))
#+END_SRC
* String inflection
cycle camelCase, snake_case etc
#+BEGIN_SRC emacs-lisp
(global-set-key (kbd "C-c C-u") 'ext/string-inflection-all-cycle)
(defvar ext/string-inflection-map
(let ((map (make-sparse-keymap)))
(define-key map (kbd "C-u") 'ext/string-inflection-all-cycle)
map))
(defun ext/string-inflection-all-cycle ()
(interactive)
(string-inflection-all-cycle)
(set-transient-map ext/string-inflection-map t))
#+END_SRC
* Custom functions * Custom functions
** inhibit-dtw ** inhibit-dtw
Customized ~delete-trailing-whitespace~ which can be toggled on/off. Customized ~delete-trailing-whitespace~ which can be toggled on/off.
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment