mirror of
https://github.com/Foltik/dotfiles
synced 2025-02-17 06:13:54 -05:00
Compare commits
4 Commits
4b212b4bd8
...
2f0a81dcb3
Author | SHA1 | Date | |
---|---|---|---|
2f0a81dcb3 | |||
7c48fdd049 | |||
03f4e6fb07 | |||
9633a901c7 |
@ -144,6 +144,38 @@ Also set up a leader key and prefixes, like =\= in Vim.
|
|||||||
("p" . "projects")
|
("p" . "projects")
|
||||||
("w" . "windows"))))
|
("w" . "windows"))))
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
** Macros
|
||||||
|
A helper for defining procedural keyboard macros
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(defun jf-replace-regexps-in-string (str regexps)
|
||||||
|
"Replace all pairs of (regex . replacement) defined by REGEXPS in STR."
|
||||||
|
(if (null regexps)
|
||||||
|
str
|
||||||
|
(jf-replace-regexps-in-string
|
||||||
|
(replace-regexp-in-string (caar regexps) (cdar regexps) str t)
|
||||||
|
(cdr regexps))))
|
||||||
|
|
||||||
|
(defun jf-kbd (str)
|
||||||
|
"Convert STR into a keyboard macro string by replacing terminal key sequences with GUI keycodes."
|
||||||
|
(let ((jf-kbd-regex '(("ESC" . "<escape>")
|
||||||
|
("DEL" . "<delete>")
|
||||||
|
("BS" . "<backspace>")
|
||||||
|
("RET" . "<return>")
|
||||||
|
("SPC" . "<SPC>")
|
||||||
|
("TAB" . "<tab>"))))
|
||||||
|
(jf-replace-regexps-in-string str jf-kbd-regex)))
|
||||||
|
|
||||||
|
(defun jf-kbd-exec (str)
|
||||||
|
"Execute the key sequence defined by STR. Terminal based keys are expanded to their graphical counterparts."
|
||||||
|
(let ((minibuffer-message-timeout 0))
|
||||||
|
(execute-kbd-macro (read-kbd-macro (jf-kbd str)))))
|
||||||
|
|
||||||
|
(defmacro jf-kbd-defmacro (name &rest forms)
|
||||||
|
"Create an interactive function NAME with body FORMS, where the evaluation of each form is executed as a keyboard macro."
|
||||||
|
`(defun ,name ()
|
||||||
|
(interactive)
|
||||||
|
,@(mapcan (lambda (form) `((jf-kbd-exec ,form))) forms)))
|
||||||
|
#+END_SRC
|
||||||
* Vim Emulation
|
* Vim Emulation
|
||||||
** Evil
|
** Evil
|
||||||
[[https://github.com/emacs-evil/evil][Evil]] is pretty much the entirety of Vim in Emacs.
|
[[https://github.com/emacs-evil/evil][Evil]] is pretty much the entirety of Vim in Emacs.
|
||||||
@ -717,39 +749,20 @@ Allows retrieving OpenWeatherMap forecasts in the minibuffer.
|
|||||||
(sunshine-show-icons t))
|
(sunshine-show-icons t))
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
* Programming
|
* Programming
|
||||||
** Macros
|
|
||||||
A helper for defining programmatic emacs/evil macros
|
|
||||||
#+BEGIN_SRC emacs-lisp
|
|
||||||
(defun jf-replace-regexps-in-string (str regexps)
|
|
||||||
"Replace all pairs of (regex . replacement) defined by REGEXPS in STR."
|
|
||||||
(if (null regexps)
|
|
||||||
str
|
|
||||||
(jf-replace-regexps-in-string
|
|
||||||
(replace-regexp-in-string (caar regexps) (cdar regexps) str t)
|
|
||||||
(cdr regexps))))
|
|
||||||
|
|
||||||
(defun jf-kbd (str)
|
|
||||||
"Convert STR into a keyboard macro string by replacing terminal key sequences with GUI keycodes."
|
|
||||||
(let ((jf-kbd-regex '(("ESC" . "<escape>")
|
|
||||||
("DEL" . "<delete>")
|
|
||||||
("BS" . "<backspace>")
|
|
||||||
("RET" . "<return>")
|
|
||||||
("SPC" . "<SPC>")
|
|
||||||
("TAB" . "<tab>"))))
|
|
||||||
(jf-replace-regexps-in-string str jf-kbd-regex)))
|
|
||||||
|
|
||||||
(defun jf-kbd-exec (str)
|
|
||||||
"Execute the key sequence defined by STR. Terminal based keys are expanded to their graphical counterparts."
|
|
||||||
(let ((minibuffer-message-timeout 0))
|
|
||||||
(execute-kbd-macro (read-kbd-macro (jf-kbd str)))))
|
|
||||||
|
|
||||||
(defmacro jf-kbd-defmacro (name &rest forms)
|
|
||||||
"Create an interactive function NAME with body FORMS, where the evaluation of each form is executed as a keyboard macro."
|
|
||||||
`(defun ,name ()
|
|
||||||
(interactive)
|
|
||||||
,@(mapcan (lambda (form) `((jf-kbd-exec ,form))) forms)))
|
|
||||||
#+END_SRC
|
|
||||||
** Formatting
|
** Formatting
|
||||||
|
*** Word Wrap
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(defun jf-word-wrap (column)
|
||||||
|
"Enable auto refill mode at COLUMN."
|
||||||
|
(interactive "nFill column: ")
|
||||||
|
(setq-local fill-column column)
|
||||||
|
(refill-mode))
|
||||||
|
|
||||||
|
(defun jf-nowrap ()
|
||||||
|
"Disable auto refill mode."
|
||||||
|
(interactive)
|
||||||
|
(refill-mode))
|
||||||
|
#+END_SRC
|
||||||
*** Indentation
|
*** Indentation
|
||||||
Set some *sane* defaults
|
Set some *sane* defaults
|
||||||
#+BEGIN_SRC emacs-lisp
|
#+BEGIN_SRC emacs-lisp
|
||||||
@ -819,6 +832,20 @@ And [[https://www.emacswiki.org/emacs/ParEdit][ParEdit]] handles the rest.
|
|||||||
:diminish
|
:diminish
|
||||||
:commands enable-paredit-mode)
|
:commands enable-paredit-mode)
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
**** Lispyville
|
||||||
|
And now Lispyville handles the rest.
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(use-package lispyville
|
||||||
|
:commands lispyville-mode
|
||||||
|
:config
|
||||||
|
(lispyville-set-key-theme
|
||||||
|
'(operators
|
||||||
|
c-w
|
||||||
|
slurp/barf-cp
|
||||||
|
commentary
|
||||||
|
(escape insert)
|
||||||
|
(additional-movement normal visual motion))))
|
||||||
|
#+END_SRC
|
||||||
**** Evil-Cleverparens
|
**** Evil-Cleverparens
|
||||||
[[https://github.com/luxbock/evil-cleverparens][Evil-Cleverparens]] adds additional features to Evil all about
|
[[https://github.com/luxbock/evil-cleverparens][Evil-Cleverparens]] adds additional features to Evil all about
|
||||||
working with sexps, including keeping parens balanced when
|
working with sexps, including keeping parens balanced when
|
||||||
@ -828,33 +855,32 @@ using commands like =dd=.
|
|||||||
:diminish
|
:diminish
|
||||||
:commands evil-cleverparens-mode)
|
:commands evil-cleverparens-mode)
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
**** Activation
|
||||||
|
Add a hook to enable paren helper modes for any prog-mode buffer
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(defun jf-paren-mode ()
|
||||||
|
"Pick a suitable parenthesis mode for the current major mode."
|
||||||
|
(electric-pair-mode)
|
||||||
|
(if (member major-mode '(emacs-lisp-mode
|
||||||
|
lisp-mode
|
||||||
|
lisp-interaction-mode
|
||||||
|
scheme-mode))
|
||||||
|
(lispyville-mode)
|
||||||
|
(smartparens-mode)))
|
||||||
|
|
||||||
|
(add-hook 'prog-mode-hook #'jf-paren-mode)
|
||||||
|
#+END_SRC
|
||||||
**** Helpers
|
**** Helpers
|
||||||
Helpers for wrangling sexps
|
Helpers for wrangling sexps
|
||||||
#+BEGIN_SRC emacs-lisp
|
#+BEGIN_SRC emacs-lisp
|
||||||
(jf-kbd-defmacro jf-wrap-fn-inline
|
(jf-kbd-defmacro jf-wrap-fn-inline
|
||||||
"ESC i{ DEL RET TAB ESC jI} SPC ESC k^")
|
"ESC i C-q { RET TAB ESC jI} SPC ESC k^")
|
||||||
|
|
||||||
(jf-kbd-defmacro jf-wrap-fn-line
|
(jf-kbd-defmacro jf-wrap-fn-line
|
||||||
"ESC kA SPC { DEL ESC jjI} SPC ESC k^")
|
"ESC kA SPC C-q { ESC jjI} SPC ESC k^")
|
||||||
|
|
||||||
(jf-kbd-defmacro jf-wrap-fn-sexp
|
(jf-kbd-defmacro jf-wrap-fn-sexp
|
||||||
"ESC i{ DEL RET TAB ESC )i} ESC i RET ESC k^")
|
"ESC i C-q { RET TAB ESC )i} ESC i RET ESC k^")
|
||||||
#+END_SRC
|
|
||||||
**** Activation
|
|
||||||
Pick a suitable parenthesis editing mode for the
|
|
||||||
current major mode when entering any prog-mode derivative.
|
|
||||||
#+BEGIN_SRC emacs-lisp
|
|
||||||
(defun jf-paren-mode ()
|
|
||||||
(electric-pair-mode)
|
|
||||||
(lispyville-mode))
|
|
||||||
;; (if (member major-mode '(emacs-lisp-mode
|
|
||||||
;; lisp-mode
|
|
||||||
;; lisp-interaction-mode
|
|
||||||
;; scheme-mode))
|
|
||||||
;; (enable-paredit-mode)
|
|
||||||
;; (smartparens-mode)))
|
|
||||||
|
|
||||||
(add-hook 'prog-mode-hook #'jf-paren-mode)
|
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
*** Whitespace
|
*** Whitespace
|
||||||
**** ws-butler
|
**** ws-butler
|
||||||
@ -907,7 +933,6 @@ pretty-mode left off.
|
|||||||
(add-hook 'python-mode-hook #'prettify-symbols-mode)
|
(add-hook 'python-mode-hook #'prettify-symbols-mode)
|
||||||
(add-hook 'python-mode-hook #'jf-prettify-python)
|
(add-hook 'python-mode-hook #'jf-prettify-python)
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
** Checkers
|
** Checkers
|
||||||
*** Flycheck
|
*** Flycheck
|
||||||
Flycheck highlights syntax errors in a few languages.
|
Flycheck highlights syntax errors in a few languages.
|
||||||
@ -1186,9 +1211,9 @@ cdlatex adds better TeX-specific template expansions and other niceties.
|
|||||||
:general
|
:general
|
||||||
(jf-major-def
|
(jf-major-def
|
||||||
:keymaps 'rust-mode-map
|
:keymaps 'rust-mode-map
|
||||||
"b" #'cargo-process-build
|
"b b" #'cargo-process-build
|
||||||
"r" #'cargo-process-run
|
"b r" #'cargo-process-run
|
||||||
"t" #'cargo-process-test))
|
"b t" #'cargo-process-test))
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
*** C/C++
|
*** C/C++
|
||||||
**** Irony
|
**** Irony
|
||||||
@ -1222,6 +1247,7 @@ company-irony for company integration
|
|||||||
(use-package elixir-mode
|
(use-package elixir-mode
|
||||||
:mode "\\.exs?\\'"
|
:mode "\\.exs?\\'"
|
||||||
:hook (elixir-mode . lsp))
|
:hook (elixir-mode . lsp))
|
||||||
|
#+END_SRC
|
||||||
*** Java
|
*** Java
|
||||||
**** Eclim
|
**** Eclim
|
||||||
Secretly actually use eclipse in the background in the form of eclimd
|
Secretly actually use eclipse in the background in the form of eclimd
|
||||||
@ -1239,7 +1265,16 @@ for all of the IDE like features.
|
|||||||
:company java-mode)
|
:company java-mode)
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
**** Gradle
|
**** Gradle
|
||||||
The std:: java build system
|
The std:: java build system
|
||||||
#+BEGIN_SRC emacs-lisp
|
#+BEGIN_SRC emacs-lisp
|
||||||
(use-package gradle-mode
|
(use-package gradle-mode
|
||||||
:commands gradle-mode)
|
:commands gradle-mode
|
||||||
|
:preface
|
||||||
|
(defun jf-gradle-run-main ()
|
||||||
|
(gradle-execute "run"))
|
||||||
|
:general
|
||||||
|
(jf-major-def
|
||||||
|
:keymaps 'gradle-mode-map
|
||||||
|
"b b" #'gradle-build
|
||||||
|
"b r" #'jf-gradle-run-main))
|
||||||
|
#+END_SRC
|
||||||
|
Loading…
Reference in New Issue
Block a user