mirror of
http://github.com/JaeUs3792/dotfiles
synced 2025-12-14 16:11:34 +09:00
1503 lines
58 KiB
Org Mode
Executable File
1503 lines
58 KiB
Org Mode
Executable File
#+title: Emacs Configuration
|
||
#+AUTHOR: JaeYoo-Im, (cpu3792@gmail.com)
|
||
#+latex_header: \usepackage{kotex}
|
||
|
||
* Basic Configuration
|
||
Emacs Configuration for emacs 29.50
|
||
** Early Init
|
||
#+begin_src emacs-lisp :tangle ~/.config/emacs/early-init.el
|
||
;;; early-init.el -*- lexical-binding: t; -*-
|
||
;; garbage collection
|
||
(setq gc-cons-threshold (* 50 1024 1024)) ;; 50MB
|
||
;; prefers newest version of a file
|
||
(customize-set-variable 'load-prefer-newer t)
|
||
|
||
;;; Native compilation settings
|
||
(when (featurep 'native-compile)
|
||
;; Silence compiler warnings as they can be pretty disruptive
|
||
(setq native-comp-async-report-warnings-errors nil)
|
||
|
||
;; Make native compilation happens asynchronously
|
||
(setq native-comp-deferred-compilation t))
|
||
|
||
(setq inhibit-startup-message t)
|
||
(setq frame-resize-pixelwise t)
|
||
(scroll-bar-mode -1)
|
||
(tool-bar-mode -1)
|
||
(tooltip-mode -1)
|
||
(set-fringe-mode 10)
|
||
(menu-bar-mode -1)
|
||
;;(blink-cursor-mode 0)
|
||
|
||
;; initial load with blue theme
|
||
(load-theme 'deeper-blue)
|
||
|
||
(customize-set-variable 'initial-major-mode 'fundamental-mode)
|
||
|
||
#+end_src
|
||
** Init
|
||
*** Startup hook
|
||
#+begin_src emacs-lisp :tangle ~/.config/emacs/init.el
|
||
;;; init.el -*- lexical-binding: t; -*-
|
||
(add-hook 'emacs-startup-hook
|
||
(lambda ()
|
||
(message "Emacs loaded in %s"
|
||
(emacs-init-time))))
|
||
#+end_src
|
||
*** Package Function
|
||
#+begin_src emacs-lisp :tangle ~/.config/emacs/init.el
|
||
(require 'package)
|
||
(add-to-list 'package-archives '("stable" . "https://stable.melpa.org/packages/"))
|
||
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/"))
|
||
(customize-set-variable 'package-archive-priorities
|
||
'(("gnu" . 99) ; prefer GNU packages
|
||
("nongnu" . 80) ; use non-gnu packages if
|
||
; not found in GNU elpa
|
||
("stable" . 70) ; prefer "released" versions
|
||
; from melpa
|
||
("melpa" . 0))) ; if all else fails, get it
|
||
; from melpa
|
||
;; make sure the elpa/ folder exists after setting it above.
|
||
(unless (file-exists-p package-user-dir)
|
||
(mkdir package-user-dir t))
|
||
|
||
(defmacro usr-package-install (package)
|
||
`(unless (package-installed-p ,package) (package-install ,package)))
|
||
(package-initialize)
|
||
|
||
(if (version< emacs-version "29")
|
||
(usr-package-install 'use-package)) ;; <emacs29
|
||
;;; init.el ends here
|
||
#+end_src
|
||
*** Add other modules
|
||
#+begin_src emacs-lisp :tangle ~/.config/emacs/init.el
|
||
(add-to-list 'load-path (expand-file-name "modules/" user-emacs-directory))
|
||
#+end_src
|
||
*** Edit options
|
||
**** Whitespace clean
|
||
#+begin_src emacs-lisp :tangle ~/.config/emacs/init.el
|
||
(add-hook 'before-save-hook #'whitespace-cleanup)
|
||
#+end_src
|
||
**** Tabs
|
||
#+begin_src emacs-lisp :tangle ~/.config/emacs/init.el
|
||
(setq-default indent-tabs-mode nil)
|
||
(setq-default tab-width 4)
|
||
#+end_src
|
||
|
||
협업에 있어서 코드에 tabs 크기를 명시하는 것도 방법일듯.
|
||
***** Modeline Indentation example
|
||
- Emacs
|
||
#+begin_src rust
|
||
/* -*- Mode: rust; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
|
||
#+end_src
|
||
- Vim
|
||
#+begin_src shell
|
||
# Embeded VIM Configurations
|
||
# vim: filetype=sh noet sw=4 ts=4 fdm=marker
|
||
#+end_src
|
||
- Visual Studio Code
|
||
install extension =modeline=.
|
||
#+begin_src javascript
|
||
// vim: set ft=js ts=4 sw=4 et:
|
||
// vim :ts=4 :sw=4 :et :ft=js
|
||
// -*- mode: js; indent-tabs-mode: nil; tab-width: 4 -*-
|
||
// code: language=rust insertSpaces=false tabSize=4
|
||
#+end_src
|
||
|
||
*** Backup options
|
||
#+begin_src emacs-lisp :tangle ~/.config/emacs/init.el
|
||
(setq backup-directory-alist `(("." . ,(expand-file-name "backups/" user-emacs-directory))))
|
||
(setq-default custom-file (expand-file-name ".custom.el" user-emacs-directory))
|
||
(when (file-exists-p custom-file)
|
||
(load custom-file))
|
||
(setq delete-by-moving-to-trash t
|
||
trash-directory "~/.local/share/Trash/files/")
|
||
(setq undo-limit 100000000
|
||
auto-save-default t)
|
||
#+end_src
|
||
|
||
*** Other options
|
||
#+begin_src emacs-lisp :tangle ~/.config/emacs/init.el
|
||
(set-default-coding-systems 'utf-8)
|
||
(set-language-environment "utf-8")
|
||
(prefer-coding-system 'utf-8)
|
||
(customize-set-variable 'large-file-warning-threshold 100000000) ;; 100MB
|
||
|
||
(defconst ON-LINUX (eq system-type 'gnu/linux))
|
||
(defconst ON-MAC (eq system-type 'darwin))
|
||
(defconst ON-WINDOWS (memq system-type '(cygwin windows-nt ms-dos)))
|
||
|
||
(setq gc-cons-threshold (* 2 1024 1024)) ; decreasing the threshold to 2MB
|
||
|
||
(defvar my-config-file (expand-file-name "config.el" user-emacs-directory))
|
||
(load my-config-file nil 'nomessage)
|
||
|
||
(setq use-short-answer t)
|
||
|
||
(setq global-auto-revert-non-file-buffers t)
|
||
(global-auto-revert-mode t)
|
||
|
||
(set-frame-parameter (selected-frame) 'fullscreen 'maximized)
|
||
(add-to-list 'default-frame-alist '(fullscreen . maximized))
|
||
(unless (display-graphic-p)
|
||
(xterm-mouse-mode))
|
||
#+end_src
|
||
* Modules Selection module
|
||
#+begin_src emacs-lisp :tangle ~/.config/emacs/config.el
|
||
;;; config.el -*- lexical-binding: t; -*-
|
||
(setq user-full-name "JaeYoo-Im"
|
||
user-mail-address "cpu3792@gmail.com")
|
||
|
||
(setq default-input-method "korean-hangul")
|
||
|
||
(add-hook 'emacs-startup-hook
|
||
(lambda ()
|
||
(custom-set-faces
|
||
`(default ((t (:font "Fira Code 14"))))
|
||
`(fixed-pitch ((t (:inherit (default)))))
|
||
`(fixed-pitch-serif ((t (:inherit (default)))))
|
||
`(variable-pitch ((t (:font "Ubuntu 14")))))))
|
||
|
||
(require 'custom-ui)
|
||
(require 'custom-keybindings)
|
||
(require 'custom-default)
|
||
(require 'custom-completion)
|
||
(require 'custom-projects)
|
||
(require 'custom-latex)
|
||
(require 'custom-org)
|
||
;;(require 'custom-workspaces)
|
||
(require 'custom-languages)
|
||
(require 'custom-extra)
|
||
|
||
;;; config.el ends here
|
||
#+end_src
|
||
|
||
** Module Lists
|
||
*** Default
|
||
emacs built-in package config
|
||
**** Ediff
|
||
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-default.el
|
||
;; Don't let ediff break EXWM, keep it in one frame
|
||
(setq ediff-diff-options "-w"
|
||
ediff-split-window-function 'split-window-horizontally
|
||
ediff-window-setup-function 'ediff-setup-windows-plain)
|
||
#+end_src
|
||
**** Eshell
|
||
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-default.el
|
||
(when (eq system-type 'windows-nt)
|
||
(setq explicit-shell-file-name "powershell.exe")
|
||
(setq explicit-powershell.exe-args '()))
|
||
(defun ju/get-prompt-path ()
|
||
(let* ((current-path (eshell/pwd))
|
||
(git-output (shell-command-to-string "git rev-parse --show-toplevel"))
|
||
(has-path (not (string-match "^fatal" git-output))))
|
||
(if (not has-path)
|
||
(abbreviate-file-name current-path)
|
||
(string-remove-prefix (file-name-directory git-output) current-path))))
|
||
|
||
(defun ju/eshell-prompt ()
|
||
(let ((current-branch (magit-get-current-branch)))
|
||
(concat
|
||
"\n"
|
||
(propertize (system-name) 'face `(:foreground "#62aeed"))
|
||
(propertize " ॐ " 'face `(:foreground "white"))
|
||
(propertize (ju/get-prompt-path) 'face `(:foreground "#82cfd3"))
|
||
(when current-branch
|
||
(concat
|
||
(propertize " • " 'face `(:foreground "white"))
|
||
(propertize (concat " " current-branch) 'face `(:foreground "#c475f0"))))
|
||
(propertize " • " 'face `(:foreground "white"))
|
||
(propertize (format-time-string "%I:%M:%S %p") 'face `(:foreground "#5a5b7f"))
|
||
(if (= (user-uid) 0)
|
||
(propertize "\n#" 'face `(:foreground "red2"))
|
||
(propertize "\nλ" 'face `(:foreground "#aece4a")))
|
||
(propertize " " 'face `(:foreground "white")))))
|
||
|
||
(defun ju/configure-eshell ()
|
||
;; Save command history when commands are entered
|
||
(add-hook 'eshell-pre-command-hook 'eshell-save-some-history)
|
||
|
||
;; Truncate buffer for performance
|
||
(add-to-list 'eshell-output-filter-functions 'eshell-truncate-buffer)
|
||
|
||
;; Bind some useful keys for evil-mode
|
||
(evil-define-key '(normal insert visual) eshell-mode-map (kbd "C-r") 'counsel-esh-history)
|
||
(evil-define-key '(normal insert visual) eshell-mode-map (kbd "<home>") 'eshell-bol)
|
||
(evil-normalize-keymaps)
|
||
|
||
(setq eshell-prompt-function 'ju/eshell-prompt
|
||
eshell-prompt-regexp "^λ "
|
||
eshell-history-size 10000
|
||
eshell-buffer-maximum-lines 10000
|
||
eshell-hist-ignoredups t
|
||
eshell-scroll-to-bottom-on-input t))
|
||
(add-hook 'eshell-first-time-mode-hook #'ju/configure-eshell)
|
||
(setq eshell-prompt-function
|
||
(lambda ()
|
||
(concat (abbreviate-file-name (eshell/pwd))
|
||
(if (= (user-uid) 0) " # " " λ ")))
|
||
eshell-prompt-regexp "^[^#λ\n]* [#λ] ")
|
||
#+end_src
|
||
**** Dired
|
||
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-default.el
|
||
(usr-package-install 'dired-single)
|
||
(usr-package-install 'diredfl) ;; colorful dired
|
||
(usr-package-install 'dired-git-info)
|
||
(usr-package-install 'diff-hl) ;; diff highlight
|
||
(usr-package-install 'dired-rsync)
|
||
(usr-package-install 'all-the-icons-dired)
|
||
(usr-package-install 'dired-hide-dotfiles)
|
||
(usr-package-install 'peep-dired)
|
||
;; dired default
|
||
(setq dired-listing-switches "-agho --group-directories-first")
|
||
(evil-collection-define-key 'normal 'dired-mode-map
|
||
"h" 'dired-up-directory ;dired-single-up-directory
|
||
"l" 'dired-find-file) ;dired-single-buffer)
|
||
;;(require 'dired-single)
|
||
;;(use-package dired-single
|
||
;; :commands (dired dired-jump))
|
||
;; colorful
|
||
(add-hook 'dired-mode-hook #'diredfl-mode)
|
||
;; git info
|
||
(evil-collection-define-key 'normal 'dired-mode-map
|
||
")" 'dired-git-info-mode)
|
||
;; diff highlight
|
||
(add-hook 'dired-mode-hook #'diff-hl-dired-mode-unless-remote)
|
||
(add-hook 'magit-post-refresh-hook #'diff-hl-dired-mode-unless-remote)
|
||
(diff-hl-margin-mode)
|
||
;; rsync
|
||
(bind-key "C-c C-r" 'dired-rsync dired-mode-map)
|
||
;; all-the icons
|
||
(add-hook 'dired-mode-hook #'all-the-icons-dired-mode)
|
||
;; HACK:Fixes #1929: icons break file renaming in Emacs 27+, because the icon
|
||
;; is considered part of the filename, so we disable icons while we're in
|
||
;; wdired-mode.
|
||
;;(when EMACS27+
|
||
(defvar +wdired-icons-enabled -1)
|
||
|
||
;; hide dotfiles
|
||
(add-hook 'dired-mode-hook #'dired-hide-dotfiles-mode)
|
||
(evil-collection-define-key 'normal 'dired-mode-map
|
||
"H" 'dired-hide-dotfiles-mode)
|
||
|
||
;; TODO: check emacs29 updates
|
||
;;(csetq dired-mouse-drag-files t
|
||
;; mouse-drag-and-drop-region-cross-program t)
|
||
|
||
; peep dired
|
||
(evil-define-key 'normal peep-dired-mode-map
|
||
(kbd "j") 'peep-dired-next-file
|
||
(kbd "k") 'peep-dired-prev-file)
|
||
(add-hook 'peep-dired-hook 'evil-normalize-keymaps)
|
||
#+end_src
|
||
**** Provide Modules
|
||
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-default.el
|
||
(provide 'custom-default)
|
||
;;; custom-default.el ends here
|
||
#+end_src
|
||
*** UI
|
||
**** Line number
|
||
#+begin_src emacs-lisp :tangle ~/.config/emacs/init.el
|
||
(column-number-mode)
|
||
(global-display-line-numbers-mode t)
|
||
;; Disable line numbers for some modes
|
||
(dolist (mode '(org-mode-hook
|
||
nov-mode-hook
|
||
dashboard-mode-hook
|
||
dired-mode-hook
|
||
eshell-mode-hook))
|
||
(add-hook mode (lambda () (display-line-numbers-mode 0))))
|
||
#+end_src
|
||
|
||
**** Doom themes
|
||
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-ui.el
|
||
(usr-package-install 'doom-themes)
|
||
(require 'doom-themes)
|
||
(disable-theme 'deeper-blue)
|
||
(if (display-graphic-p)
|
||
(load-theme 'doom-palenight t)
|
||
(load-theme 'doom-gruvbox t))
|
||
#+end_src
|
||
**** Rainbow Delimiters
|
||
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-ui.el
|
||
(usr-package-install 'rainbow-delimiters)
|
||
(require 'rainbow-delimiters)
|
||
(add-hook 'prog-mode-hook #'rainbow-delimiters-mode)
|
||
#+end_src
|
||
**** Setting Transparency
|
||
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-ui.el
|
||
(set-frame-parameter nil 'alpha-background 0.9)
|
||
(add-to-list 'default-frame-alist '(alpha-background . 0.9))
|
||
(defun toggle-transparency ()
|
||
"toggle transparency."
|
||
(interactive)
|
||
(let ((alpha-transparency 1.0))
|
||
(if (eq (frame-parameter nil 'alpha-background) alpha-transparency)
|
||
(set-frame-parameter nil 'alpha-background 0.9)
|
||
(set-frame-parameter nil 'alpha-background alpha-transparency))))
|
||
(defun my/transparency-round (val)
|
||
"Round VAL to the nearest tenth of an integer."
|
||
(/ (round (* 10 val)) 10.0))
|
||
|
||
(defun my/increase-frame-alpha-background ()
|
||
"Increase current frame’s alpha background."
|
||
(interactive)
|
||
(set-frame-parameter nil
|
||
'alpha-background
|
||
(my/transparency-round
|
||
(min 1.0
|
||
(+ (frame-parameter nil 'alpha-background) 0.1))))
|
||
(message "%s" (frame-parameter nil 'alpha-background)))
|
||
|
||
(defun my/decrease-frame-alpha-background ()
|
||
"Decrease current frame’s alpha background."
|
||
(interactive)
|
||
(set-frame-parameter nil
|
||
'alpha-background
|
||
(my/transparency-round
|
||
(max 0.0
|
||
(- (frame-parameter nil 'alpha-background) 0.1))))
|
||
(message "%s" (frame-parameter nil 'alpha-background)))
|
||
(global-set-key (kbd "C-c t") 'toggle-transparency)
|
||
#+end_src
|
||
**** Modeline
|
||
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-ui.el
|
||
(usr-package-install 'doom-modeline)
|
||
(require 'doom-modeline)
|
||
(setq doom-modeline-height 15
|
||
doom-modeline-env-version t
|
||
doom-modeline-persp-name t
|
||
doom-modeline-persp-icon t
|
||
doom-modeline-display-default-persp-name t
|
||
doom-modeline-indent-info t)
|
||
(doom-modeline-mode 1)
|
||
#+end_src
|
||
**** Visual Fill Column
|
||
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-ui.el
|
||
(usr-package-install 'visual-fill-column)
|
||
(require 'visual-fill-column)
|
||
(defun write-room-enable ()
|
||
(setq visual-fill-column-width 100
|
||
visual-fill-column-center-text t)
|
||
(visual-fill-column-mode 1))
|
||
(add-hook 'org-mode-hook #'write-room-enable)
|
||
(add-hook 'markdown-mode-hook #'write-room-enable)
|
||
(add-hook 'nov-mode-hook #'write-room-enable)
|
||
#+end_src
|
||
|
||
**** Dashboard
|
||
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-ui.el
|
||
(usr-package-install 'dashboard)
|
||
(require 'linum) ;; for dashboard seperator
|
||
;;(add-hook 'dashboard-mode page-break-lines-mode)
|
||
(require 'dashboard)
|
||
|
||
(setq dashboard-set-heading-icons t)
|
||
(setq dashboard-set-file-icons t)
|
||
;;(setq dashboard-banner-logo-title "Emacs is more than a text editor!")
|
||
;;(setq dashboard-startup-banner 'logo)
|
||
(setq dashboard-center-content t)
|
||
(setq dashboard-week-agenda t)
|
||
(setq dashboard-set-footer t)
|
||
(setq dashboard-page-separator "\n\f\n")
|
||
(setq dashboard-agenda-time-string-format "%d/%m/%Y %A %H:%M")
|
||
(setq dashboard-items '((recents . 10)
|
||
(agenda . 5)
|
||
(bookmarks . 5)
|
||
;;(projects . 5)
|
||
(registers . 5)))
|
||
(setq dashboard-set-navigator t)
|
||
|
||
(setq dashboard-navigator-buttons
|
||
`(;; line1
|
||
((,(all-the-icons-octicon "mark-github" :height 1.1 :v-adjust 0.0)
|
||
"Github"
|
||
"Browse my Github"
|
||
(lambda (&rest _) (browse-url "https://github.com/JaeUs3792/")))
|
||
(,(all-the-icons-octicon "home" :height 1.1 :v-adjust 0.0)
|
||
"Homepage"
|
||
"Browse my Homepage"
|
||
(lambda (&rest _) (browse-url "https://jaeus.net")))
|
||
(,(all-the-icons-octicon "zap" :height 1.1 :v-adjust 0.0)
|
||
"Refresh"
|
||
"Refresh Packages"
|
||
(lambda (&rest _) (package-refresh-contents)) warning))))
|
||
|
||
(dashboard-setup-startup-hook)
|
||
(dashboard-modify-heading-icons '((recents . "file-text")
|
||
(bookmarks . "book")))
|
||
(setq initial-buffer-choice (lambda () (get-buffer-create "*dashboard*")))
|
||
|
||
#+end_src
|
||
|
||
**** Others
|
||
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-ui.el
|
||
(usr-package-install 'all-the-icons)
|
||
(setq visible-bell t)
|
||
(defun my/self-screenshot (&optional type)
|
||
"Save a screenshot of type TYPE of the current Emacs frame.
|
||
As shown by the function `', type can weild the value `svg',
|
||
`png', `pdf'.
|
||
|
||
This function will output in /tmp a file beginning with \"Emacs\"
|
||
and ending with the extension of the requested TYPE."
|
||
(interactive)
|
||
(let* ((type (if type type
|
||
(intern (completing-read "Screenshot Type: "
|
||
'(png svg pdf postscript)))))
|
||
(extension (pcase type
|
||
('png ".png")
|
||
('svg ".svg")
|
||
('pdf ".pdf")
|
||
('postscript ".ps")
|
||
(otherwise (error "Cannot export screenshot of type %s" otherwise))))
|
||
(filename (make-temp-file "Emacs-" nil extension))
|
||
(data (x-export-frames nil type)))
|
||
(with-temp-file filename
|
||
(insert data))
|
||
(kill-new filename)
|
||
(rename-file filename (expand-file-name (file-name-nondirectory filename) "~"))
|
||
(message filename)))
|
||
#+end_src
|
||
|
||
**** Provide Modules
|
||
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-ui.el
|
||
(provide 'custom-ui)
|
||
;;; custom-ui.el ends here
|
||
#+end_src
|
||
|
||
*** Key Bindings
|
||
**** Global Key
|
||
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-keybindings.el
|
||
;; Make ESC quit prompts
|
||
(global-set-key (kbd "<escape>") 'keyboard-escape-quit)
|
||
;; this annoying binding.
|
||
(global-unset-key (kbd "C-j"))
|
||
(global-unset-key (kbd "C-k"))
|
||
(global-unset-key (kbd "S-SPC")) ;; use only S-\
|
||
#+end_src
|
||
**** Which keys
|
||
When you begin a keybind, whichkey will show you all keybinds you can follow the first one with in order to form a full keywords.
|
||
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-keybindings.el
|
||
(usr-package-install 'which-key)
|
||
(require 'which-key)
|
||
(setq which-key-idle-delay 0.5)
|
||
(which-key-mode 1)
|
||
#+end_src
|
||
**** General
|
||
for managing keybindings.
|
||
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-keybindings.el
|
||
(usr-package-install 'general)
|
||
(require 'general)
|
||
(general-auto-unbind-keys)
|
||
(general-evil-setup t)
|
||
(general-create-definer ju/leader-key-def
|
||
:keymaps '(normal insert visual emacs)
|
||
:prefix "SPC"
|
||
:global-prefix "C-SPC")
|
||
(ju/leader-key-def
|
||
"." 'find-file
|
||
;; Buffer
|
||
"b" '(:ignore t :which-key "buffer handling")
|
||
"b i" '(ibuffer :which-key "IBuffer")
|
||
"b r" '(revert-buffer :which-key "Revert Buffer")
|
||
"b k" '(kill-current-buffer :which-key "Kill current buffer")
|
||
"b n" '(next-buffer :which-key "Next buffer")
|
||
"b p" '(previous-buffer :which-key "Previous buffer")
|
||
"b B" '(ibuffer-list-buffers :which-key "IBuffer List Buffers")
|
||
"b K" '(kill-buffer :which-key "IBuffer Kill Buffers")
|
||
;; Eshell
|
||
"e" '(:ignore t :which-key "eshell")
|
||
"e h" '(counsel-esh-history :which "Kill history")
|
||
"e s" '(eshell :which-key "run eshell")
|
||
"e e" '(elfeed :which-key "elfeed")
|
||
;; Counsel
|
||
"f" '(:ignore t :which-key "file op.")
|
||
"f r" '(consult-recent-file :which-key "Recent files")
|
||
;; Shortcut
|
||
"f o" '(:ignore t :which-key "dOt files")
|
||
"f o d" '((lambda () (interactive) (find-file "~/.config/emacs/desktop.org")) :which-key "open exwm config")
|
||
"f o p" '((lambda () (interactive) (find-file "~/org/example/emacs_my_previous.org")) :which-key "open exwm config")
|
||
"f o e" '((lambda () (interactive) (find-file "~/org/example/emacs_another.org")) :which-key "open exwm config")
|
||
"f o c" '((lambda () (interactive) (find-file "~/.config/emacs/emacs.org")) :which-key "open emacs config")
|
||
;; Insert something
|
||
"i" '(:ignore t :which-key "insert something.")
|
||
;; Org mode
|
||
"o" '(:ignore t :which-key "org mode")
|
||
"o a" '(:ignore t :which-key "org agenda")
|
||
"o a c" '((lambda () (interactive) (find-file (expand-file-name "agenda/agenda.org" org-directory))) :which-key "org agenda file")
|
||
"o c" '(cfw:open-org-calendar :which-key "org calendar")
|
||
|
||
;; Project-el
|
||
"p" '(:ignore t :which-key "project")
|
||
"p ." '(project-switch-project :which-key "switch project")
|
||
"p p" '(project-switch-project :which-key "switch project")
|
||
"p c" '(project-compile :which-key "compile")
|
||
"p f" '(project-find-file :which-key "find-file")
|
||
"p k" '(project-kill-buffers :which-key "kill buffers")
|
||
"p s" '(project-shell :which-key "shell")
|
||
"p e" '(project-eshell :which-key "eshell")
|
||
"p d" '(project-dired :which-key "dired")
|
||
"p g" '(project-find-regexp :which-key "find-regexp")
|
||
;; Extra
|
||
"t" '(:ignore t :which-key "extra")
|
||
"t a" '(toggle-transparency :which-key "Toggle Transparency")
|
||
"t t" '(toggle-truncate-lines :which-key "Toggle truncate lines"))
|
||
#+end_src
|
||
**** Evil Mode
|
||
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-keybindings.el
|
||
(usr-package-install 'evil)
|
||
(usr-package-install 'evil-collection)
|
||
(usr-package-install 'evil-nerd-commenter)
|
||
(usr-package-install 'evil-numbers)
|
||
(customize-set-variable 'evil-want-integration t)
|
||
(customize-set-variable 'evil-want-keybinding nil)
|
||
(customize-set-variable 'evil-want-C-u-scroll t)
|
||
(customize-set-variable 'evil-want-C-i-jump nil)
|
||
(customize-set-variable 'evil-respect-visual-line-mode nil) ; t : on the screen, nil : by cr characters
|
||
|
||
(customize-set-variable 'evil-set-fine-undo t); more granular undo with evil
|
||
|
||
(require 'evil)
|
||
(evil-mode 1)
|
||
;; Make evil search more like vim
|
||
;;(evil-select-search-module 'evil-search-module 'evil-search)
|
||
|
||
(evil-set-undo-system 'undo-tree)
|
||
;;(evil-set-undo-system 'undo-redo)
|
||
(evil-set-initial-state 'messages-buffer-mode 'normal)
|
||
(evil-set-initial-state 'dashboard-mode 'normal)
|
||
|
||
;; evil nerd commenter
|
||
(define-key evil-normal-state-map (kbd "g c") 'evilnc-comment-or-uncomment-lines)
|
||
(define-key evil-visual-state-map (kbd "g c") 'evilnc-comment-or-uncomment-lines)
|
||
|
||
;; evil collection
|
||
(evil-collection-init)
|
||
|
||
;; evil numbers
|
||
;; unfortunately C-x is emacs common key binding.
|
||
(define-key evil-normal-state-map (kbd "g =") 'evil-numbers/inc-at-pt)
|
||
(define-key evil-normal-state-map (kbd "g -") 'evil-numbers/dec-at-pt)
|
||
(define-key evil-visual-state-map (kbd "g =") 'evil-numbers/inc-at-pt)
|
||
(define-key evil-visual-state-map (kbd "g -") 'evil-numbers/dec-at-pt)
|
||
|
||
;; eshell no evil
|
||
(dolist (mode '(eshell-mode))
|
||
(add-to-list 'evil-emacs-state-modes mode))
|
||
|
||
;; when programming _
|
||
(modify-syntax-entry ?_ "w")
|
||
#+end_src
|
||
**** Undo Tree
|
||
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-keybindings.el
|
||
(usr-package-install 'undo-tree)
|
||
(require 'undo-tree)
|
||
(setq undo-tree-visualizer-diff t
|
||
undo-tree-visualizer-timestamps t
|
||
undo-tree-auto-save-history t
|
||
undo-tree-enable-undo-in-region t
|
||
undo-limit (* 800 1024)
|
||
undo-strong-limit (* 12 1024 1024)
|
||
undo-outer-limit (* 128 1024 1024))
|
||
(setq undo-tree-history-directory-alist
|
||
`(("." . ,(expand-file-name (file-name-as-directory "undo-tree-hist")
|
||
user-emacs-directory))))
|
||
(global-undo-tree-mode)
|
||
#+end_src
|
||
**** Hydra
|
||
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-keybindings.el
|
||
(usr-package-install 'hydra)
|
||
(require 'hydra)
|
||
(defhydra hydra-text-scale (:timeout 4)
|
||
"scale text"
|
||
("t" text-scale-increase "in")
|
||
("s" text-scale-decrease "out")
|
||
("q" nil "finished" :exit t))
|
||
(defhydra hydra-writeroom-scale (:timeout 4)
|
||
"scale whiteroom"
|
||
("t" writeroom-increase-width "enlarge")
|
||
("S" writeroom-decrease-width "shrink")
|
||
("r" writeroom-adjust-width "adjust")
|
||
("q" nil "finished" :exit t))
|
||
(defhydra hydra-modify-alpha ()
|
||
("s" my/decrease-frame-alpha-background "decrease alpha")
|
||
("t" my/increase-frame-alpha-background "increase alpha")
|
||
("q" nil "finished" :exit t))
|
||
(ju/leader-key-def
|
||
;; Hydra
|
||
"h" '(:ignore t :which-key "hydra")
|
||
"h t" '(hydra-text-scale/body :which-key "scale text")
|
||
"h w" '(hydra-writeroom-scale/body :which-key "scale whiteroom")
|
||
"h a" '(hydra-modify-alpha/body :which-key "modify alpha background"))
|
||
#+end_src
|
||
|
||
**** Provide Modules
|
||
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-keybindings.el
|
||
(provide 'custom-keybindings)
|
||
;;; custom-keybindings.el ends here
|
||
#+end_src
|
||
|
||
*** Completion
|
||
config from crafted-emacs
|
||
https://github.com/SystemCrafters/crafted-emacs
|
||
**** Vertico
|
||
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-completion.el
|
||
(usr-package-install 'vertico)
|
||
(require 'vertico)
|
||
(require 'vertico-directory)
|
||
(with-eval-after-load 'evil
|
||
(define-key vertico-map (kbd "C-j") 'vertico-next)
|
||
(define-key vertico-map (kbd "C-k") 'vertico-previous)
|
||
(define-key vertico-map (kbd "M-h") 'vertico-directory-up))
|
||
(customize-set-variable 'vertico-cycle t)
|
||
(vertico-mode 1)
|
||
#+end_src
|
||
**** Prescient
|
||
simple but effective sorting and filtering for emacs.
|
||
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-completion.el
|
||
(usr-package-install 'vertico-prescient)
|
||
(vertico-prescient-mode)
|
||
#+end_src
|
||
**** Marginalia
|
||
annotations placed at the margin of the minibuffer
|
||
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-completion.el
|
||
(usr-package-install 'marginalia)
|
||
(require 'marginalia)
|
||
(customize-set-variable 'marginalia-annotators '(marginalia-annotators-heavy marginalia-annotators-light nil))
|
||
(marginalia-mode 1)
|
||
#+end_src
|
||
**** Consult
|
||
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-completion.el
|
||
(usr-package-install 'consult)
|
||
(global-set-key (kbd "C-s") 'consult-line)
|
||
(define-key minibuffer-local-map (kbd "C-r") 'consult-history)
|
||
(global-set-key (kbd "C-M-j") 'consult-buffer)
|
||
(setq completion-in-region-function #'consult-completion-in-region)
|
||
#+end_src
|
||
**** Orderless
|
||
orderless completion
|
||
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-completion.el
|
||
(usr-package-install 'orderless)
|
||
(require 'orderless)
|
||
(customize-set-variable 'completion-styles '(orderless basic))
|
||
(customize-set-variable 'completion-category-overrides '((file (style basic partial-completion))))
|
||
#+end_src
|
||
**** Embark / Embark Consult
|
||
Quick Action in minibuffer
|
||
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-completion.el
|
||
(usr-package-install 'embark)
|
||
(usr-package-install 'embark-consult)
|
||
(require 'embark)
|
||
(require 'embark-consult)
|
||
(global-set-key [remap describe-bindings] #'embark-bindings)
|
||
(global-set-key (kbd "C-.") 'embark-act)
|
||
;; Use Embark to show bindings in a key prefix with `C-h`
|
||
(setq prefix-help-command #'embark-prefix-help-command)
|
||
(with-eval-after-load 'embark-consult
|
||
(add-hook 'embark-collect-mode-hook #'consult-preview-at-point-mode))
|
||
#+end_src
|
||
|
||
**** Corfu / Cape
|
||
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-completion.el
|
||
(usr-package-install 'corfu)
|
||
(usr-package-install 'corfu-terminal)
|
||
(usr-package-install 'cape)
|
||
;;; Corfu
|
||
(require 'corfu-popupinfo)
|
||
(require 'corfu)
|
||
|
||
(unless (display-graphic-p)
|
||
(require 'corfu-terminal)
|
||
(corfu-terminal-mode +1))
|
||
|
||
;; Setup corfu for popup like completion
|
||
(customize-set-variable 'corfu-cycle t) ; Allows cycling through candidates
|
||
(customize-set-variable 'corfu-auto t) ; Enable auto completion
|
||
(customize-set-variable 'corfu-auto-prefix 2) ; Complete with less prefix keys
|
||
(customize-set-variable 'corfu-auto-delay 0.0) ; No delay for completion
|
||
(customize-set-variable 'corfu-echo-documentation 0.25) ; Echo docs for current completion option
|
||
|
||
(global-corfu-mode 1)
|
||
(corfu-popupinfo-mode 1)
|
||
(eldoc-add-command #'corfu-insert)
|
||
(define-key corfu-map (kbd "M-p") #'corfu-popupinfo-scroll-down)
|
||
(define-key corfu-map (kbd "M-n") #'corfu-popupinfo-scroll-up)
|
||
(define-key corfu-map (kbd "M-d") #'corfu-popupinfo-toggle)
|
||
|
||
;;; Cape
|
||
|
||
;; Setup Cape for better completion-at-point support and more
|
||
(require 'cape)
|
||
|
||
;; Add useful defaults completion sources from cape
|
||
(add-to-list 'completion-at-point-functions #'cape-file)
|
||
(add-to-list 'completion-at-point-functions #'cape-dabbrev)
|
||
|
||
;; Silence the pcomplete capf, no errors or messages!
|
||
;; Important for corfu
|
||
(advice-add 'pcomplete-completions-at-point :around #'cape-wrap-silent)
|
||
|
||
;; Ensure that pcomplete does not write to the buffer
|
||
;; and behaves as a pure `completion-at-point-function'.
|
||
(advice-add 'pcomplete-completions-at-point :around #'cape-wrap-purify)
|
||
(add-hook 'eshell-mode-hook
|
||
(lambda () (setq-local corfu-quit-at-boundary t
|
||
corfu-quit-no-match t
|
||
corfu-auto nil)
|
||
(corfu-mode)))
|
||
#+end_src
|
||
**** Provide Modules
|
||
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-completion.el
|
||
(provide 'custom-completion)
|
||
;;; custom-completion.el ends here
|
||
#+end_src
|
||
*** Org Mode
|
||
**** Normal Function
|
||
***** configure org
|
||
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-org.el
|
||
(usr-package-install 'org-contrib)
|
||
(setq org-directory "~/org") ; use for relative file location
|
||
;; hooks
|
||
(add-hook 'org-mode-hook #'org-indent-mode)
|
||
(setq org-todo-keywords
|
||
'((sequence "TODO(t)" "HOLD(h)" "|" "KILL(k)" "DONE(d)")))
|
||
(setq org-ellipsis " ⤵"
|
||
org-hide-emphasis-markers t
|
||
org-image-actual-width 600
|
||
org-redisplay-inline-images t
|
||
org-display-inline-images t
|
||
org-startup-with-inline-images "inlineimages"
|
||
org-src-fontify-natively t
|
||
org-fontify-quote-and-verse-blocks t
|
||
org-agenda-start-with-log-mode t
|
||
org-startup-indented t
|
||
org-startup-align-all-tables t
|
||
org-log-done 'time
|
||
org-log-into-drawer "LOGBOOK"
|
||
org-clock-into-drawer "CLOCKING"
|
||
org-lowest-priority 68)
|
||
;;(setq org-format-latex-options (plist-put org-format-latex-options :scale 1.8))
|
||
|
||
(setq org-use-sub-superscripts (quote {}))
|
||
;; Do not ask when run code block
|
||
(setq org-confirm-babel-evaluate nil)
|
||
|
||
(custom-set-faces
|
||
'(org-level-1 ((t (:height 1.7 :weight ultra-bold :foreground "#81a2be")))) ;; :foreground "#81a2be"
|
||
'(org-level-2 ((t (:height 1.6 :weight extra-bold :foreground "#b294bb")))) ;; :foreground "#b294bb"
|
||
'(org-level-3 ((t (:height 1.5 :weight bold :foreground "#b5bd68")))) ;; :foreground "#b5bd68"
|
||
'(org-level-4 ((t (:height 1.4 :weight semi-bold :foreground "#e6c547")))) ;; :foreground "#e6c547"
|
||
'(org-level-5 ((t (:height 1.3 :weight normal :foreground "#cc6666")))) ;; :foreground "#cc6666"
|
||
'(org-level-6 ((t (:height 1.2 :weight normal :foreground "#70c0ba")))) ;; :foreground "#70c0ba"
|
||
'(org-level-7 ((t (:height 1.1 :weight normal :foreground "#b77ee0")))) ;; :foreground "#b77ee0"
|
||
'(org-level-8 ((t (:height 1.0 :weight normal :foreground "#9ec400"))))
|
||
'(org-document-title ((t (:height 2.0 :weight ultra-bold :foreground "#9ec400")))))
|
||
(setq org-use-sub-superscripts '{})
|
||
#+end_src
|
||
***** Org fancy Priorities
|
||
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-org.el
|
||
(usr-package-install 'org-fancy-priorities)
|
||
;;(setq org-fancy-priorities-list '("⚡" "⬆" "⬇" "☕"))
|
||
(add-hook 'org-mode-hook #'org-fancy-priorities-mode)
|
||
(add-hook 'org-agenda-mode-hook #'org-fancy-priorities-mode)
|
||
(setq org-fancy-priorities-list `(,(all-the-icons-faicon "flag" :height 1.1 :v-adjust 0.0)
|
||
,(all-the-icons-faicon "arrow-up" :height 1.1 :v-adjust 0.0)
|
||
,(all-the-icons-faicon "square" :height 1.1 :v-adjust 0.0)
|
||
,(all-the-icons-faicon "ban" :height 1.1 :v-adjust 0.0)))
|
||
#+end_src
|
||
***** Org superstar
|
||
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-org.el
|
||
(usr-package-install 'org-superstar)
|
||
(setq org-superstar-item-bullet-alist
|
||
'((?+ . ?➢)
|
||
(?* . ?✰)
|
||
(?- . ?➸)))
|
||
(add-hook 'org-mode-hook #'org-superstar-mode)
|
||
#+end_src
|
||
***** Valign
|
||
| 12345678 | |
|
||
|----------+---|
|
||
| 일이삼사 | |
|
||
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-org.el
|
||
(usr-package-install 'valign)
|
||
(customize-set-variable 'valign-fancy-bar t)
|
||
#+end_src
|
||
***** Emphasize text
|
||
bold : *bold*
|
||
italic : /italic/
|
||
unerline : _unerline_
|
||
verbatim : =verbatim=
|
||
code : ~code~
|
||
strike-through : +strike-through+
|
||
***** Org Appear
|
||
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-org.el
|
||
(usr-package-install 'org-appear)
|
||
(add-hook 'org-mode-hook #'org-appear-mode)
|
||
(setq org-appear-autoemphasis t
|
||
org-appear-autolinks t
|
||
org-appear-autoentities t
|
||
org-appear-autosubmarkers t)
|
||
#+end_src
|
||
***** Org fragtog
|
||
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-org.el
|
||
(usr-package-install 'org-fragtog)
|
||
(add-hook 'org-mode-hook #'org-fragtog-mode)
|
||
#+end_src
|
||
***** Org latex preview
|
||
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-org.el
|
||
(setq org-format-latex-options (plist-put org-format-latex-options :scale 2.5))
|
||
#+end_src
|
||
**** Attachment
|
||
***** Org attach screenshot (linux)
|
||
to use org-screenshot-take
|
||
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-org.el
|
||
(usr-package-install 'org-attach-screenshot)
|
||
#+end_src
|
||
***** Org download
|
||
download image link
|
||
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-org.el
|
||
(usr-package-install 'org-download)
|
||
#+end_src
|
||
***** ob-latex-as-png
|
||
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-org.el
|
||
(usr-package-install 'ob-latex-as-png)
|
||
(require 'ob-latex-as-png)
|
||
#+end_src
|
||
|
||
****** Example 1
|
||
#+begin_src latex-as-png :results replace :file neural-networks :exports both
|
||
\usepackage{neuralnetwork}
|
||
% in
|
||
\begin{neuralnetwork}[height=4]
|
||
\newcommand{\x}[2]{$x_#2$}
|
||
\newcommand{\y}[2]{$y_#2$}
|
||
\newcommand{\hfirst}[2]{\small $h^{(1)}_#2$}
|
||
\newcommand{\hsecond}[2]{\small $h^{(2)}_#2$}
|
||
\newcommand{\mylinktext}[4] {
|
||
% from layer=#1, from node=#2
|
||
% to layer=#3, to node=#4
|
||
\ifnum1=#1\relax
|
||
\ifnum3=#4\relax $w^{#1}_{#4,#2}$ \fi
|
||
\else \fi
|
||
}
|
||
% Then assign it:
|
||
\setdefaultlinklabel{\mylinktext}
|
||
\inputlayer[count=3, bias=false, title=Input\\layer, text=\x]
|
||
\hiddenlayer[count=4, bias=false, title=Hidden\\layer 1, text=\hfirst] \linklayers
|
||
\hiddenlayer[count=3, bias=false, title=Hidden\\layer 2, text=\hsecond] \linklayers
|
||
\outputlayer[count=2, title=Output\\layer, text=\y] \linklayers
|
||
\end{neuralnetwork}
|
||
#+end_src
|
||
|
||
#+RESULTS:
|
||
[[file:neural-networks.png]]
|
||
|
||
****** Example 2
|
||
#+PROPERTY: header-args:latex-as-png :results raw value replace
|
||
#+begin_src latex-as-png :file example.pdf :resolution 120
|
||
\smartdiagram[bubble diagram]{Emacs,Org-mode, \LaTeX, Pretty Images, HTML}
|
||
#+end_src
|
||
|
||
****** Example 3
|
||
#+begin_src latex-as-png :file using-picture-environment :exports both
|
||
\input GoudyIn.fd \input Acorn.fd
|
||
\def\light#1{\huge \usefont{U}{Acorn}{xl}{n} #1}
|
||
\def\thick#1{\fontsize{50}{60}\selectfont \usefont{U}{GoudyIn}{xl}{n} #1}
|
||
% \fontsize{X}{Y} ⇒ Write with point size X, using Y point size between lines
|
||
|
||
\pagecolor{brown}
|
||
|
||
\begin{picture}(124,60)
|
||
\put(0,0){\thick{ORG}}
|
||
\put(18,42){\light{JaeUs}}
|
||
\put(0,55){\rotatebox{-45}{\scriptsize \LaTeX}}
|
||
\put(109,43){\rotatebox{45}{\scriptsize \texttt{HTML}}}
|
||
\end{picture}
|
||
#+end_src
|
||
|
||
#+RESULTS:
|
||
[[file:using-picture-environment.png]]
|
||
***** def-functions
|
||
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-org.el
|
||
(defun my/org-remove-link-and-trash-linked-file ()
|
||
"Remove `org-mode' link at point and trash linked file."
|
||
(interactive)
|
||
(let* ((link (org-element-context))
|
||
(path (org-element-property :path link)))
|
||
(move-file-to-trash path)
|
||
(delete-region (org-element-property :begin link)
|
||
(org-element-property :end link))))
|
||
(defun my/powershell (script)
|
||
"executes the given script within a powershell and returns its return value"
|
||
(call-process "powershell.exe" nil nil nil
|
||
"-Command" (concat "& {" script "}")))
|
||
(defun my/as-windows-path (unix-path)
|
||
"Takes a unix path and returns a matching WSL path"
|
||
;; substring removes the trailing \n
|
||
(substring
|
||
(shell-command-to-string
|
||
(concat "wslpath -w " unix-path)) 0 -1))
|
||
(defun my/org-paste-image-win2wsl ()
|
||
"Paste an image into a time stamped unique-named file in the
|
||
same directory as the org-buffer and insert a link to this file."
|
||
(interactive)
|
||
(let* ((target-file
|
||
(concat
|
||
(make-temp-name
|
||
(concat org-directory
|
||
"/images/"
|
||
(f-filename buffer-file-name)
|
||
"_"
|
||
(format-time-string "%Y%m%d_%H%M%S_"))) ".png"))
|
||
(wsl-path
|
||
(concat (my/as-windows-path(file-name-directory target-file))
|
||
"/"
|
||
(file-name-nondirectory target-file)))
|
||
(ps-script
|
||
(concat "(Get-Clipboard -Format image).Save('" wsl-path "')")))
|
||
|
||
(my/powershell ps-script)
|
||
|
||
(if (file-exists-p target-file)
|
||
(progn (insert (concat "[[" target-file "]]"))
|
||
(org-display-inline-images))
|
||
(user-error
|
||
"Error pasting the image, make sure you have an image in the clipboard!"))
|
||
))
|
||
#+end_src
|
||
**** Exporter
|
||
export with ^, _ character
|
||
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-org.el
|
||
;; ODT export to docx
|
||
(setq org-odt-preferred-output-format "docx"
|
||
org-export-with-sub-superscripts '{}
|
||
org-latex-compiler "xelatex")
|
||
;;
|
||
(dolist (ext '("bbl" "lot"))
|
||
(add-to-list 'org-latex-logfiles-extensions ext t))
|
||
#+end_src
|
||
***** Hugo
|
||
my-blog jaeus.net
|
||
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-org.el
|
||
(usr-package-install 'ox-hugo)
|
||
#+end_src
|
||
***** TODO Engrave-faces
|
||
latex export code block
|
||
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-org.el
|
||
;;(usr-package-install 'engrave-faces)
|
||
;;(require 'engrave-faces)
|
||
;;(require 'engrave-faces-latex)
|
||
;;(setq org-latex-src-block-backend 'engraved)
|
||
#+end_src
|
||
|
||
**** Additional Functions
|
||
***** Org Journal
|
||
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-org.el
|
||
(usr-package-install 'org-journal)
|
||
(setq org-journal-dir (expand-file-name "journal/" org-directory))
|
||
(setq org-journal-file-type 'weekly)
|
||
(ju/leader-key-def
|
||
"n j" '(:ignore t :which-key "Org Journal")
|
||
"n j j" '(org-journal-new-entry :which-key "new Entry")
|
||
"n j J" '(org-journal-new-scheduled-entry :which-key "New Scheduled entry")
|
||
"n j s" '(org-journal-search :which-key "Journal Search"))
|
||
#+end_src
|
||
|
||
***** Org Roam
|
||
+ TODO: Project todos
|
||
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-org.el
|
||
(usr-package-install 'org-roam)
|
||
;;(my/org-roam-refresh-agenda-list)
|
||
|
||
(setq org-roam-v2-ack t)
|
||
(customize-set-variable 'org-roam-directory "~/org/roam")
|
||
(customize-set-variable 'org-roam-completion-everywhere t)
|
||
(org-roam-db-autosync-mode)
|
||
;; Org roam ui
|
||
(usr-package-install 'org-roam-ui)
|
||
(setq org-roam-ui-sync-theme t
|
||
org-roam-ui-follow t
|
||
org-roam-ui-update-on-save t
|
||
org-roam-ui-open-on-start nil)
|
||
(ju/leader-key-def
|
||
"n r" '(:ignore t :which-key "Org Roam")
|
||
"n r u" 'org-roam-ui-open
|
||
"n r l" 'org-roam-buffer-toggle
|
||
"n r f" 'org-roam-node-find
|
||
"n r i" 'org-roam-node-insert
|
||
"n r I" 'org-roam-node-insert-immediate
|
||
"n r p" 'my/org-roam-find-project)
|
||
;;:desc "org roam refresh agenda list"
|
||
;;"oar" 'my/org-roam-refresh-agenda-list
|
||
;;:desc "org roam find tag:project"
|
||
;;"nrp" 'my/org-roam-find-project
|
||
;;:desc "org roam find with ripgrep (preview)"
|
||
;;"nrg" 'my/org-roam-rg-search)
|
||
#+end_src
|
||
***** Org Agenda
|
||
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-org.el
|
||
(setq org-agenda-files (list "~/org/agenda/agenda.org"))
|
||
#+end_src
|
||
***** Org Super Agenda
|
||
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-org.el
|
||
(usr-package-install 'org-super-agenda)
|
||
(org-super-agenda-mode 1)
|
||
(setq org-agenda-custom-commands
|
||
'(("z" "Org mode super agenda"
|
||
((alltodo "" ((org-agenda-overriding-header "")
|
||
(org-super-agenda-groups
|
||
'((:name "Important"
|
||
:tag "Important"
|
||
:priority "A"
|
||
:order 6)
|
||
(:name "Due Today"
|
||
:deadline today
|
||
:order 2)
|
||
(:name "Due Soon"
|
||
:deadline future
|
||
:order 8)
|
||
(:name "Overdue"
|
||
:deadline past
|
||
:order 7)
|
||
(:name "Projects"
|
||
:tag "Project"
|
||
:order 14)
|
||
(:name "To read"
|
||
:tag "Read"
|
||
:order 30)
|
||
(:name "Waiting"
|
||
:todo "WAIT"
|
||
:order 20)
|
||
(:name "Holding"
|
||
:todo "HOLD"
|
||
:order 21)
|
||
(:name "trivial"
|
||
:priority<= "C"
|
||
:tag ("Trivial" "Unimportant")
|
||
:order 90)
|
||
(:discard (:tag ("Chore" "Routine" "Daily")))))))))))
|
||
#+end_src
|
||
**** Tools
|
||
***** ob-async
|
||
asynchronous execution of org-babel src blocks
|
||
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-org.el
|
||
(usr-package-install 'ob-async)
|
||
(require 'ob-async)
|
||
#+end_src
|
||
|
||
some language should add
|
||
#+begin_src emacs-lisp
|
||
(setq ob-async-no-async-languages-alist '("ipython"))
|
||
#+end_src
|
||
***** Org PDF tools
|
||
get link from pdf,
|
||
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-org.el
|
||
(usr-package-install 'org-pdftools)
|
||
(add-hook 'org-mode-hook #'org-pdftools-setup-link)
|
||
#+end_src
|
||
**** Keybindings
|
||
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-org.el
|
||
(ju/leader-key-def
|
||
"o" '(:ignore t :which-key "Org mode")
|
||
"o a" '(:ignore t :which-key "Org Agenda")
|
||
"o a r" '(my/org-roam-refresh-agenda-list :which-key "Org agenda refresh list")
|
||
"o a a" '(org-agenda :which-key "open org agenda"))
|
||
#+end_src
|
||
**** Provide Modules
|
||
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-org.el
|
||
(provide 'custom-org)
|
||
;;; custom-org.el ends here
|
||
#+end_src
|
||
*** Projects
|
||
**** MAGIT
|
||
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-projects.el
|
||
(usr-package-install 'magit)
|
||
;;(use-package magit)
|
||
(require 'magit)
|
||
;;(magit-status magit-get-current-branch)
|
||
;; ;;:custom
|
||
(setq magit-clone-default-directory "~/Project/"
|
||
magit-display-buffer-function #'magit-display-buffer-same-window-except-diff-v1)
|
||
(ju/leader-key-def
|
||
;; Magit
|
||
"g" '(:ignore t :which-key "magit")
|
||
"g g" '(magit :which-key "magit"))
|
||
#+end_src
|
||
**** Gitgutter
|
||
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-projects.el
|
||
(usr-package-install 'git-gutter)
|
||
(global-git-gutter-mode)
|
||
(setq git-gutter:update-interval 2)
|
||
#+end_src
|
||
**** Forge
|
||
Git forge
|
||
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-projects.el
|
||
#+end_src
|
||
**** Highlight TODOs
|
||
***** TODO: test
|
||
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-projects.el
|
||
(usr-package-install 'hl-todo)
|
||
(require 'hl-todo)
|
||
(setq hl-todo-keyword-faces
|
||
`(;; For things that need to be done, just not today.
|
||
("TODO" warning bold)
|
||
;; For problems that will become bigger problems later if not
|
||
;; fixed ASAP.
|
||
("FIXME" error bold)
|
||
;; For tidbits that are unconventional and not intended uses of the
|
||
;; constituent parts, and may break in a future update.
|
||
("HACK" font-lock-constant-face bold)
|
||
;; For things that were done hastily and/or hasn't been thoroughly
|
||
;; tested. It may not even be necessary!
|
||
("REVIEW" font-lock-keyword-face bold)
|
||
;; For especially important gotchas with a given implementation,
|
||
;; directed at another user other than the author.
|
||
("NOTE" success bold)
|
||
;; For things that just gotta go and will soon be gone.
|
||
("DEPRECATED" font-lock-doc-face bold)
|
||
;; For a known bug that needs a workaround
|
||
("BUG" error bold)
|
||
;; For warning about a problematic or misguiding code
|
||
("XXX" font-lock-constant-face bold)))
|
||
(global-hl-todo-mode 1)
|
||
#+end_src
|
||
**** Magit TODOs
|
||
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-projects.el
|
||
(usr-package-install 'magit-todos)
|
||
(require 'magit-todos)
|
||
(add-hook 'magit-mode-hook #'magit-todos-mode)
|
||
#+end_src
|
||
**** Provide Modules
|
||
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-projects.el
|
||
(provide 'custom-projects)
|
||
;;; custom-projects.el ends here
|
||
#+end_src
|
||
*** Workspaces
|
||
**** Tabspace
|
||
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-workspaces.el
|
||
;;(use-package tabspaces
|
||
;; :disabled
|
||
;; ;; use this next line only if you also use straight, otherwise ignore it.
|
||
;; :straight (:type git :host github :repo "mclear-tools/tabspaces")
|
||
;; :hook (after-init . tabspaces-mode) ;; use this only if you want the minor-mode loaded at startup.
|
||
;; :commands (tabspaces-switch-or-create-workspace
|
||
;; tabspaces-open-or-create-project-and-workspace)
|
||
;; :custom
|
||
;; (tabspaces-use-filtered-buffers-as-default t)
|
||
;; (tabspaces-default-tab "Default")
|
||
;; (tabspaces-remove-to-default t)
|
||
;; (tabspaces-include-buffers '("*scratch*"))
|
||
;; ;; sessions
|
||
;; (tabspaces-session t)
|
||
;; (tabspaces-session-auto-restore t)
|
||
;; :config
|
||
;; (ju/leader-key-def
|
||
;; "TAB" '(tabspaces-command-map :which-key "tabspaces-command-map")))
|
||
#+end_src
|
||
|
||
**** Perspective
|
||
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-workspaces.el
|
||
;;(use-package perspective
|
||
;; :disabled
|
||
;; :demand t
|
||
;; :bind (("C-M-j" . consult-buffer)
|
||
;; ("C-M-k" . persp-switch)
|
||
;; ("C-M-n" . persp-next)
|
||
;; ("C-x k" . persp-kill-buffer*))
|
||
;; :custom
|
||
;; (persp-initial-frame-name "Main")
|
||
;; (persp-mode-prefix-key (kbd "C-c p"))
|
||
;; :config
|
||
;; (ju/leader-key-def
|
||
;; "TAB" '(perspective-map :which-key "perspective"))
|
||
;; ;; Running `persp-mode' multiple times resets the perspective list...
|
||
;; (unless (equal persp-mode t)
|
||
;; (persp-mode)))
|
||
;;(provide 'custom-workspaces)
|
||
;;; custom-workspaces.el ends here
|
||
#+end_src
|
||
*** Latex
|
||
**** AUCTEX
|
||
writing and formatting tex file in Emacs.
|
||
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-latex.el
|
||
(usr-package-install 'auctex)
|
||
(with-eval-after-load 'latex
|
||
(customize-set-variable 'TeX-auto-save t)
|
||
(customize-set-variable 'TeX-parse-self t)
|
||
(setq-default TeX-master nil)
|
||
|
||
;; compile to pdf
|
||
(tex-pdf-mode)
|
||
|
||
;; correlate the source and the output
|
||
(TeX-source-correlate-mode)
|
||
|
||
;; set a correct indentation in a few additional environments
|
||
(add-to-list 'LaTeX-indent-environment-list '("lstlisting" current-indentation))
|
||
(add-to-list 'LaTeX-indent-environment-list '("tikzcd" LaTeX-indent-tabular))
|
||
(add-to-list 'LaTeX-indent-environment-list '("tikzpicture" current-indentation))
|
||
|
||
;; add a few macros and environment as verbatim
|
||
(add-to-list 'LaTeX-verbatim-environments "lstlisting")
|
||
(add-to-list 'LaTeX-verbatim-environments "Verbatim")
|
||
(add-to-list 'LaTeX-verbatim-macros-with-braces "lstinline")
|
||
(add-to-list 'LaTeX-verbatim-macros-with-delims "lstinline")
|
||
|
||
;; to use pdfview with auctex
|
||
(customize-set-variable 'TeX-view-program-selection '((output-pdf "PDF Tools")))
|
||
(customize-set-variable 'TeX-view-program-list '(("PDF Tools" TeX-pdf-tools-sync-view)))
|
||
(customize-set-variable 'TeX-source-correlate-start-server t)
|
||
|
||
;; electric pairs in auctex
|
||
(customize-set-variable 'TeX-electric-sub-and-superscript t)
|
||
(customize-set-variable 'LaTeX-electric-left-right-brace t)
|
||
(customize-set-variable 'TeX-electric-math (cons "$" "$"))
|
||
|
||
;; open all buffers with the math mode and auto-fill mode
|
||
(add-hook 'LaTeX-mode-hook #'auto-fill-mode)
|
||
(add-hook 'LaTeX-mode-hook #'LaTeX-math-mode)
|
||
|
||
;; add support for references
|
||
(add-hook 'LaTeX-mode-hook 'turn-on-reftex)
|
||
(customize-set-variable 'reftex-plug-into-AUCTeX t)
|
||
|
||
;; to have the buffer refresh after compilation
|
||
(add-hook 'TeX-after-compilation-finished-functions #'TeX-revert-document-buffer))
|
||
#+end_src
|
||
**** Cdlatex
|
||
speed-up insertion of environments and math templates.
|
||
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-latex.el
|
||
(usr-package-install 'cdlatex)
|
||
(add-hook 'org-mode-hook #'org-cdlatex-mode)
|
||
(add-hook 'LaTeX-mode-hook #'cdlatex-mode)
|
||
(setq cdlatex-use-dollar-to-ensure-math nil)
|
||
#+end_src
|
||
**** Preview pane
|
||
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-latex.el
|
||
(usr-package-install 'latex-preview-pane)
|
||
(require 'latex-preview-pane)
|
||
#+end_src
|
||
**** Provide Modules
|
||
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-latex.el
|
||
(provide 'custom-latex)
|
||
;;; custom-latex.el ends here
|
||
#+end_src
|
||
*** Extra
|
||
**** Helpful
|
||
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-extra.el
|
||
(usr-package-install 'helpful)
|
||
(customize-set-variable 'counsel-describe-function-function #'helpful-callable)
|
||
(customize-set-variable 'counsel-describe-variable-function #'helpful-variable)
|
||
(require 'helpful)
|
||
;;:commands (helpful-callable helpful-variable helpful-command helpful-key)
|
||
(global-set-key [remap describe-function] #'describe-function)
|
||
(global-set-key [remap describe-command] #'helpful-command)
|
||
(global-set-key [remap describe-variable] #'describe-variable)
|
||
(global-set-key [remap describe-key] #'helpful-key)
|
||
#+end_src
|
||
**** Avy
|
||
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-extra.el
|
||
(usr-package-install 'avy)
|
||
(setq avy-all-windows t)
|
||
(ju/leader-key-def
|
||
"v" '(:ignore t :which-key "Avy")
|
||
"vc" '(avy-goto-char :which-key "Avy Goto Char")
|
||
"vw" '(avy-goto-word-0 :which-key "Avy Goto Word")
|
||
"vl" '(avy-goto-line :which-key "Avy Goto Line"))
|
||
#+end_src
|
||
**** Snippet
|
||
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-extra.el
|
||
(usr-package-install 'yasnippet)
|
||
(usr-package-install 'yasnippet-snippets)
|
||
(defvar yas-snippet-dirs nil)
|
||
(add-hook 'prog-mode-hook #'yas-minor-mode)
|
||
(add-to-list 'yas-snippet-dirs "~/.config/emacs/snippets")
|
||
(yas-global-mode 1)
|
||
(ju/leader-key-def
|
||
"i s" '(yas-insert-snippet :which-key "snippet"))
|
||
#+end_src
|
||
**** Emojify
|
||
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-extra.el
|
||
(usr-package-install 'emojify)
|
||
(global-emojify-mode 1)
|
||
(ju/leader-key-def
|
||
"i e" '(emojify-insert-emoji :which-key "emoji"))
|
||
#+end_src
|
||
**** PDF Tool
|
||
enhanced PDF viewer on emacs
|
||
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-extra.el
|
||
(usr-package-install 'pdf-tools)
|
||
(require 'pdf-tools)
|
||
(pdf-tools-install)
|
||
(setq-default pdf-view-display-size 'fit-width)
|
||
#+end_src
|
||
**** PDF view restore
|
||
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-extra.el
|
||
(usr-package-install 'pdf-view-restore)
|
||
(add-hook 'pdf-view-mode-hook #'pdf-view-restore-mode)
|
||
(setq pdf-view-restore-filename (expand-file-name ".tmp/pdf-view-restore"
|
||
user-emacs-directory))
|
||
#+end_src
|
||
**** Nov
|
||
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-extra.el
|
||
(usr-package-install 'nov)
|
||
(add-to-list 'auto-mode-alist '("\\.epub\\'" . nov-mode))
|
||
#+end_src
|
||
**** Openwith
|
||
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-extra.el
|
||
(usr-package-install 'openwith)
|
||
(setq larget-file-warning-threshold nil)
|
||
(openwith-mode t)
|
||
(setq openwith-associations
|
||
(list (list (openwith-make-extension-regexp
|
||
'("mpg" "mpeg" "mp3" "mp4" "m4v"
|
||
"avi" "wmv" "wav" "mov" "flv"
|
||
"ogm" "ogg" "mkv"))
|
||
"mpv"
|
||
'(file))))
|
||
;;(list (openwith-make-extension-regexp
|
||
;; '("html" "htm"))
|
||
;; "qutebrowser"
|
||
;; '(file))))
|
||
#+end_src
|
||
**** Calfw
|
||
calendar
|
||
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-extra.el
|
||
(usr-package-install 'calfw)
|
||
(usr-package-install 'calfw-org)
|
||
#+end_src
|
||
**** ELFEED
|
||
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-extra.el
|
||
(usr-package-install 'elfeed)
|
||
(usr-package-install 'elfeed-goodies)
|
||
(usr-package-install 'elfeed-org)
|
||
|
||
(require 'elfeed-org)
|
||
(elfeed-org)
|
||
(setq rmh-elfeed-org-files (list "~/org/elfeed.org"))
|
||
#+end_src
|
||
**** Provide Modules
|
||
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-extra.el
|
||
(provide 'custom-extra)
|
||
;;; custom-extra.el ends here
|
||
#+end_src
|
||
|
||
*** Languages
|
||
**** Default
|
||
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-languages.el
|
||
(with-eval-after-load 'org
|
||
(org-babel-do-load-languages
|
||
'org-babel-load-languages
|
||
'((emacs-lisp . t)
|
||
(python . t)
|
||
(dot . t)
|
||
(latex . t)))
|
||
(push '("conf-unix" . conf-unix) org-src-lang-modes)
|
||
;; This is needed as of Org 9.2
|
||
(require 'org-tempo)
|
||
|
||
(add-to-list 'org-structure-template-alist '("sh" . "src shell"))
|
||
(add-to-list 'org-structure-template-alist '("el" . "src emacs-lisp"))
|
||
(add-to-list 'org-structure-template-alist '("hs" . "src haskell"))
|
||
(add-to-list 'org-structure-template-alist '("cc" . "src c"))
|
||
(add-to-list 'org-structure-template-alist '("cp" . "src c++"))
|
||
(add-to-list 'org-structure-template-alist '("rs" . "src rust"))
|
||
(add-to-list 'org-structure-template-alist '("py" . "src python"))
|
||
(add-to-list 'org-structure-template-alist '("oc" . "src octave"))
|
||
(add-to-list 'org-structure-template-alist '("vl" . "src verilog"))
|
||
(add-to-list 'org-structure-template-alist '("vh" . "src vhdl"))
|
||
(org-reload))
|
||
#+end_src
|
||
**** Treesitter
|
||
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-languages.el
|
||
(if (version< emacs-version "29")
|
||
(progn
|
||
(usr-package-install 'tree-sitter)
|
||
(usr-package-install 'tree-sitter-langs)
|
||
(require 'tree-sitter)
|
||
(global-tree-sitter-mode)))
|
||
#+end_src
|
||
**** eglot
|
||
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-languages.el
|
||
(if (version< emacs-version "29")
|
||
(usr-package-install 'eglot))
|
||
#+end_src
|
||
**** Rust
|
||
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-languages.el
|
||
(usr-package-install 'rust-mode)
|
||
#+end_src
|
||
**** Python
|
||
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-languages.el
|
||
(usr-package-install 'jupyter)
|
||
(setq org-babel-jupyter-override-src-block "python")
|
||
#+end_src
|
||
**** CMAKE
|
||
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-languages.el
|
||
(usr-package-install 'cmake-mode)
|
||
#+end_src
|
||
|
||
**** Haskell
|
||
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-languages.el
|
||
(usr-package-install 'haskell-mode)
|
||
#+end_src
|
||
**** Markdown
|
||
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-languages.el
|
||
(usr-package-install 'markdown-mode)
|
||
(add-to-list 'auto-mode-alist '("README\\.md\\'" . gfm-mode))
|
||
(add-to-list 'auto-mode-alist '("\\.md\\'" . markdown-mode))
|
||
(add-to-list 'auto-mode-alist '("\\.markdown\\'" . markdown-mode))
|
||
(setq markdown-command "multimarkdown")
|
||
#+end_src
|
||
**** PKGBUILD
|
||
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-languages.el
|
||
(usr-package-install 'pkgbuild-mode)
|
||
;;(phundrak/major-leader-key
|
||
;; :keymaps 'pkgbuild-mode-map
|
||
;; "c" #'pkgbuild-syntax-check
|
||
;; "i" #'pkgbuild-initialize
|
||
;; "I" #'pkgbuild-increase-release-tag
|
||
;; "m" #'pkgbuild-makepkg
|
||
;; "u" '(:ignore :wk "update")
|
||
;; "us" #'pkgbuild-update-sums-line
|
||
;; "uS" #'pkgbuild-update-srcinfo))
|
||
#+end_src
|
||
**** Systemd
|
||
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-languages.el
|
||
(usr-package-install 'systemd)
|
||
#+end_src
|
||
**** Toml
|
||
#+begin_src emacs-lisp
|
||
(usr-package-install 'toml-mode)
|
||
(add-to-list 'auto-mode-alist '("/\\(Cargo.lock\\|\\.cargo/config\\)\\'" . toml-mode))
|
||
#+end_src
|
||
|
||
**** Gnuplot
|
||
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-languages.el
|
||
(usr-package-install 'gnuplot)
|
||
#+end_src
|
||
**** Graphviz dot Mode
|
||
org mode graph drawing with graphviz
|
||
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-languages.el
|
||
(usr-package-install 'graphviz-dot-mode)
|
||
#+end_src
|
||
**** Verilog Indent
|
||
LSP -> veriloter
|
||
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-languages.el
|
||
(custom-set-variables
|
||
'(verilog-indent-level 4)
|
||
'(verilog-indent-level-module 0)
|
||
'(verilog-indent-level-declaration 0)
|
||
'(verilog-indent-level-behavioral 0)
|
||
'(verilog-indent-level-directive 0)
|
||
'(verilog-cexp-indent 0)
|
||
'(verilog-case-indent 4)
|
||
|
||
'(verilog-auto-newline nil))
|
||
#+end_src
|
||
**** Provide modules
|
||
#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-languages.el
|
||
(provide 'custom-languages)
|
||
;;; custom-languages.el ends here
|
||
#+end_src
|