[Emacs] Update packages, add Eshell syntax highlight

This commit is contained in:
Lucien Cartier-Tilet 2020-12-01 21:55:00 +01:00
parent 5d1bd2c45f
commit fe13ebd0cc
Signed by: phundrak
GPG Key ID: BD7789E705CB8DCA
2 changed files with 105 additions and 99 deletions

View File

@ -121,7 +121,7 @@ This function is called at the very end of Spacemacs initialization."
'(objed-cursor-color "#ff6c6b") '(objed-cursor-color "#ff6c6b")
'(org-export-headline-levels 4) '(org-export-headline-levels 4)
'(package-selected-packages '(package-selected-packages
'(aio caddyfile-mode ob-swift wttrin wrap-region pinentry org-tree-slide org-sidebar org-ql peg ov org-super-agenda ts dired-du caddyfile-mode loop xkcd vmd-mode visual-fill-column typit mmt sudoku restclient-helm pony-mode pacmacs ox-reveal outorg ob-restclient ob-http meson-mode ibuffer-projectile lv helm-w3m w3m graphviz-dot-mode flycheck-gometalinter transient ess-smart-equals ess-R-data-view ctable ess julia-mode eshell-git-prompt emoji-cheat-sheet-plus edit-indirect dockerfile-mode docker docker-tramp company-restclient restclient know-your-http-well company-quickhelp company-emoji company-emacs-eclim eclim atomic-chrome websocket 2048-game ox-gfm slime-company slime common-lisp-snippets erlang insert-shebang fish-mode company-shell faceup racket-mode treepy graphql yapfify yaml-mode xterm-color web-beautify twittering-mode toml-mode tagedit stickyfunc-enhance smeargle slim-mode shell-pop selectric-mode scss-mode sass-mode ranger rainbow-identifiers pytest pyenv-mode py-isort pug-mode plantuml-mode phpunit phpcbf php-auto-yasnippets pdf-tools tablist ox-pandoc orgit org-present org-pomodoro alert log4e gntp ob-elixir multi-term markdown-toc magit-gitflow magit-gh-pulls livid-mode live-py-mode json-snatcher js2-refactor js-doc htmlize hlint-refactor hindent helm-pydoc helm-hoogle helm-gitignore helm-css-scss haskell-snippets haml-mode gnuplot glsl-mode gitignore-mode github-search github-clone github-browse-file gitconfig-mode gitattributes-mode git-messenger gist gh marshal logito pcache ht gh-md flyspell-correct-helm flyspell-correct flycheck-rust pos-tip flycheck-mix flycheck-credo eshell-z eshell-prompt-extras esh-help drupal-mode disaster cython-mode dash-functional tern company-ghci company-ghc ghc color-identifiers-mode cmm-mode clang-format cargo auto-dictionary alchemist modern-cpp-font-lock yasnippet-snippets x86-lookup web-mode srefactor racer pyvenv pip-requirements pandoc-mode org-projectile org-category-capture org-mime org-download nasm-mode json-reformat intero imenu-list hy-mode git-timemachine git-link geiser flycheck-pos-tip flycheck-haskell evil-magit emmet-mode cmake-mode anaconda-mode rust-mode elixir-mode flycheck haskell-mode multiple-cursors skewer-mode simple-httpd markdown-mode magit magit-popup git-commit ghub with-editor pythonic emms gmail-message-mode ham-mode html-to-markdown flymd edit-server image-dired+ go-guru go-eldoc company-go go-mode unfill mwim company-web web-completion-data company-tern company-cabal company-c-headers company-auctex company-anaconda elcord xresources-theme sql-indent rainbow-mode php-extras php-mode mmm-mode json-mode js2-mode csv-mode coffee-mode auctex helm-company helm-c-yasnippet fuzzy company-statistics company auto-yasnippet yasnippet ac-ispell auto-complete ws-butler winum which-key volatile-highlights vi-tilde-fringe uuidgen use-package toc-org spaceline powerline restart-emacs request rainbow-delimiters popwin persp-mode pcre2el paradox spinner org-plus-contrib org-bullets open-junk-file neotree move-text macrostep lorem-ipsum linum-relative link-hint indent-guide hydra hungry-delete hl-todo highlight-parentheses highlight-numbers parent-mode highlight-indentation helm-themes helm-swoop helm-projectile helm-mode-manager helm-make projectile pkg-info epl helm-flx helm-descbinds helm-ag google-translate golden-ratio flx-ido flx fill-column-indicator fancy-battery eyebrowse expand-region exec-path-from-shell evil-visualstar evil-visual-mark-mode evil-unimpaired evil-tutor evil-surround evil-search-highlight-persist evil-numbers evil-nerd-commenter evil-mc evil-matchit evil-lisp-state smartparens evil-indent-plus evil-iedit-state iedit evil-exchange evil-escape evil-ediff evil-args evil-anzu anzu evil goto-chg undo-tree eval-sexp-fu highlight elisp-slime-nav dumb-jump f dash s diminish define-word column-enforce-mode clean-aindent-mode bind-map bind-key auto-highlight-symbol auto-compile packed aggressive-indent adaptive-wrap ace-window ace-link ace-jump-helm-line helm avy helm-core popup async)) '(eshell-syntax-highlighting aio caddyfile-mode ob-swift wttrin wrap-region pinentry org-tree-slide org-sidebar org-ql peg ov org-super-agenda ts dired-du caddyfile-mode loop xkcd vmd-mode visual-fill-column typit mmt sudoku restclient-helm pony-mode pacmacs ox-reveal outorg ob-restclient ob-http meson-mode ibuffer-projectile lv helm-w3m w3m graphviz-dot-mode flycheck-gometalinter transient ess-smart-equals ess-R-data-view ctable ess julia-mode eshell-git-prompt emoji-cheat-sheet-plus edit-indirect dockerfile-mode docker docker-tramp company-restclient restclient know-your-http-well company-quickhelp company-emoji company-emacs-eclim eclim atomic-chrome websocket 2048-game ox-gfm slime-company slime common-lisp-snippets erlang insert-shebang fish-mode company-shell faceup racket-mode treepy graphql yapfify yaml-mode xterm-color web-beautify twittering-mode toml-mode tagedit stickyfunc-enhance smeargle slim-mode shell-pop selectric-mode scss-mode sass-mode ranger rainbow-identifiers pytest pyenv-mode py-isort pug-mode plantuml-mode phpunit phpcbf php-auto-yasnippets pdf-tools tablist ox-pandoc orgit org-present org-pomodoro alert log4e gntp ob-elixir multi-term markdown-toc magit-gitflow magit-gh-pulls livid-mode live-py-mode json-snatcher js2-refactor js-doc htmlize hlint-refactor hindent helm-pydoc helm-hoogle helm-gitignore helm-css-scss haskell-snippets haml-mode gnuplot glsl-mode gitignore-mode github-search github-clone github-browse-file gitconfig-mode gitattributes-mode git-messenger gist gh marshal logito pcache ht gh-md flyspell-correct-helm flyspell-correct flycheck-rust pos-tip flycheck-mix flycheck-credo eshell-z eshell-prompt-extras esh-help drupal-mode disaster cython-mode dash-functional tern company-ghci company-ghc ghc color-identifiers-mode cmm-mode clang-format cargo auto-dictionary alchemist modern-cpp-font-lock yasnippet-snippets x86-lookup web-mode srefactor racer pyvenv pip-requirements pandoc-mode org-projectile org-category-capture org-mime org-download nasm-mode json-reformat intero imenu-list hy-mode git-timemachine git-link geiser flycheck-pos-tip flycheck-haskell evil-magit emmet-mode cmake-mode anaconda-mode rust-mode elixir-mode flycheck haskell-mode multiple-cursors skewer-mode simple-httpd markdown-mode magit magit-popup git-commit ghub with-editor pythonic emms gmail-message-mode ham-mode html-to-markdown flymd edit-server image-dired+ go-guru go-eldoc company-go go-mode unfill mwim company-web web-completion-data company-tern company-cabal company-c-headers company-auctex company-anaconda elcord xresources-theme sql-indent rainbow-mode php-extras php-mode mmm-mode json-mode js2-mode csv-mode coffee-mode auctex helm-company helm-c-yasnippet fuzzy company-statistics company auto-yasnippet yasnippet ac-ispell auto-complete ws-butler winum which-key volatile-highlights vi-tilde-fringe uuidgen use-package toc-org spaceline powerline restart-emacs request rainbow-delimiters popwin persp-mode pcre2el paradox spinner org-plus-contrib org-bullets open-junk-file neotree move-text macrostep lorem-ipsum linum-relative link-hint indent-guide hydra hungry-delete hl-todo highlight-parentheses highlight-numbers parent-mode highlight-indentation helm-themes helm-swoop helm-projectile helm-mode-manager helm-make projectile pkg-info epl helm-flx helm-descbinds helm-ag google-translate golden-ratio flx-ido flx fill-column-indicator fancy-battery eyebrowse expand-region exec-path-from-shell evil-visualstar evil-visual-mark-mode evil-unimpaired evil-tutor evil-surround evil-search-highlight-persist evil-numbers evil-nerd-commenter evil-mc evil-matchit evil-lisp-state smartparens evil-indent-plus evil-iedit-state iedit evil-exchange evil-escape evil-ediff evil-args evil-anzu anzu evil goto-chg undo-tree eval-sexp-fu highlight elisp-slime-nav dumb-jump f dash s diminish define-word column-enforce-mode clean-aindent-mode bind-map bind-key auto-highlight-symbol auto-compile packed aggressive-indent adaptive-wrap ace-window ace-link ace-jump-helm-line helm avy helm-core popup async))
'(pdf-view-midnight-colors '("#655370" . "#fbf8ef")) '(pdf-view-midnight-colors '("#655370" . "#fbf8ef"))
'(safe-local-variable-values '(safe-local-variable-values
'((org-confirm-babel-evaluate) '((org-confirm-babel-evaluate)

View File

@ -65,23 +65,24 @@ However, I do have additional packages I installed either from the Elpa or the M
With the variable ~dotspacemacs-additional-packages~, it is possible to install extra packages which are not already included in any layers. Dependencies should be explicitly included as they wont be resolved automatically. Here is a table of all the extra packages I use: With the variable ~dotspacemacs-additional-packages~, it is possible to install extra packages which are not already included in any layers. Dependencies should be explicitly included as they wont be resolved automatically. Here is a table of all the extra packages I use:
#+NAME: extra-packages #+NAME: extra-packages
| name of the package | why is it installed | | name of the package | why is it installed |
|---------------------+------------------------------------------------------| |----------------------------+------------------------------------------------------|
| caddyfile-mode | Major mode for editing Caddyfiles | | caddyfile-mode | Major mode for editing Caddyfiles |
| edit-indirect | edit region in separate buffer | | edit-indirect | edit region in separate buffer |
| elcord | rich integration of Emacs in Discord | | elcord | rich integration of Emacs in Discord |
| magit-gitflow | integrate gitflow in Magit | | eshell-syntax-highlighting | Eshell Syntax Highlight |
| multiple-cursors | I dont like the layer, I prefer this package alone | | magit-gitflow | integrate gitflow in Magit |
| ob-swift | org-babel package for Swift | | multiple-cursors | I dont like the layer, I prefer this package alone |
| org-sidebar | display on the side the outline of an Org buffer | | ob-swift | org-babel package for Swift |
| org-tree-slide | presentation tool for org-mode | | org-sidebar | display on the side the outline of an Org buffer |
| outorg | edit comments as Org-mode buffers | | org-tree-slide | presentation tool for org-mode |
| pinentry | enter a GPG password from Emacs | | outorg | edit comments as Org-mode buffers |
| s | The long lost Emacs string manipulation library. | | pinentry | enter a GPG password from Emacs |
| visual-fill-column | allow the use of ~fill-column~ in ~visual-line-mode~ | | s | The long lost Emacs string manipulation library. |
| wrap-region | easily wrap region with delimiters | | visual-fill-column | allow the use of ~fill-column~ in ~visual-line-mode~ |
| wttrin | weather in Emacs | | wrap-region | easily wrap region with delimiters |
| yasnippet-snippets | snippets for YaSnippet | | wttrin | weather in Emacs |
| yasnippet-snippets | snippets for YaSnippet |
#+name: make-extra-pkg #+name: make-extra-pkg
#+begin_src emacs-lisp :var packages=extra-packages[,0] :tangle no :exports none #+begin_src emacs-lisp :var packages=extra-packages[,0] :tangle no :exports none
@ -1390,80 +1391,6 @@ By the way, lets enable ~org-download~ when we are in a Dired buffer:
:END: :END:
Eshell is a built-in shell available from Emacs which I use almost as often as Fish. Some adjustments are necessary for making this shell usable for me. Eshell is a built-in shell available from Emacs which I use almost as often as Fish. Some adjustments are necessary for making this shell usable for me.
**** Environment variables
:PROPERTIES:
:CUSTOM_ID: User_Configuration-Eshell-Environment_variables-8dac73e0
:END:
Some environment variables need to be correctly set so Eshell can correctly work. The first environment variable to be set is the ~PATH~, as I have a couple of directories where executables are located. Lets add them to our path.
#+BEGIN_SRC emacs-lisp
(setenv "PATH"
(concat
(getenv "HOME") "/.pub-cache/bin"
":" (getenv "HOME") "/.local/bin"
":" (getenv "HOME") "/go/bin"
":" (getenv "HOME") "/.cargo/bin"
":" (getenv "HOME") "/.gem/ruby/2.6.0/bin"
":" (getenv "PATH")))
#+END_SRC
I would also like to set two environment variables related to Dart development: the ~DART_SDK~ and ~ANDROID_HOME~ variables.
#+BEGIN_SRC emacs-lisp
(setenv "DART_SDK" "/opt/dart-sdk/bin")
(setenv "ANDROID_HOME" (concat (getenv "HOME") "/Android/Sdk/"))
#+END_SRC
Finally, Id like to add a custom directory to the ~PKG_CONFIG_PATH~:
#+BEGIN_SRC emacs-lisp
(setenv "PKG_CONFIG_PATH" (concat
"/usr/local/lib/pkgconfig/" ":"
(getenv "PKG_CONFIG_PATH")))
#+END_SRC
The ~EDITOR~ variable also needs to be set for git commands, especially the ~yadm~ commands.
#+BEGIN_SRC emacs-lisp
(setenv "EDITOR" "emacsclient -c")
#+END_SRC
**** Custom functions
:PROPERTIES:
:CUSTOM_ID: User_Configuration-Eshell-Custom_functions-79d98245
:END:
When Im in Eshell, sometimes I wish to open multiple files at once in Emacs. For this, when I have several arguments for ~find-file~, I want to be able to open them all at once. Lets modify ~find-file~ like so:
#+BEGIN_SRC emacs-lisp
(defadvice find-file (around find-files activate)
"Also find all files within a list of files. This even works recursively."
(if (listp filename)
(loop for f in filename do (find-file f wildcards))
ad-do-it))
#+END_SRC
I also want to be able to have multiple instances of Eshell opened at once. For that, I declared the function ~eshell-new~ that does exactly that.
#+BEGIN_SRC emacs-lisp
(defun eshell-new()
"Open a new instance of eshell."
(interactive)
(eshell 'N))
#+END_SRC
***** Redirect text editors to Emacs
:PROPERTIES:
:CUSTOM_ID: User_Configuration-Eshell-Custom_functions-Redirect_text_editors_to_Emacs-dff362c6
:END:
I still have some muscle memory telling me to open nano, ed, or vim, and sometimes I even try to type ~emacs~ in the terminal, which is stupid with Eshell since Im already inside Emacs. So, for each of these text editors, lets make the command open the files in Emacs.
#+BEGIN_SRC emacs-lisp
(defun eshell/emacs (&rest $files)
"Open a file in a new buffer. Old habits die hard"
(if (null $files)
(bury-buffer)
(mapc #'find-file
(mapcar #'expand-file-name
(eshell-flatten-list (reverse $files))))))
(defalias 'eshell/vi 'eshell/emacs)
(defalias 'eshell/vim 'eshell/emacs)
(defalias 'eshell/ed 'eshell/emacs)
(defalias 'eshell/nano 'eshell/emacs)
#+END_SRC
**** Aliases **** Aliases
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: User_Configuration-Eshell-Aliases-ef06615f :CUSTOM_ID: User_Configuration-Eshell-Aliases-ef06615f
@ -1576,16 +1503,78 @@ The first command is ~remove~ which removes a package and its dependencies from
(eshell/clear $args)) (eshell/clear $args))
#+END_SRC #+END_SRC
**** Visual commands **** Custom functions
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: User_Configuration-Eshell-Visual_commands-2b15e0dc :CUSTOM_ID: User_Configuration-Eshell-Custom_functions-79d98245
:END: :END:
With Eshell, some commands dont work very well, especially commands that create a TUI. So, lets declare them as visual commands or subcommands: When Im in Eshell, sometimes I wish to open multiple files at once in Emacs. For this, when I have several arguments for ~find-file~, I want to be able to open them all at once. Lets modify ~find-file~ like so:
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(setq eshell-visual-commands (defadvice find-file (around find-files activate)
'("fish" "zsh" "bash" "tmux" "htop" "top" "vim" "bat" "nano") "Also find all files within a list of files. This even works recursively."
eshell-visual-subcommands (if (listp filename)
'("git" "log" "l" "diff" "show")) (loop for f in filename do (find-file f wildcards))
ad-do-it))
#+END_SRC
I also want to be able to have multiple instances of Eshell opened at once. For that, I declared the function ~eshell-new~ that does exactly that.
#+BEGIN_SRC emacs-lisp
(defun eshell-new()
"Open a new instance of eshell."
(interactive)
(eshell 'N))
#+END_SRC
***** Redirect text editors to Emacs
:PROPERTIES:
:CUSTOM_ID: User_Configuration-Eshell-Custom_functions-Redirect_text_editors_to_Emacs-dff362c6
:END:
I still have some muscle memory telling me to open nano, ed, or vim, and sometimes I even try to type ~emacs~ in the terminal, which is stupid with Eshell since Im already inside Emacs. So, for each of these text editors, lets make the command open the files in Emacs.
#+BEGIN_SRC emacs-lisp
(defun eshell/emacs (&rest $files)
"Open a file in a new buffer. Old habits die hard"
(if (null $files)
(bury-buffer)
(mapc #'find-file
(mapcar #'expand-file-name
(eshell-flatten-list (reverse $files))))))
(defalias 'eshell/vi 'eshell/emacs)
(defalias 'eshell/vim 'eshell/emacs)
(defalias 'eshell/ed 'eshell/emacs)
(defalias 'eshell/nano 'eshell/emacs)
#+END_SRC
**** Environment variables
:PROPERTIES:
:CUSTOM_ID: User_Configuration-Eshell-Environment_variables-8dac73e0
:END:
Some environment variables need to be correctly set so Eshell can correctly work. The first environment variable to be set is the ~PATH~, as I have a couple of directories where executables are located. Lets add them to our path.
#+BEGIN_SRC emacs-lisp
(setenv "PATH"
(concat
(getenv "HOME") "/.pub-cache/bin"
":" (getenv "HOME") "/.local/bin"
":" (getenv "HOME") "/go/bin"
":" (getenv "HOME") "/.cargo/bin"
":" (getenv "HOME") "/.gem/ruby/2.6.0/bin"
":" (getenv "PATH")))
#+END_SRC
I would also like to set two environment variables related to Dart development: the ~DART_SDK~ and ~ANDROID_HOME~ variables.
#+BEGIN_SRC emacs-lisp
(setenv "DART_SDK" "/opt/dart-sdk/bin")
(setenv "ANDROID_HOME" (concat (getenv "HOME") "/Android/Sdk/"))
#+END_SRC
Finally, Id like to add a custom directory to the ~PKG_CONFIG_PATH~:
#+BEGIN_SRC emacs-lisp
(setenv "PKG_CONFIG_PATH" (concat
"/usr/local/lib/pkgconfig/" ":"
(getenv "PKG_CONFIG_PATH")))
#+END_SRC
The ~EDITOR~ variable also needs to be set for git commands, especially the ~yadm~ commands.
#+BEGIN_SRC emacs-lisp
(setenv "EDITOR" "emacsclient -c")
#+END_SRC #+END_SRC
**** Eshell theme **** Eshell theme
@ -1652,6 +1641,23 @@ I also don't want the banner to be displayed, I know I entered the Elisp shell,
(setq eshell-banner-message "") (setq eshell-banner-message "")
#+END_SRC #+END_SRC
The package [[https://github.com/akreisher/eshell-syntax-highlighting][eshell-syntax-highlighting]] enables a colorful syntax highlighter similar to fishs built-in syntax highligter. To activate it, we simply have to put the following code in our configuration:
#+BEGIN_SRC emacs-lisp
(eshell-syntax-highlighting-global-mode +1)
#+END_SRC
**** Visual commands
:PROPERTIES:
:CUSTOM_ID: User_Configuration-Eshell-Visual_commands-2b15e0dc
:END:
With Eshell, some commands dont work very well, especially commands that create a TUI. So, lets declare them as visual commands or subcommands:
#+BEGIN_SRC emacs-lisp
(setq eshell-visual-commands
'("fish" "zsh" "bash" "tmux" "htop" "top" "vim" "bat" "nano")
eshell-visual-subcommands
'("git" "log" "l" "diff" "show"))
#+END_SRC
*** Org-mode *** Org-mode
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: User_Configuration-Org-mode-04ab8ad3 :CUSTOM_ID: User_Configuration-Org-mode-04ab8ad3