Compare commits
8 Commits
6e601839aa
...
e87c0a9217
Author | SHA1 | Date | |
---|---|---|---|
e87c0a9217 | |||
8748b30895 | |||
295ed85fd5 | |||
4a31230d16 | |||
20ac94c9fb | |||
57a5be3183 | |||
1ad9328960 | |||
78029eefc8 |
@ -59,13 +59,6 @@ focus the new window immediately.
|
||||
(interactive)
|
||||
(split-window-below)
|
||||
(windmove-down))
|
||||
|
||||
(defun kill-buffer-and-delete-window ()
|
||||
"Kill the current buffer and delete its window."
|
||||
(interactive)
|
||||
(progn
|
||||
(kill-this-buffer)
|
||||
(delete-window)))
|
||||
#+end_src
|
||||
|
||||
** Resize windows
|
||||
|
@ -120,8 +120,54 @@ I also have two main shell-related functions, prefixed with ~as~.
|
||||
|-----+-------------+-------------+-------------|
|
||||
| | | shells | |
|
||||
| e | eshell-new | | |
|
||||
| v | vterm | | vterm |
|
||||
| V | multi-vterm | | multi-vterm |
|
||||
| t | eat | | eat |
|
||||
|
||||
*** Treemacs
|
||||
#+name: keybindings-treemacs
|
||||
| Key | Function | Description | Package |
|
||||
|-----+----------------------------------------+-------------+----------|
|
||||
| | | treemacs | |
|
||||
| c | | create | |
|
||||
| cd | treemacs-create-dir | | treemacs |
|
||||
| cf | treemacs-create-file | | treemacs |
|
||||
| ci | treemacs-create-icon | | treemacs |
|
||||
| ct | treemacs-create-theme | | treemacs |
|
||||
| cw | treemacs-create-workspace | | treemacs |
|
||||
| d | treemacs-delete-file | | treemacs |
|
||||
| f | | files | |
|
||||
| ff | treemacs-find-file | | treemacs |
|
||||
| ft | treemacs-find-tag | | treemacs |
|
||||
| l | | lsp | |
|
||||
| ls | treemacs-expand-lsp-symbol | | treemacs |
|
||||
| ld | treemacs-expand-lsp-treemacs-deps | | treemacs |
|
||||
| lD | treemacs-collapse-lsp-treemacs-deps | | treemacs |
|
||||
| lS | treemacs-collapse-lsp-symbol | | treemacs |
|
||||
| p | | projects | |
|
||||
| pa | treemacs-add-project-to-workspace | | treemacs |
|
||||
| pf | treemacs-project-follow-mode | | treemacs |
|
||||
| pn | treemacs-project-of-node | | treemacs |
|
||||
| pp | treemacs-project-at-point | | treemacs |
|
||||
| pr | treemacs-remove-project-from-workspace | | treemacs |
|
||||
| pt | treemacs-move-project-down | | treemacs |
|
||||
| ps | treemacs-move-project-up | | treemacs |
|
||||
| r | | rename | |
|
||||
| rf | treemacs-rename-file | | treemacs |
|
||||
| rp | treemacs-rename-project | | treemacs |
|
||||
| rr | treemacs-rename | | treemacs |
|
||||
| rw | treemacs-rename-workspace | | treemacs |
|
||||
| t | treemacs | | treemacs |
|
||||
| T | | toggles | |
|
||||
| Td | treemacs-toggle-show-dotfiles | | treemacs |
|
||||
| Tn | treemacs-toggle-node | | treemacs |
|
||||
| v | | visit node | |
|
||||
| va | treemacs-visit-node-ace | | treemacs |
|
||||
| vc | treemacs-visit-node-close-treemacs | | treemacs |
|
||||
| vn | treemacs-visit-node-default | | treemacs |
|
||||
| y | | yank | |
|
||||
| ya | treemacs-copy-absolute-path-at-point | | treemacs |
|
||||
| yp | treemacs-copy-project-path-at-point | | treemacs |
|
||||
| yr | treemacs-copy-relative-path-at-point | | treemacs |
|
||||
| yf | treemacs-copy-file | | treemacs |
|
||||
|
||||
*** Treemacs
|
||||
#+name: keybindings-treemacs
|
||||
@ -181,7 +227,7 @@ My buffer-related keybindings are all prefixed by ~b~.
|
||||
| c | clone-indirect-buffer | | |
|
||||
| C | clone-indirect-buffer-other-window | | |
|
||||
| l | bufler | | bufler |
|
||||
| d | kill-this-buffer | | |
|
||||
| d | kill-current-buffer | | |
|
||||
| D | kill-buffer | | |
|
||||
| h | dashboard-refresh-buffer | | dashboard |
|
||||
| m | switch-to-messages-buffer | | |
|
||||
@ -516,7 +562,7 @@ much to say. The prefix here is ~w~.
|
||||
| 7 | winum-select-window-7 | none | winum |
|
||||
| 8 | winum-select-window-8 | none | winum |
|
||||
| 9 | winum-select-window-9 | none | winum |
|
||||
| b | kill-buffer-and-delete-window | | |
|
||||
| b | kill-buffer-and-window | | |
|
||||
| d | delete-window | | |
|
||||
| o | other-window | | |
|
||||
| D | delete-other-windows | | |
|
||||
|
@ -395,7 +395,7 @@ configuration for the ~mu4e~ package itself.
|
||||
#+begin_src emacs-lisp
|
||||
(use-package mu4e
|
||||
:after all-the-icons
|
||||
:straight (:build t)
|
||||
:straight (:build nil)
|
||||
:commands mu4e mu4e-compose-new
|
||||
:init
|
||||
(defun mu4e--main-action-str (name func)
|
||||
@ -556,7 +556,7 @@ and how to retrieve them.
|
||||
#+name: mu4e-mail-on-machine
|
||||
#+begin_src emacs-lisp :tangle no
|
||||
(setq mu4e-get-mail-command "mbsync -a"
|
||||
mu4e-root-maildir "~/Mail"
|
||||
mu4e-root-maildir (concat (getenv "HOME") "/Mail/lucien@phundrak.com/")
|
||||
mu4e-trash-folder "/Trash"
|
||||
mu4e-refile-folder "/Archive"
|
||||
mu4e-sent-folder "/Sent"
|
||||
@ -791,29 +791,6 @@ With this piece of code, I can simply jump to my inbox maildir with
|
||||
(:maildir "/Trash" :key ?t)))
|
||||
#+end_src
|
||||
|
||||
**** Dealing with spammers
|
||||
I’m sure you have received at least one email recently from a sketchy
|
||||
email address asking you something that might be completely unrelated
|
||||
to what you do, or at least somewhat related. Fortunately, [[https://twitter.com/Boris/status/1360208504544444417][we have a
|
||||
hero]]! Now, let me write a function that will insert their
|
||||
pre-written text at point to avoid me going back to their Twitter
|
||||
thread each time I want to shut spammers up.
|
||||
#+begin_src emacs-lisp
|
||||
(defun reply-to-bill ()
|
||||
(interactive)
|
||||
(insert "Please forward this email to bill@noprocurement.com,
|
||||
and delete my email, as I’ll be changing jobs soon, and this
|
||||
email address will no longer be active.
|
||||
|
||||
Bill Whiskoney is a senior partner at Nordic Procurement
|
||||
Services, and he handles our budget and will help you further or
|
||||
introduce you to someone who can."))
|
||||
#+end_src
|
||||
|
||||
If you want the full story, make sure to read the whole thread, I
|
||||
guarantee it, it’s worth your time! And in case the Twitter thread
|
||||
disappear in the future, [[https://threader.app/thread/1360208504544444417][here is a backup]].
|
||||
|
||||
**** Getting Fancy
|
||||
I’m not a huge fan of mu4e’s default icons marking my emails, so I’ll
|
||||
redefine them as follows. Be aware the name of these icons are from
|
||||
@ -1561,7 +1538,8 @@ excluded files.
|
||||
eol)
|
||||
,(rx "/"
|
||||
(or "rsync" "ssh" "tmp" "yadm" "sudoedit" "sudo")
|
||||
(* any)))))
|
||||
(* any))
|
||||
"/nix/.*")))
|
||||
#+end_src
|
||||
|
||||
** Screenshot
|
||||
@ -1579,6 +1557,22 @@ look nice.
|
||||
#+end_src
|
||||
|
||||
** Shells
|
||||
*** Eat
|
||||
Eat is a modern shell emulator for Emacs. I use it as a replacement
|
||||
for VTerm as I never got VTerm to actually work on NixOS.
|
||||
#+begin_src emacs-lisp
|
||||
(use-package eat
|
||||
:defer t
|
||||
:straight (eat :type git
|
||||
:host codeberg
|
||||
:repo "akib/emacs-eat"
|
||||
:files ("*.el" ("term" "term/*.el") "*.texi"
|
||||
"*.ti" ("terminfo/e" "terminfo/e/*")
|
||||
("terminfo/65" "terminfo/65/*")
|
||||
("integration" "integration/*")
|
||||
(:exclude ".dir-locals.el" "*-tests.el"))))
|
||||
#+end_src
|
||||
|
||||
*** Shell-pop
|
||||
Shell-pop allows the user to easily call for a new shell in a pop-up
|
||||
buffer.
|
||||
@ -1588,7 +1582,7 @@ buffer.
|
||||
:straight (:build t)
|
||||
:custom
|
||||
(shell-pop-default-directory "/home/phundrak")
|
||||
(shell-pop-shell-type (quote ("eshell" "*eshell*" (lambda () (eshell shell-pop-term-shell)))))
|
||||
(shell-pop-shell-type (quote ("eat" "*eat-pop*" (lambda () (eat)))))
|
||||
(shell-pop-window-size 30)
|
||||
(shell-pop-full-span nil)
|
||||
(shell-pop-window-position "bottom")
|
||||
@ -1597,47 +1591,6 @@ buffer.
|
||||
(shell-pop-cleanup-buffer-at-process-exit t))
|
||||
#+end_src
|
||||
|
||||
*** VTerm
|
||||
VTerm gives Emacs access to regular shells with an almost regular
|
||||
emulator. Be aware you will most likely need to hit ~C-c~ twice to send
|
||||
an interrupt signal.
|
||||
#+begin_src emacs-lisp
|
||||
(use-package vterm
|
||||
:defer t
|
||||
:straight (:build t)
|
||||
:config
|
||||
(setq vterm-shell "/usr/bin/fish"
|
||||
vterm-always-compile-module t))
|
||||
#+end_src
|
||||
|
||||
One annoying think with vterm is it only can create one buffer, you
|
||||
can’t have multiple vterm buffers by default. ~multi-vterm~ fixes this
|
||||
issue.
|
||||
#+begin_src emacs-lisp
|
||||
(use-package multi-vterm
|
||||
:after vterm
|
||||
:defer t
|
||||
:straight (:build t)
|
||||
:general
|
||||
(phundrak/major-leader-key
|
||||
:packages '(vterm multi-vterm)
|
||||
:keymap 'vterm-mode-map
|
||||
"c" #'multi-vterm
|
||||
"n" #'multi-vterm-next
|
||||
"p" #'multi-vterm-prev))
|
||||
#+end_src
|
||||
|
||||
Another really neat package is =eshell-vterm= which allows to use vterm
|
||||
to run visual commands when in Eshell.
|
||||
#+begin_src emacs-lisp
|
||||
(use-package eshell-vterm
|
||||
:after eshell
|
||||
:straight (:build t)
|
||||
:config
|
||||
(eshell-vterm-mode)
|
||||
(defalias 'eshell/v 'eshell-exec-visual))
|
||||
#+end_src
|
||||
|
||||
** XWidgets Webkit Browser
|
||||
I used to use the xwidgets webkit browser in order to view or preview
|
||||
HTML files from Emacs, but it seems the Cairo background transparency
|
||||
|
@ -460,6 +460,7 @@ supported natively. I will describe them here.
|
||||
(use-package tramp
|
||||
:straight (tramp :type built-in :build t)
|
||||
:config
|
||||
<<tramp-nixos>>
|
||||
<<tramp-add-yadm>>
|
||||
(setopt tramp-ssh-controlmaster-options nil
|
||||
tramp-verbose 0
|
||||
@ -469,6 +470,19 @@ supported natively. I will describe them here.
|
||||
(cons tramp-file-name-regexp nil)))
|
||||
#+end_src
|
||||
|
||||
*** SSHing into NixOS remotes
|
||||
When using TRAMP to SSH into remote NixOS hosts, the true =$PATH= gets
|
||||
truncated, rendering some binaries unavailable, such as =git= or =nil= (an
|
||||
LSP server for the Nix language). To fix that, we simply need to write
|
||||
the following code.
|
||||
#+name: tramp-nixos
|
||||
#+begin_src emacs-lisp :tangle no
|
||||
(require 'tramp-sh)
|
||||
(setq tramp-remote-path (append tramp-remote-path
|
||||
'(tramp-own-remote-path)))
|
||||
|
||||
#+end_src
|
||||
|
||||
*** Yadm
|
||||
[[https://yadm.io/][~yadm~]] is a git wrapper made to easily manage your dotfiles. It has
|
||||
loads of features I don’t use (the main one I like but don’t use is
|
||||
|
@ -190,6 +190,7 @@ awesome!
|
||||
:init
|
||||
(setq lsp-keymap-prefix "C-c l"
|
||||
read-process-output-max (* 3 1024 1024))
|
||||
(setenv "LSP_USE_PLISTS" "true")
|
||||
:hook ((c-mode . lsp-deferred)
|
||||
(c++-mode . lsp-deferred)
|
||||
(html-mode . lsp-deferred)
|
||||
@ -892,26 +893,6 @@ configuration for StumpWM]].
|
||||
:straight (:build t))
|
||||
#+end_src
|
||||
|
||||
*** Dart
|
||||
#+begin_src emacs-lisp
|
||||
(use-package dart-mode
|
||||
:straight (:build t)
|
||||
:defer t
|
||||
:hook (dart-mode . lsp-deferred)
|
||||
:mode "\\.dart\\'")
|
||||
#+end_src
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(use-package lsp-dart
|
||||
:straight (:build t)
|
||||
:defer t
|
||||
:general
|
||||
(phundrak/major-leader-key
|
||||
:keymaps 'dart-mode-map
|
||||
:packages '(lsp-mode lsp-dart)
|
||||
"l" '(:keymap lsp-command-map :which-key "lsp")))
|
||||
#+end_src
|
||||
|
||||
*** EmacsLisp
|
||||
This package displays the function’s arglist or variable’s docstring
|
||||
in the echo area at the bottom of the frame. Quite useful indeed.
|
||||
@ -1283,7 +1264,7 @@ development.
|
||||
First, I’m using =rust-mode= to tell it to use [[https://tree-sitter.github.io/tree-sitter/][tree sitter]].
|
||||
#+begin_src emacs-lisp
|
||||
(use-package rust-mode
|
||||
:straight
|
||||
:straight t
|
||||
:defer t
|
||||
:init
|
||||
(setq rust-mode-treesitter-derive t))
|
||||
@ -1303,7 +1284,6 @@ several improvements on top of =rust-mode=.
|
||||
(defalias 'org-babel-execute:rust #'org-babel-execute:rustic)
|
||||
(add-to-list 'org-src-lang-modes '("rust" . rustic)))
|
||||
(setq rustic-lsp-client 'lsp-mode)
|
||||
(add-hook 'rustic-mode-hook #'tree-sitter-hl-mode)
|
||||
:general
|
||||
(general-define-key
|
||||
:keymaps 'rustic-mode-map
|
||||
|
Loading…
x
Reference in New Issue
Block a user