341 lines
14 KiB
EmacsLisp
341 lines
14 KiB
EmacsLisp
(beacon-mode 1)
|
|
|
|
(map! :leader
|
|
(:prefix ("b". "buffer")
|
|
:desc "List bookmarks" "L" #'list-bookmarks
|
|
:desc "Save current bookmarks to bookmark file" "w" #'bookmark-save))
|
|
|
|
(global-auto-revert-mode 1)
|
|
(setq global-auto-revert-non-file-buffers t)
|
|
|
|
(evil-define-key 'normal ibuffer-mode-map
|
|
(kbd "f c") 'ibuffer-filter-by-content
|
|
(kbd "f d") 'ibuffer-filter-by-directory
|
|
(kbd "f f") 'ibuffer-filter-by-filename
|
|
(kbd "f m") 'ibuffer-filter-by-mode
|
|
(kbd "f n") 'ibuffer-filter-by-name
|
|
(kbd "f x") 'ibuffer-filter-disable
|
|
(kbd "g h") 'ibuffer-do-kill-lines
|
|
(kbd "g H") 'ibuffer-update)
|
|
|
|
;; https://stackoverflow.com/questions/9547912/emacs-calendar-show-more-than-3-months
|
|
(defun drk/year-calendar (&optional year)
|
|
(interactive)
|
|
(require 'calendar)
|
|
(let* (
|
|
(current-year (number-to-string (nth 5 (decode-time (current-time)))))
|
|
(month 0)
|
|
(year (if year year (string-to-number (format-time-string "%Y" (current-time))))))
|
|
(switch-to-buffer (get-buffer-create calendar-buffer))
|
|
(when (not (eq major-mode 'calendar-mode))
|
|
(calendar-mode))
|
|
(setq displayed-month month)
|
|
(setq displayed-year year)
|
|
(setq buffer-read-only nil)
|
|
(erase-buffer)
|
|
;; horizontal rows
|
|
(dotimes (j 4)
|
|
;; vertical columns
|
|
(dotimes (i 3)
|
|
(calendar-generate-month
|
|
(setq month (+ month 1))
|
|
year
|
|
;; indentation / spacing between months
|
|
(+ 5 (* 25 i))))
|
|
(goto-char (point-max))
|
|
(insert (make-string (- 10 (count-lines (point-min) (point-max))) ?\n))
|
|
(widen)
|
|
(goto-char (point-max))
|
|
(narrow-to-region (point-max) (point-max)))
|
|
(widen)
|
|
(goto-char (point-min))
|
|
(setq buffer-read-only t)))
|
|
|
|
(defun drk/scroll-year-calendar-forward (&optional arg event)
|
|
"Scroll the yearly calendar by year in a forward direction."
|
|
(interactive (list (prefix-numeric-value current-prefix-arg)
|
|
last-nonmenu-event))
|
|
(unless arg (setq arg 0))
|
|
(save-selected-window
|
|
(if (setq event (event-start event)) (select-window (posn-window event)))
|
|
(unless (zerop arg)
|
|
(let* (
|
|
(year (+ displayed-year arg)))
|
|
(drk/year-calendar year)))
|
|
(goto-char (point-min))
|
|
(run-hooks 'calendar-move-hook)))
|
|
|
|
(defun drk/scroll-year-calendar-backward (&optional arg event)
|
|
"Scroll the yearly calendar by year in a backward direction."
|
|
(interactive (list (prefix-numeric-value current-prefix-arg)
|
|
last-nonmenu-event))
|
|
(drk/scroll-year-calendar-forward (- (or arg 1)) event))
|
|
|
|
(map! :leader
|
|
:desc "Scroll year calendar backward" "<left>" #'drk/scroll-year-calendar-backward
|
|
:desc "Scroll year calendar forward" "<right>" #'drk/scroll-year-calendar-forward)
|
|
|
|
(defalias 'year-calendar 'drk/year-calendar)
|
|
|
|
(map! :leader
|
|
(:prefix ("c h" . "Help info from Clippy")
|
|
:desc "Clippy describes function under point" "f" #'clippy-describe-function
|
|
:desc "Clippy describes variable under point" "v" #'clippy-describe-variable))
|
|
|
|
(require 'dap-netcore)
|
|
(require 'dap-dlv-go)
|
|
(map! :leader
|
|
(:prefix ("d" . "dap-mode")
|
|
:desc "Toggle breakpoint" "t" #'dap-breakpoint-toggle
|
|
:desc "Continue execution" "c" #'dap-continue
|
|
:desc "Step in" "n" #'dap-step-in
|
|
:desc "Step out" "N" #'dap-step-out
|
|
:desc "See all breakpoints" "b" #'dap-ui-breakpoints-toggle
|
|
:desc "Change variable value" "s" #'dap-ui-set-variable-value
|
|
:desc "Evaluate expression at point" "e" #'dap-eval-thing-at-point
|
|
:desc "Evaluate expression" "E" #'dap-eval
|
|
:desc "Run debugger" "r" #'dap-debug
|
|
:desc "Restart debugger" "R" #'dap-debug-restart
|
|
:desc "Stop debugger" "d" #'dap-disconnect))
|
|
(use-package dap-mode
|
|
:init
|
|
(dap-auto-configure-mode)
|
|
|
|
:custom
|
|
(dap-netcore-download-url "https://github.com/Samsung/netcoredbg/releases/download/3.1.0-1031/netcoredbg-linux-amd64.tar.gz"))
|
|
|
|
;; With dired-open plugin, you can launch external programs for certain
|
|
;; extensions For example, I set all .png files to open in 'vimiv' and all .mp4
|
|
;; files to open in 'mpv'
|
|
(setq dired-open-extensions '(("gif" . "vimiv")
|
|
("jpg" . "vimiv")
|
|
("png" . "vimiv")
|
|
("mkv" . "mpv")
|
|
("mp3" . "mpv")
|
|
("mp4" . "mpv")))
|
|
|
|
(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)
|
|
|
|
(setq delete-by-moving-to-trash t
|
|
trash-directory "~/.local/share/Trash/files/")
|
|
|
|
(setq doom-theme 'doom-gruvbox)
|
|
(map! :leader
|
|
:desc "Load new theme" "h t" #'load-theme)
|
|
|
|
(use-package emojify
|
|
:hook (after-init . global-emojify-mode))
|
|
|
|
(setq doom-font (font-spec :family "Mononoki Nerd Font" :size 18)
|
|
doom-variable-pitch-font (font-spec :family "Mononoki Nerd Font" :size 18)
|
|
doom-big-font (font-spec :family "Mononoki Nerd Font" :size 24))
|
|
(after! doom-themes
|
|
(setq doom-themes-enable-bold t
|
|
doom-themes-enable-italic t))
|
|
(custom-set-faces!
|
|
'(font-lock-comment-face :slant italic)
|
|
'(font-lock-keyword-face :slant italic))
|
|
|
|
(defun drk/insert-todays-date (prefix)
|
|
(interactive "P")
|
|
(let ((format (cond
|
|
((not prefix) "%A, %B %d, %Y")
|
|
((equal prefix '(4)) "%m-%d-%Y")
|
|
((equal prefix '(16)) "%Y-%m-%d"))))
|
|
(insert (format-time-string format))))
|
|
|
|
(require 'calendar)
|
|
(defun drk/insert-any-date (date)
|
|
"Insert DATE using the current locale."
|
|
(interactive (list (calendar-read-date)))
|
|
(insert (calendar-date-string date)))
|
|
|
|
(map! :leader
|
|
(:prefix ("i d" . "Insert date")
|
|
:desc "Insert any date" "a" #'drk/insert-any-date
|
|
:desc "Insert todays date" "t" #'drk/insert-todays-date))
|
|
|
|
(setq ivy-posframe-display-functions-alist
|
|
'((swiper . ivy-posframe-display-at-point)
|
|
(complete-symbol . ivy-posframe-display-at-point)
|
|
(counsel-M-x . ivy-display-function-fallback)
|
|
(counsel-esh-history . ivy-posframe-display-at-window-center)
|
|
(counsel-describe-function . ivy-display-function-fallback)
|
|
(counsel-describe-variable . ivy-display-function-fallback)
|
|
(counsel-find-file . ivy-display-function-fallback)
|
|
(counsel-recentf . ivy-display-function-fallback)
|
|
(counsel-register . ivy-posframe-display-at-frame-bottom-window-center)
|
|
(dmenu . ivy-posframe-display-at-frame-top-center)
|
|
(nil . ivy-posframe-display))
|
|
ivy-posframe-height-alist
|
|
'((swiper . 20)
|
|
(dmenu . 20)
|
|
(t . 10)))
|
|
(ivy-posframe-mode 1) ; 1 enables posframe-mode, 0 disables it.
|
|
|
|
(map! :leader
|
|
(:prefix ("v" . "Ivy")
|
|
:desc "Ivy push view" "v p" #'ivy-push-view
|
|
:desc "Ivy switch view" "v s" #'ivy-switch-view))
|
|
|
|
(setq display-line-numbers-type t)
|
|
(map! :leader
|
|
:desc "Comment or uncomment lines" "TAB TAB" #'comment-line
|
|
(:prefix ("t" . "toggle")
|
|
:desc "Toggle line numbers" "l" #'doom/toggle-line-numbers
|
|
:desc "Toggle line highlight in frame" "h" #'hl-line-mode
|
|
:desc "Toggle line highlight globally" "H" #'global-hl-line-mode
|
|
:desc "Toggle truncate lines" "t" #'toggle-truncate-lines))
|
|
|
|
(add-hook 'csharp-mode-hook #'lsp-deferred)
|
|
|
|
(add-hook 'go-mode-hook #'lsp-deferred)
|
|
|
|
(add-hook 'rust-mode-hook #'lsp-deferred)
|
|
|
|
(custom-set-faces
|
|
'(markdown-header-face ((t (:inherit font-lock-function-name-face :weight bold :family "Mononoki Nerd Font"))))
|
|
'(markdown-header-face-1 ((t (:inherit markdown-header-face :height 1.7))))
|
|
'(markdown-header-face-2 ((t (:inherit markdown-header-face :height 1.6))))
|
|
'(markdown-header-face-3 ((t (:inherit markdown-header-face :height 1.5))))
|
|
'(markdown-header-face-4 ((t (:inherit markdown-header-face :height 1.4))))
|
|
'(markdown-header-face-5 ((t (:inherit markdown-header-face :height 1.3))))
|
|
'(markdown-header-face-6 ((t (:inherit markdown-header-face :height 1.2)))))
|
|
|
|
(set-face-attribute 'mode-line nil :font "Mononoki Nerd Font-14")
|
|
(setq doom-modeline-height 30 ;; sets modeline height
|
|
doom-modeline-bar-width 5 ;; sets right bar width
|
|
doom-modeline-persp-name t ;; adds perspective name to modeline
|
|
doom-modeline-persp-icon t) ;; adds folder icon next to persp name
|
|
|
|
(xterm-mouse-mode 1)
|
|
|
|
(map! :leader
|
|
:desc "Toggle neotree" "e" #'neotree-toggle)
|
|
(setq neo-theme 'nerd)
|
|
(setq neo-smart-open t)
|
|
(setq projectile-switch-project-action 'neotree-projectile-action)
|
|
|
|
(map! :leader
|
|
(:prefix ("=" . "open file")
|
|
:desc "Edit agenda file" "a" #'(lambda () (interactive) (find-file "~/org/agenda.org"))
|
|
:desc "Edit doom config.org" "c" #'(lambda () (interactive) (find-file "~/.config/doom/config.org"))
|
|
:desc "Edit doom init.el" "i" #'(lambda () (interactive) (find-file "~/.config/doom/init.el"))
|
|
:desc "Edit doom packages.el" "p" #'(lambda () (interactive) (find-file "~/.config/doom/packages.el"))))
|
|
|
|
(map! :leader
|
|
:desc "Org babel tangle" "m B" #'org-babel-tangle)
|
|
(after! org
|
|
(setq org-directory "~/org/"
|
|
org-agenda-files '("~/org/agenda.org")
|
|
org-default-notes-file (expand-file-name "notes.org" org-directory)
|
|
org-ellipsis " ▼ "
|
|
org-superstar-headline-bullets-list '("◉" "●" "○" "◆" "●" "○" "◆")
|
|
org-superstar-item-bullet-alist '((?+ . ?➤) (?- . ?✦)) ; changes +/- symbols in item lists
|
|
org-log-done 'time
|
|
org-hide-emphasis-markers t
|
|
;; ex. of org-link-abbrev-alist in action
|
|
;; [[arch-wiki:Name_of_Page][Description]]
|
|
org-link-abbrev-alist ; This overwrites the default Doom org-link-abbrev-list
|
|
'(("google" . "http://www.google.com/search?q=")
|
|
("arch-wiki" . "https://wiki.archlinux.org/index.php/")
|
|
("ddg" . "https://duckduckgo.com/?q=")
|
|
("wiki" . "https://en.wikipedia.org/wiki/"))
|
|
org-todo-keywords ; This overwrites the default Doom org-todo-keywords
|
|
'((sequence
|
|
"TODO(t)" ; A task that is ready to be tackled
|
|
"BLOG(b)" ; Blog writing assignments
|
|
"GYM(g)" ; Things to accomplish at the gym
|
|
"GAME(j)" ; Things to accomplish at the gym
|
|
"PROJ(p)" ; A project that contains other tasks
|
|
"VIDEO(v)" ; Video assignments
|
|
"WAIT(w)" ; Something is holding up this task
|
|
"|" ; The pipe necessary to separate "active" states and "inactive" states
|
|
"DONE(d)" ; Task has been completed
|
|
"CANCELLED(c)" )))) ; Task has been cancelled
|
|
(setq org-agenda-custom-commands
|
|
'(("p" "Priority view"
|
|
((tags "PRIORITY=\"A\""
|
|
((org-agenda-skip-function '(org-agenda-skip-entry-if 'todo 'done))
|
|
(org-agenda-overriding-header "High priority unfinished tasks:")))
|
|
(tags "PRIORITY=\"B\""
|
|
((org-agenda-skip-function '(org-agenda-skip-entry-if 'todo 'done))
|
|
(org-agenda-overriding-header "Medium priority unfinished tasks:")))
|
|
(tags "PRIORITY=\"C\""
|
|
((org-agenda-skip-function '(org-agenda-skip-entry-if 'todo 'done))
|
|
(org-agenda-overriding-header "Low priority unfinished tasks:")))))
|
|
("i" "INTEC view"
|
|
((tags "homeworks"
|
|
((org-agenda-skip-function '(org-agenda-skip-entry-if 'todo 'done))
|
|
(org-agenda-overriding-header "Pending homeworks:")))
|
|
(tags "studies"
|
|
((org-agenda-skip-function '(org-agenda-skip-entry-if 'todo 'done))
|
|
(org-agenda-overriding-header "Pending studies:")))
|
|
(tags "exam"
|
|
((org-agenda-skip-function '(org-agenda-skip-entry-if 'todo 'done))
|
|
(org-agenda-overriding-header "Pending exams:")))))
|
|
))
|
|
|
|
(setq
|
|
org-agenda-block-separator 985827
|
|
org-fancy-priorities-list '("" "" "")
|
|
org-priority-faces
|
|
'((?A :foreground "#fb4934" :weight bold)
|
|
(?B :foreground "#fabd2f" :weight bold)
|
|
(?C :foreground "#83a598" :weight bold)))
|
|
|
|
(setq org-publish-use-timestamps-flag nil)
|
|
(setq org-export-with-broken-links t)
|
|
|
|
(use-package! org-auto-tangle
|
|
:defer t
|
|
:hook (org-mode . org-auto-tangle-mode)
|
|
:config
|
|
(setq org-auto-tangle-default t))
|
|
|
|
(define-globalized-minor-mode global-rainbow-mode rainbow-mode
|
|
(lambda () (rainbow-mode 1)))
|
|
(global-rainbow-mode 1 )
|
|
|
|
(map! :leader
|
|
(:prefix ("r" . "registers")
|
|
:desc "Copy to register" "c" #'copy-to-register
|
|
:desc "Frameset to register" "f" #'frameset-to-register
|
|
:desc "Insert contents of register" "i" #'insert-register
|
|
:desc "Jump to register" "j" #'jump-to-register
|
|
:desc "List registers" "l" #'list-registers
|
|
:desc "Number to register" "n" #'number-to-register
|
|
:desc "Interactively choose a register" "r" #'counsel-register
|
|
:desc "View a register" "v" #'view-register
|
|
:desc "Window configuration to register" "w" #'window-configuration-to-register
|
|
:desc "Increment register" "+" #'increment-register
|
|
:desc "Point to register" "SPC" #'point-to-register))
|
|
|
|
(setq shell-file-name "/bin/bash"
|
|
vterm-max-scrollback 5000)
|
|
(map! :leader
|
|
:desc "Vterm popup toggle" "v t" #'+vterm/toggle)
|
|
|
|
(defun prefer-horizontal-split ()
|
|
(set-variable 'split-height-threshold nil t)
|
|
(set-variable 'split-width-threshold 40 t)) ; make this as low as needed
|
|
(add-hook 'markdown-mode-hook 'prefer-horizontal-split)
|
|
(map! :leader
|
|
:desc "Clone indirect buffer other window" "b c" #'clone-indirect-buffer-other-window)
|
|
|
|
(map! :leader
|
|
(:prefix ("w" . "window")
|
|
:desc "Winner redo" "<right>" #'winner-redo
|
|
:desc "Winner undo" "<left>" #'winner-undo))
|
|
|
|
(map! :leader
|
|
:desc "Zap to char" "z" #'zap-to-char
|
|
:desc "Zap up to char" "Z" #'zap-up-to-char)
|
|
|
|
(set-frame-parameter nil 'alpha-background 95) ; For current frame
|
|
(add-to-list 'default-frame-alist '(alpha-background . 95)) ; For all new frames henceforth
|
|
(when (daemonp)
|
|
(exec-path-from-shell-initialize))
|