mirror of
https://gitlab.com/dwt1/dotfiles.git
synced 2026-04-25 04:20:24 +10:00
Major work on Emacs and XMonad configs.
This commit is contained in:
@@ -19,11 +19,16 @@
|
||||
- [[#dashboard][DASHBOARD]]
|
||||
- [[#configuring-dashboard][Configuring Dashboard]]
|
||||
- [[#dashboard-in-emacsclient][Dashboard in Emacsclient]]
|
||||
- [[#elfeed][ELFEED]]
|
||||
- [[#evaluate-elisp-expressions][EVALUATE ELISP EXPRESSIONS]]
|
||||
- [[#file-manager-dired][FILE MANAGER (DIRED)]]
|
||||
- [[#keybindings-to-open-dired][Keybindings To Open Dired]]
|
||||
- [[#keybindings-within-dired][Keybindings Within Dired]]
|
||||
- [[#keybindings-for-peep-dired-mode][Keybindings For Peep-Dired-Mode]]
|
||||
- [[#finding-files][FINDING FILES]]
|
||||
- [[#files][FILES]]
|
||||
- [[#file-related-keybindings][File-related Keybindings]]
|
||||
- [[#installing-some-useful-file-related-modules][Installing Some Useful File-related Modules]]
|
||||
- [[#useful-file-functions][Useful File Functions]]
|
||||
- [[#fonts][FONTS]]
|
||||
- [[#setting-the-font-face][Setting The Font Face]]
|
||||
- [[#zooming-in-and-out][Zooming In and Out]]
|
||||
@@ -47,6 +52,7 @@
|
||||
- [[#source-code-block-syntax-highlighting][Source Code Block Syntax Highlighting]]
|
||||
- [[#automatically-create-table-of-contents][Automatically Create Table of Contents]]
|
||||
- [[#projectile][PROJECTILE]]
|
||||
- [[#registers][REGISTERS]]
|
||||
- [[#scrolling][SCROLLING]]
|
||||
- [[#shells][SHELLS]]
|
||||
- [[#eshell][Eshell]]
|
||||
@@ -140,6 +146,7 @@ This is an icon set that can be used with dashboard, dired, ibuffer and other Em
|
||||
Emacs Dashboard is an extensible startup screen showing you recent files, bookmarks, agenda items and an Emacs banner.
|
||||
|
||||
** Configuring Dashboard
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(use-package dashboard
|
||||
:init ;; tweak dashboard config before loading it
|
||||
@@ -162,10 +169,66 @@ Emacs Dashboard is an extensible startup screen showing you recent files, bookma
|
||||
|
||||
** Dashboard in Emacsclient
|
||||
This setting ensures that emacsclient always opens on *dashboard* rather than *scratch*.
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(setq initial-buffer-choice (lambda () (get-buffer "*dashboard*")))
|
||||
#+end_src
|
||||
|
||||
* ELFEED
|
||||
An RSS newsfeed reader for Emacs.
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(use-package elfeed-goodies)
|
||||
(elfeed-goodies/setup)
|
||||
(setq elfeed-goodies/entry-pane-size 0.5)
|
||||
(add-hook 'elfeed-show-mode-hook 'visual-line-mode)
|
||||
(evil-define-key 'normal elfeed-show-mode-map
|
||||
(kbd "J") 'elfeed-goodies/split-show-next
|
||||
(kbd "K") 'elfeed-goodies/split-show-prev)
|
||||
(evil-define-key 'normal elfeed-search-mode-map
|
||||
(kbd "J") 'elfeed-goodies/split-show-next
|
||||
(kbd "K") 'elfeed-goodies/split-show-prev)
|
||||
(setq elfeed-feeds (quote
|
||||
(("https://www.reddit.com/r/linux.rss" reddit linux)
|
||||
("https://www.reddit.com/r/commandline.rss" reddit commandline)
|
||||
("https://www.reddit.com/r/distrotube.rss" reddit distrotube)
|
||||
("https://www.reddit.com/r/emacs.rss" reddit emacs)
|
||||
("https://www.gamingonlinux.com/article_rss.php" gaming linux)
|
||||
("https://hackaday.com/blog/feed/" hackaday linux)
|
||||
("https://opensource.com/feed" opensource linux)
|
||||
("https://linux.softpedia.com/backend.xml" softpedia linux)
|
||||
("https://itsfoss.com/feed/" itsfoss linux)
|
||||
("https://www.zdnet.com/topic/linux/rss.xml" zdnet linux)
|
||||
("https://www.phoronix.com/rss.php" phoronix linux)
|
||||
("http://feeds.feedburner.com/d0od" omgubuntu linux)
|
||||
("https://www.computerworld.com/index.rss" computerworld linux)
|
||||
("https://www.networkworld.com/category/linux/index.rss" networkworld linux)
|
||||
("https://www.techrepublic.com/rssfeeds/topic/open-source/" techrepublic linux)
|
||||
("https://betanews.com/feed" betanews linux)
|
||||
("http://lxer.com/module/newswire/headlines.rss" lxer linux)
|
||||
("https://distrowatch.com/news/dwd.xml" distrowatch linux))))
|
||||
#+end_src
|
||||
|
||||
* EVALUATE ELISP EXPRESSIONS
|
||||
I choose to use the format 'SPC e' plus 'key' for these (I also use 'SPC e' for 'eww' keybindings).
|
||||
|
||||
| COMMAND | DESCRIPTION | KEYBINDING |
|
||||
|-----------------+------------------------------------------------+------------|
|
||||
| eval-buffer | /Evaluate elisp in buffer/ | SPC e b |
|
||||
| eval-defun | /Evaluate the defun containing or after point/ | SPC e d |
|
||||
| eval-expression | /Evaluate an elisp expression/ | SPC e e |
|
||||
| eval-last-sexp | /Evaluate elisp expression before point/ | SPC e l |
|
||||
| eval-region | /Evaluate elisp in region/ | SPC e r |
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(nvmap :states '(normal visual) :keymaps 'override :prefix "SPC"
|
||||
"e b" '(eval-buffer :which-key "Eval elisp in buffer")
|
||||
"e d" '(eval-defun :which-key "Eval defun")
|
||||
"e e" '(eval-expression :which-key "Eval elisp expression")
|
||||
"e l" '(eval-last-sexp :which-key "Eval last sexression")
|
||||
"e r" '(eval-region :which-key "Eval region"))
|
||||
#+end_src
|
||||
|
||||
* FILE MANAGER (DIRED)
|
||||
Dired is the file manager within Emacs. Below, I setup keybindings for image previews (peep-dired). I've chosen the format of 'SPC d' plus 'key'.
|
||||
|
||||
@@ -218,13 +281,54 @@ Dired is the file manager within Emacs. Below, I setup keybindings for image pr
|
||||
("mp4" . "mpv")))
|
||||
#+end_src
|
||||
|
||||
* FINDING FILES
|
||||
* FILES
|
||||
** File-related Keybindings
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(nvmap :states '(normal visual) :keymaps 'override :prefix "SPC"
|
||||
"." '(find-file :which-key "Find file")
|
||||
"f f" '(find-file :which-key "Find file")
|
||||
"f r" '(counsel-recentf :which-key "Recent files")
|
||||
"f s" '(save-buffer :which-key "Save file")
|
||||
"f u" '(sudo-edit-find-file :which-key "Sudo find file")
|
||||
"f y" '(dt/show-and-copy-buffer-path :which-key "Yank file path")
|
||||
"f C" '(copy-file :which-key "Copy file")
|
||||
"f D" '(delete-file :which-key "Delete file")
|
||||
"f R" '(rename-file :which-key "Rename file")
|
||||
"f S" '(write-file :which-key "Save file as...")
|
||||
"f U" '(sudo-edit :which-key "Sudo edit file"))
|
||||
#+end_src
|
||||
|
||||
** Installing Some Useful File-related Modules
|
||||
Though 'recentf' is one way to find recent files although I prefer using 'counsel-recentf'.
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(use-package recentf
|
||||
:config
|
||||
(recentf-mode))
|
||||
(use-package sudo-edit) ;; Utilities for opening files with sudo
|
||||
|
||||
#+end_src
|
||||
|
||||
** Useful File Functions
|
||||
#+begin_src emacs-lisp
|
||||
(defun dt/show-and-copy-buffer-path ()
|
||||
"Show and copy the full path to the current file in the minibuffer."
|
||||
(interactive)
|
||||
;; list-buffers-directory is the variable set in dired buffers
|
||||
(let ((file-name (or (buffer-file-name) list-buffers-directory)))
|
||||
(if file-name
|
||||
(message (kill-new file-name))
|
||||
(error "Buffer not visiting a file"))))
|
||||
(defun dt/show-buffer-path-name ()
|
||||
"Show the full path to the current file in the minibuffer."
|
||||
(interactive)
|
||||
(let ((file-name (buffer-file-name)))
|
||||
(if file-name
|
||||
(progn
|
||||
(message file-name)
|
||||
(kill-new file-name))
|
||||
(error "Buffer not visiting a file"))))
|
||||
#+end_src
|
||||
|
||||
* FONTS
|
||||
@@ -278,9 +382,10 @@ General.el allows us to set keybindings. As a longtime Doom Emacs user, I have
|
||||
#+begin_src emacs-lisp
|
||||
(nvmap :states '(normal visual) :keymaps 'override :prefix "SPC"
|
||||
"SPC" '(counsel-M-x :which-key "M-x")
|
||||
"." '(find-file :which-key "Find file")
|
||||
"f r" '(counsel-recentf :which-key "Recent files")
|
||||
"c c" '(compile :which-key "Compile")
|
||||
"c C" '(recompile :which-key "Recompile")
|
||||
"h r r" '((lambda () (interactive) (load-file "~/.emacs.d/init.el")) :which-key "Reload emacs config")
|
||||
"m e" '(org-export-dispatch :which-key "Org export dispatch")
|
||||
"t t" '(toggle-truncate-lines :which-key "Toggle truncate lines"))
|
||||
#+end_src
|
||||
|
||||
@@ -406,12 +511,10 @@ A git client for Emacs. Often cited as a killer feature for Emacs.
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(use-package magit)
|
||||
(use-package magit-todos
|
||||
:config (magit-todos-mode))
|
||||
#+end_src
|
||||
|
||||
* ORG MODE
|
||||
Org Mode is THE killer feature within Emacs. But it does need some tweaking.
|
||||
Org Mode is =THE= killer feature within Emacs. But it does need some tweaking.
|
||||
|
||||
** Defining A Few Things
|
||||
#+begin_src emacs-lisp
|
||||
@@ -431,7 +534,7 @@ Org Mode is THE killer feature within Emacs. But it does need some tweaking.
|
||||
#+end_src
|
||||
|
||||
** Enabling Org Bullets
|
||||
Org-bullets gives us attractive bullets rather asterisks.
|
||||
Org-bullets gives us attractive bullets rather than asterisks.
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(use-package org-bullets)
|
||||
@@ -508,6 +611,11 @@ Toc-org helps you to have an up-to-date table of contents in org files without e
|
||||
:init (add-hook 'org-mode-hook 'toc-org-enable))
|
||||
#+end_src
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(use-package ox-man
|
||||
:ensure nil)
|
||||
#+end_src
|
||||
|
||||
* PROJECTILE
|
||||
#+begin_src emacs-lisp
|
||||
(use-package projectile
|
||||
@@ -515,6 +623,38 @@ Toc-org helps you to have an up-to-date table of contents in org files without e
|
||||
(projectile-global-mode 1))
|
||||
#+end_src
|
||||
|
||||
* REGISTERS
|
||||
Emacs registers are compartments where you can save text, rectangles and positions for later use. Once you save text or a rectangle in a register, you can copy it into the buffer once or many times; once you save a position in a register, you can jump back to that position once or many times. The default GNU Emacs keybindings for these commands (with the exception of counsel-register) involves 'C-x r' followed by one or more other keys. I wanted to make this a little more user friendly, so I chose to replace the 'C-x r' part of the key chords with 'SPC r'.
|
||||
|
||||
| COMMAND | DESCRIPTION | KEYBINDING |
|
||||
|----------------------------------+----------------------------------+------------|
|
||||
| copy-to-register | /Copy to register/ | SPC r c |
|
||||
| frameset-to-register | /Frameset to register/ | SPC r f |
|
||||
| insert-register | /Insert contents of register/ | SPC r i |
|
||||
| jump-to-register | /Jump to register/ | SPC r j |
|
||||
| list-registers | /List registers/ | SPC r l |
|
||||
| number-to-register | /Number to register/ | SPC r n |
|
||||
| counsel-register | /Interactively choose a register/ | SPC r r |
|
||||
| view-register | /View a register/ | SPC r v |
|
||||
| window-configuration-to-register | /Window configuration to register/ | SPC r w |
|
||||
| increment-register | /Increment register/ | SPC r + |
|
||||
| point-to-register | /Point to register/ | SPC r SPC |
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(nvmap :prefix "SPC"
|
||||
"r c" '(copy-to-register :which-key "Copy to register")
|
||||
"r f" '(frameset-to-register :which-key "Frameset to register")
|
||||
"r i" '(insert-register :which-key "Insert register")
|
||||
"r j" '(jump-to-register :which-key "Jump to register")
|
||||
"r l" '(list-registers :which-key "List registers")
|
||||
"r n" '(number-to-register :which-key "Number to register")
|
||||
"r r" '(counsel-register :which-key "Choose a register")
|
||||
"r v" '(view-register :which-key "View a register")
|
||||
"r w" '(window-configuration-to-register :which-key "Window configuration to register")
|
||||
"r +" '(increment-register :which-key "Increment register")
|
||||
"r SPC" '(point-to-register :which-key "Point to register"))
|
||||
#+end_src
|
||||
|
||||
* SCROLLING
|
||||
Emacs' default scrolling is annoying because of the sudden half-page jumps. Also, I wanted to adjust the scrolling speed.
|
||||
|
||||
@@ -564,6 +704,7 @@ Vterm is a terminal emulator within Emacs. The 'shell-file-name' setting sets t
|
||||
* SPLITS AND WINDOW CONTROLS
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(winner-mode 1)
|
||||
(nvmap :prefix "SPC"
|
||||
;; Window splits
|
||||
"w c" '(evil-window-delete :which-key "Close window")
|
||||
@@ -575,7 +716,10 @@ Vterm is a terminal emulator within Emacs. The 'shell-file-name' setting sets t
|
||||
"w j" '(evil-window-down :which-key "Window down")
|
||||
"w k" '(evil-window-up :which-key "Window up")
|
||||
"w l" '(evil-window-right :which-key "Window right")
|
||||
"w w" '(evil-window-next :which-key "Goto next window"))
|
||||
"w w" '(evil-window-next :which-key "Goto next window")
|
||||
;; winner mode
|
||||
"w <left>" '(winner-undo :which-key "Winner undo")
|
||||
"w <right>" '(winner-redo :which-key "Winner redo"))
|
||||
#+end_src
|
||||
|
||||
* THEME
|
||||
|
||||
Reference in New Issue
Block a user