emacs.d

bloated emacs configuration
git clone git://git.ckyln.com/~cem/emacs.d.git
Log | Files | Refs | README

commit 726bb2b011b94c09ac985551a926d16bf18a76fc
parent 6054c2ce9b15b8e6d28f849423d287fc6427168c
Author: Cem Keylan <cem@ckyln.com>
Date:   Tue, 14 Jul 2020 21:11:47 +0300

init: binding, formatting, and package changes

- Changed some bindings
- Updated company
- Untangled some packages for now
- Added: which-key
- Enabled: electric-pair-mode
- Enabled: showing trailing-whitespace
- Enabled: removing trailing whitespace before save
- Multiple formatting changes

Diffstat:
Minit.org | 175++++++++++++++++++++++++++++++++++++++++++++++++++++++++-----------------------
1 file changed, 125 insertions(+), 50 deletions(-)

diff --git a/init.org b/init.org @@ -38,6 +38,14 @@ this file itself. - [[#academics][Academics]] - [[#extras][Extras]] - [[#filetype-configurations][Filetype Configurations]] + - [[#default-formatting][Default Formatting]] + - [[#markdown][Markdown]] + - [[#shell][Shell]] + - [[#python][Python]] + - [[#cc][C/C++]] + - [[#go][Go]] + - [[#makefile][Makefile]] + - [[#latex][LaTeX]] - [[#themes-and-buffer-customization][Themes and Buffer Customization]] - [[#doom-themes][Doom themes]] - [[#all-the-icons][All the icons]] @@ -47,6 +55,7 @@ this file itself. - [[#tangle-init][Tangle Init]] - [[#other-settings][Other Settings]] - [[#xclip][xclip]] + - [[#shell-commands][shell commands]] - [[#dired----ls-dired][Dired -- ls dired]] - [[#coding-system-for-terminal][Coding System for Terminal]] - [[#backup-options][Backup Options]] @@ -160,7 +169,7 @@ them to 0. #+END_SRC ** Package management - + I have switched to straight.el for package management. It is overall faster than package.el, and I don't want to use every package that I have tried out. The following is the one time bootstrapping script that straight.el uses to install @@ -239,7 +248,7 @@ be loaded as one of the first packages. #+BEGIN_SRC emacs-lisp (use-package cheatsheet :straight t - :bind ("C-c s" . cheatsheet-show) + :bind ("C-c s c" . cheatsheet-show) :config (cheatsheet-add-group 'Common '(:key "C-x C-c" :description "leave Emacs") @@ -251,7 +260,7 @@ be loaded as one of the first packages. #+END_SRC * Packages - + Now we can continue by loading our packages, those are listed according to how important they are to me. @@ -368,7 +377,7 @@ section. #+END_SRC *** evil-org - + I am quite serious on this vim stuff now. I want it everywhere. #+BEGIN_SRC emacs-lisp @@ -454,17 +463,20 @@ much yet. Pretty simple config. #+BEGIN_SRC emacs-lisp (use-package company :straight t - :custom (company-idle-delay 1) - (company-minimum-prefix-length 1) - :config (global-company-mode 1)) + :custom + (company-idle-delay 1) + (company-minimum-prefix-length 1) + :config + (push 'company-capf company-backends) + (global-company-mode 1)) #+END_SRC -*** Company LSP +*** Company LSP (disabled) I am using Company's own Language Server Protocol. It is good as far as I can wrap my head-around. -#+BEGIN_SRC emacs-lisp +#+BEGIN_SRC emacs-lisp :tangle no (use-package company-lsp :straight t :after company @@ -514,13 +526,15 @@ information when I startup Emacs. I am using elfeed as my RSS viewer, and I configure it through my org agenda file with elfeed-org. -#+BEGIN_SRC emacs-lisp +#+BEGIN_SRC emacs-lisp :tangle no (use-package elfeed :straight t + :after org :bind ("C-x w" . elfeed)) (use-package elfeed-org :straight t + :after (elfeed org) :custom (rmh-elfeed-org-files (list (concat user-emacs-directory "feed.org"))) :config (elfeed-org)) @@ -541,7 +555,6 @@ somewhat wonky. #+BEGIN_SRC emacs-lisp (use-package mu4e - :straight t :config (load-file "~/.config/mu4e/mu4e-config.el")) #+END_SRC @@ -552,24 +565,26 @@ quite frequently. I use it for finding files, manual pages, switching buffers, and many more. #+BEGIN_SRC emacs-lisp - (use-package helm - :straight t - :commands (helm-find-files helm-buffers-list) - :config - (bind-key "C-x C-f" 'helm-find-files) - (bind-key "C-c m" 'helm-man-woman) - (bind-key "C-x i" 'helm-imenu) - (bind-key "C-x b" 'helm-buffers-list) - (cheatsheet-add-group 'Helm - '(:key "C-x m" :description "Open manual page") - '(:key "C-x i" :description "helm-imenu") - '(:key "C-x b" :description "helm-buffers-list"))) - (use-package helm-descbinds - :straight t - :config - (bind-key "C-x C-d" 'helm-descbinds) - (cheatsheet-add :group "Helm" :key "C-x C-d" :description "helm-descbinds")) - (use-package helm-swoop :straight t) + (use-package helm + :straight t + :commands (helm-find-files helm-buffers-list) + :config + (bind-key "C-x C-f" 'helm-find-files) + (bind-key "C-c s m" 'helm-man-woman) + (bind-key "C-c s a" 'helm-apropos) + (bind-key "C-x i" 'helm-imenu) + (bind-key "C-x b" 'helm-buffers-list) + (cheatsheet-add-group 'Helm + '(:key "C-c s m" :description "Open manual page") + '(:key "c-c s a" :description "Emacs apropos") + '(:key "C-x i" :description "helm-imenu") + '(:key "C-x b" :description "helm-buffers-list"))) + (use-package helm-descbinds + :straight t + :config + (bind-key "C-x C-d" 'helm-descbinds) + (cheatsheet-add :group "Helm" :key "C-x C-d" :description "helm-descbinds")) + (use-package helm-swoop :straight t) #+END_SRC ** Academics @@ -581,11 +596,13 @@ the stuff for notetaking, bibliography management, etc. I am using org-noter and org-roam (which is a zettelkasten) for note-taking, and I find them extremely useful. -#+BEGIN_SRC emacs-lisp +#+BEGIN_SRC emacs-lisp :tangle no (use-package org-noter + :after org :straight t) (use-package org-roam + :after org :straight t) #+END_SRC @@ -631,7 +648,7 @@ that is as follows. These don't really deserve their own sections, but I prefer to use them. *** sudo-edit - + This is a package for re-initiating a file as root. #+BEGIN_SRC emacs-lisp @@ -685,12 +702,26 @@ Github README. :hook (org-mode . toc-org-mode)) #+END_SRC +*** which-key + +which-key-mode shows key completions when the user is stuck in a prefix key. + +#+BEGIN_SRC emacs-lisp + (use-package which-key + :straight t + :custom + (which-key-popup-type 'side-window) + :config + (which-key-mode)) +#+END_SRC + * Filetype Configurations -I would like to have some different configurations for filetypes. Those -are for indents and spaces, mostly. +I would like to have some different configurations for filetypes. Those are for +indents and spaces, mostly. I also like to keep packages specific to stay in +their respective categories. -*** Default Formatting +** Default Formatting Here is the default formatting for most files. I don't like tabs as indents so I avoid them wherever I can. @@ -715,7 +746,17 @@ function available to me. (electric-pair-mode t) #+END_SRC -*** Markdown + +For some reason, Emacs doesn't deal with trailing whitespace unless you tell it +to do so. Let's set it so that Emacs will show trailing whitespace on the buffer +and automatically deletes them before save. + +#+BEGIN_SRC emacs-lisp + (setq-default show-trailing-whitespace t) + (add-hook 'before-save-hook 'delete-trailing-whitespace) +#+END_SRC + +** Markdown For markdown, I want to have 4 spaces as an indentation. @@ -727,7 +768,7 @@ For markdown, I want to have 4 spaces as an indentation. (md-tab-width 4)) #+END_SRC -*** Shell +** Shell For shell, I want to have 4 spaces as an indentation. @@ -738,11 +779,11 @@ For shell, I want to have 4 spaces as an indentation. ) #+END_SRC -*** Python +** Python I use the django framework quite frequently at work. So I want a few packages for that as well. -**** Company jedi +*** Company jedi Company jedi is for better completion while I am editing python files. Here is the use-package @@ -753,11 +794,12 @@ is the use-package :init (add-to-list 'company-backends 'company-jedi)) #+END_SRC -*** C/C++ -**** Irony-mode -I use irony-mode for syntax-checking and completion for C. It can -also be used in conjunction with C++, but I personally don't need -it. You can add a hook for C++ as well in your [[file:lisp/init-local.el][personal configuration]]. + +** C/C++ +*** Irony-mode +I use irony-mode for syntax-checking and completion for C. It can also be used +in conjunction with C++, but I personally don't need it. You can add a hook for +C++ as well in your [[file:lisp/init-local.el][personal configuration]]. #+BEGIN_SRC emacs-lisp :tangle no (add-hook 'c++-mode-hook 'irony-mode) @@ -782,10 +824,12 @@ This installs =irony=, =company-irony=, and =flycheck-irony=. :config (add-to-list 'company-backends 'company-irony)) #+END_SRC -*** Go -For Go, we are installing -- gomode :: A rewrite of Go mode for Emacs -- company-go :: Company-mode go backend + +** Go + +For Go, we are installing =go-mode= and =company-go=. =go-mode= is a rewrite of +the built-in major mode for go. =company-go= is the company backend for go. + #+BEGIN_SRC emacs-lisp (use-package go-mode :straight t) (use-package company-go @@ -793,10 +837,22 @@ For Go, we are installing :after company ) #+END_SRC -*** Makefile + +** Makefile #+BEGIN_SRC emacs-lisp (use-package helm-make :straight t) #+END_SRC + +** LaTeX + +I personally use LaTeX for academic papers, but I don't have some advanced +configuration on it. + +#+BEGIN_SRC emacs-lisp :tangle no + (use-package auctex + :straight t) +#+END_SRC + * Themes and Buffer Customization I used to make use of my Xresources themes, but I sometimes sadly need windows, and I actually do want some eye candy from time to @@ -831,6 +887,11 @@ guess. Pretty straightforward. #+BEGIN_SRC emacs-lisp (use-package all-the-icons :straight t) + + (use-package all-the-icons-dired + :straight t + :after all-the-icons + :hook (dired-mode . all-the-icons-dired-mode)) #+END_SRC ** Buffer customizations @@ -943,8 +1004,19 @@ inconsistency of switching between terminal and the graphical Emacs. :straight t :config (xclip-mode)) #+END_SRC + +** shell commands + +Typing =M-!= isn't really possible when I am on dwm, so I bind =C-q= for +executing shell commands. I usually prefix shell commands with =C-u= so that I +can easily insert text into buffer. + +#+BEGIN_SRC emacs-lisp + (bind-key "C-q" 'shell-command) +#+END_SRC + ** Dired -- ls dired - + I use suckless.org's =sbase= as my coreutils. The =ls= program that I use does not have a =--dired= option. Let's disable it. @@ -959,6 +1031,7 @@ not have a =--dired= option. Let's disable it. #+BEGIN_SRC emacs-lisp (set-terminal-coding-system 'utf-8) #+END_SRC + ** Backup Options #+BEGIN_SRC emacs-lisp @@ -966,7 +1039,7 @@ not have a =--dired= option. Let's disable it. #+END_SRC ** Set Browser - + I am setting the default browser from the BROWSER environment variable so that I don't have to keep track of it in case I ever change my browser. @@ -976,6 +1049,7 @@ so that I don't have to keep track of it in case I ever change my browser. browse-url-browser-function 'browse-url-generic ) #+END_SRC + ** Local init file Now that all of this is done, we can load user's personal configuration @@ -988,6 +1062,7 @@ Now that all of this is done, we can load user's personal configuration (provide 'init) ;;; init.el ends here #+END_SRC + * Notes ** Reverting to package.el You can always revert back to =package.el= by replacing the [[Package management]]