diff options
author | JozanLeClerc <bousset.rudy@gmail.com> | 2020-12-05 16:16:37 +0100 |
---|---|---|
committer | JozanLeClerc <bousset.rudy@gmail.com> | 2020-12-05 16:16:37 +0100 |
commit | cb45cf1a28641474a3302740cfc1ee4bdeca4a4a (patch) | |
tree | 8590fda136fd1f26b17ae95b8892c1529def16a5 /.config/emacs/org/config.org | |
parent | Removed urlview, added CDE config (diff) | |
download | dotfiles-bsd-cb45cf1a28641474a3302740cfc1ee4bdeca4a4a.tar.gz dotfiles-bsd-cb45cf1a28641474a3302740cfc1ee4bdeca4a4a.tar.bz2 dotfiles-bsd-cb45cf1a28641474a3302740cfc1ee4bdeca4a4a.tar.xz dotfiles-bsd-cb45cf1a28641474a3302740cfc1ee4bdeca4a4a.tar.zst dotfiles-bsd-cb45cf1a28641474a3302740cfc1ee4bdeca4a4a.zip |
Emacs update
Diffstat (limited to '.config/emacs/org/config.org')
-rw-r--r-- | .config/emacs/org/config.org | 306 |
1 files changed, 171 insertions, 135 deletions
diff --git a/.config/emacs/org/config.org b/.config/emacs/org/config.org index 7d15587..650c1c9 100644 --- a/.config/emacs/org/config.org +++ b/.config/emacs/org/config.org @@ -1,32 +1,32 @@ * My emacs config ** Basic configs #+BEGIN_SRC emacs-lisp -(setq x-alt-keysym 'meta) -(set-keyboard-coding-system 'utf-8) - -(menu-bar-mode -1) -(tool-bar-mode -1) -(scroll-bar-mode -1) -(blink-cursor-mode 0) - -(set-frame-font "mononoki Nerd Font:pixelsize=15" nil t) -(add-hook 'prog-mode-hook 'display-line-numbers-mode) -(add-hook 'text-mode-hook 'display-line-numbers-mode) - -(setq scroll-step 1) -;; (setq scroll-margin 1) -(setq echo-keystrokes 0.1) -(setq initial-scratch-message nil) -(defalias 'yes-or-no-p 'y-or-n-p) - -(setq backup-directory-alist '(("." . "~/.config/emacs/backup")) - backup-by-copying t - version-control t - delete-old-versions t - kept-new-versions 20 - kept-old-versions 5) - -(server-start) + (setq x-alt-keysym 'meta) + (set-keyboard-coding-system 'utf-8) + + (menu-bar-mode -1) + (tool-bar-mode -1) + (scroll-bar-mode -1) + (blink-cursor-mode 0) + + (set-frame-font "mononoki Nerd Font:pixelsize=15" nil t) + (add-hook 'prog-mode-hook 'display-line-numbers-mode) + (add-hook 'text-mode-hook 'display-line-numbers-mode) + + (setq scroll-step 1) + ;; (setq scroll-margin 1) + (setq echo-keystrokes 0.1) + (setq initial-scratch-message nil) + (defalias 'yes-or-no-p 'y-or-n-p) + + (setq backup-directory-alist '(("." . "~/.config/emacs/backup")) + backup-by-copying t + version-control t + delete-old-versions t + kept-new-versions 20 + kept-old-versions 5) + + (server-start) #+END_SRC ** MELPA and non-MELPA @@ -54,62 +54,64 @@ ** Some org #+BEGIN_SRC emacs-lisp -;; set key for agenda -(require 'org) -(global-set-key (kbd "C-c a") 'org-agenda) - -;;file to save todo items -(setq org-agenda-files (quote ("~/.config/emacs/org/todo.org"))) -(setq org-log-done 'time) - -;;set priority range from A to C with default A -(setq org-highest-priority ?A) -(setq org-lowest-priority ?C) -(setq org-default-priority ?A) - -;;set colours for priorities -(setq org-priority-faces '((?A . (:foreground "#F0DFAF" :weight bold)) - (?B . (:foreground "LightSteelBlue")) - (?C . (:foreground "OliveDrab")))) - -;;open agenda in current window -(setq org-agenda-window-setup (quote current-window)) - -;;capture todo items using C-c C-t t -(define-key global-map (kbd "C-c C-t") 'org-capture) -(setq org-capture-templates - '(("t" "todo" entry (file+headline "/home/jozan/.config/emacs/org/todo.org" "Tasks") - "* TODO [#A] %?\nSCHEDULED: %(org-insert-time-stamp (org-read-date nil t \"+0d\"))\n"))) - -;;open agenda in current window -(setq org-agenda-window-setup (quote current-window)) -;;warn me of any deadlines in next 7 days -(setq org-deadline-warning-days 7) -;;show me tasks scheduled or due in next fortnight -(setq org-agenda-span (quote fortnight)) -;;don't show tasks as scheduled if they are already shown as a deadline -(setq org-agenda-skip-scheduled-if-deadline-is-shown t) -;;don't give awarning colour to tasks with impending deadlines -;;if they are scheduled to be done -(setq org-agenda-skip-deadline-prewarning-if-scheduled (quote pre-scheduled)) -;;don't show tasks that are scheduled or have deadlines in the -;;normal todo list -(setq org-agenda-todo-ignore-deadlines (quote all)) -(setq org-agenda-todo-ignore-scheduled (quote all)) -;;sort tasks in order of when they are due and then by priority -(setq org-agenda-sorting-strategy - (quote - ((agenda deadline-up priority-down) - (todo priority-down category-keep) - (tags priority-down category-keep) - (search category-keep)))) - -(org-babel-do-load-languages - 'org-babel-load-languages '((C . t ))) -(org-babel-do-load-languages - 'org-babel-load-languages '((lisp . t))) - (eval-after-load "org" - '(require 'ox-md nil t)) + ;; set key for agenda + ;; (require 'org) + ;; (global-set-(kbd "C-c a") 'org-agenda) + + ;;file to save todo items + ;; (setq org-agenda-files (quote ("~/.config/emacs/org/todo.org"))) + (setq org-log-done 'time) + + ;;set priority range from A to C with default A + (setq org-highest-priority ?A) + (setq org-lowest-priority ?C) + (setq org-default-priority ?A) + + ;;set colours for priorities + (setq org-priority-faces '((?A . (:foreground "#F0DFAF" :weight bold)) + (?B . (:foreground "LightSteelBlue")) + (?C . (:foreground "OliveDrab")))) + + (setq org-log-done 'time) + + ;;open agenda in current window + ;; (setq org-agenda-window-setup (quote current-window)) + + ;;capture todo items using C-c C-t t + ;; (define-key global-map (kbd "C-c C-t") 'org-capture) + ;; (setq org-capture-templates + ;; '(("t" "todo" entry (file+headline "/home/jozan/.config/emacs/org/todo.org" "Tasks") + ;; "* TODO [#A] %?\nSCHEDULED: %(org-insert-time-stamp (org-read-date nil t \"+0d\"))\n"))) + + ;;open agenda in current window + ;; (setq org-agenda-window-setup (quote current-window)) + ;;warn me of any deadlines in next 7 days + ;; (setq org-deadline-warning-days 7) + ;;show me tasks scheduled or due in next fortnight + ;; (setq org-agenda-span (quote fortnight)) + ;;don't show tasks as scheduled if they are already shown as a deadline + ;; (setq org-agenda-skip-scheduled-if-deadline-is-shown t) + ;;don't give awarning colour to tasks with impending deadlines + ;;if they are scheduled to be done + ;; (setq org-agenda-skip-deadline-prewarning-if-scheduled (quote pre-scheduled)) + ;;don't show tasks that are scheduled or have deadlines in the + ;;normal todo list + ;; (setq org-agenda-todo-ignore-deadlines (quote all)) + ;; (setq org-agenda-todo-ignore-scheduled (quote all)) + ;;sort tasks in order of when they are due and then by priority + ;; (setq org-agenda-sorting-strategy + ;; (quote + ;; ((agenda deadline-up priority-down) + ;; (todo priority-down category-keep) + ;; (tags priority-down category-keep) + ;; (search category-keep)))) + + (org-babel-do-load-languages + 'org-babel-load-languages '((C . t ))) + (org-babel-do-load-languages + 'org-babel-load-languages '((lisp . t))) + (eval-after-load "org" + '(require 'ox-md nil t)) #+END_SRC ** Core packages @@ -160,7 +162,19 @@ (evilnc-default-hotkeys) #+END_SRC -*** Vimish Fold +*** Evil surround +#+BEGIN_SRC emacs-lisp + (require 'evil-surround) + (global-evil-surround-mode 1) +#+END_SRC + +*** Evil multiple-cursor +#+BEGIN_SRC emacs-lisp + (require 'evil-mc) + (global-evil-mc-mode 1) +#+END_SRC + +*** Evil vimish Fold #+BEGIN_SRC emacs-lisp (require 'vimish-fold) (require 'evil-vimish-fold) @@ -168,6 +182,13 @@ (add-hook 'text-mode-hook 'evil-vimish-fold-mode) #+END_SRC +*** Evil numbers +#+BEGIN_SRC emacs-lisp + (require 'evil-numbers) + (define-key evil-normal-state-map (kbd "C-c a") 'evil-numbers/inc-at-pt) + (define-key evil-normal-state-map (kbd "C-c x") 'evil-numbers/dec-at-pt) +#+END_SRC + *** Centaur tabs #+BEGIN_SRC emacs-lisp (require 'centaur-tabs) @@ -240,14 +261,6 @@ (add-to-list 'evil-emacs-state-modes 'dashboard-mode) #+END_SRC -*** Golden ratio -#+BEGIN_SRC emacs-lisp -;; (require 'golden-ratio) -;; (golden-ratio-mode 1) -;; (setq golden-ratio-adjust-factor .9 -;; golden-ratio-wide-adjust-factor .9) -#+END_SRC - *** w3m #+BEGIN_SRC emacs-lisp (require 'w3m-load) @@ -354,7 +367,6 @@ (setq doom-modeline-github nil) (setq doom-modeline-github-interval (* 30 60)) (setq doom-modeline-modal-icon t) -(setq doom-modeline-mu4e t) (setq doom-modeline-gnus nil) (setq doom-modeline-irc t) (setq doom-modeline-irc-stylize 'identity) @@ -376,11 +388,11 @@ *** Colors and rainbows #+BEGIN_SRC emacs-lisp -(require 'color-identifiers-mode) -(global-color-identifiers-mode) +;; (require 'color-identifiers-mode) +;; (global-color-identifiers-mode) -(require 'rainbow-delimiters) -(add-hook 'prog-mode-hook 'rainbow-delimiters-mode) +;; (require 'rainbow-delimiters) +;; (add-hook 'prog-mode-hook 'rainbow-delimiters-mode) #+END_SRC *** C default style @@ -423,13 +435,6 @@ Attribution: URL `https://manuel-uberti.github.io/emacs/2018/02/17/magit-bury-bu (evil-define-key 'normal magit-status-mode-map (kbd "q") #'my/magit-kill-buffers) #+END_SRC -*** Ranger -#+BEGIN_SRC emacs-lisp -(require 'ranger) -(ranger-override-dired-mode t) -(add-hook 'dired-mode-hook 'auto-revert-mode) -#+END_SRC - *** Lock windows #+BEGIN_SRC emacs-lisp (defun my/toggle-window-dedicated () @@ -505,14 +510,6 @@ then it takes a second \\[keyboard-quit] to abort the minibuffer." (add-hook 'dired-mode-hook 'all-the-icons-dired-mode) #+END_SRC -*** minugs -#+BEGIN_SRC emacs-lisp -(require 'mingus) -(add-to-list 'evil-emacs-state-modes 'mingus-help-mode) -(add-to-list 'evil-emacs-state-modes 'mingus-playlist-mode) -(add-to-list 'evil-emacs-state-modes 'mingus-browse-mode) -#+END_SRC - *** which-key #+BEGIN_SRC emacs-lisp (require 'which-key) @@ -526,16 +523,16 @@ then it takes a second \\[keyboard-quit] to abort the minibuffer." (quote ("ansi-term" "*ansi-term*" (lambda nil - (ansi-term shell-pop-term-shell))))) + (vterm))))) -(setq shell-pop-term-shell "/usr/local/bin/zsh") +;; (setq shell-pop-term-shell "/usr/local/bin/zsh") (add-to-list 'evil-emacs-state-modes 'term-mode) #+END_SRC -*** org-bullets +*** org-superstar #+BEGIN_SRC emacs-lisp -(require 'org-bullets) -(add-hook 'org-mode-hook (lambda () (org-bullets-mode 1))) +(require 'org-superstar) +(add-hook 'org-mode-hook (lambda () (org-superstar-mode 1))) #+END_SRC *** toc-org @@ -583,6 +580,63 @@ then it takes a second \\[keyboard-quit] to abort the minibuffer." (setq company-backends (mapcar #'company-mode/backend-with-yas company-backends)) #+END_SRC +*** lsp, ccls +#+BEGIN_SRC emacs-lisp + (require 'lsp-mode) + (require 'lsp-ui) + (require 'company-lsp) + (require 'ccls) + (add-hook 'c-mode-hook (lambda () (lsp))) + (add-hook 'c++-mode-hook (lambda () (lsp))) + (add-hook 'objc-mode-hook (lambda () (lsp))) + (add-hook 'cuda-mode-hook (lambda () (lsp))) + (setq ccls-executable "/usr/local/bin/ccls") + + (defun ccls/callee () (interactive) (lsp-ui-peek-find-custom "$ccls/call" '(:callee t))) + (defun ccls/caller () (interactive) (lsp-ui-peek-find-custom "$ccls/call")) + (defun ccls/vars (kind) (lsp-ui-peek-find-custom "$ccls/vars" `(:kind ,kind))) + (defun ccls/base (levels) (lsp-ui-peek-find-custom "$ccls/inheritance" `(:levels ,levels))) + (defun ccls/derived (levels) (lsp-ui-peek-find-custom "$ccls/inheritance" `(:levels ,levels :derived t))) + (defun ccls/member (kind) (interactive) (lsp-ui-peek-find-custom "$ccls/member" `(:kind ,kind))) + + ;; References w/ Role::Role + (defun ccls/references-read () (interactive) + (lsp-ui-peek-find-custom "textDocument/references" + (plist-put (lsp--text-document-position-params) :role 8))) + + ;; References w/ Role::Write + (defun ccls/references-write () + (interactive) + (lsp-ui-peek-find-custom "textDocument/references" + (plist-put (lsp--text-document-position-params) :role 16))) + + ;; References w/ Role::Dynamic bit (macro expansions) + (defun ccls/references-macro () (interactive) + (lsp-ui-peek-find-custom "textDocument/references" + (plist-put (lsp--text-document-position-params) :role 64))) + + ;; References w/o Role::Call bit (e.g. where functions are taken addresses) + (defun ccls/references-not-call () (interactive) + (lsp-ui-peek-find-custom "textDocument/references" + (plist-put (lsp--text-document-position-params) :excludeRole 32))) + + ;; ccls/vars ccls/base ccls/derived ccls/members have a parameter while others are interactive. + ;; (ccls/base 1) direct bases + ;; (ccls/derived 1) direct derived + ;; (ccls/member 2) => 2 (Type) => nested classes / types in a namespace + ;; (ccls/member 3) => 3 (Func) => member functions / functions in a namespace + ;; (ccls/member 0) => member variables / variables in a namespace + ;; (ccls/vars 1) => field + ;; (ccls/vars 2) => local variable + ;; (ccls/vars 3) => field or local variable. 3 = 1 | 2 + ;; (ccls/vars 4) => parameter + + ;; References whose filenames are under this project + (setq company-transformers nil company-lsp-async t company-lsp-cache-candidates nil) + (setq ccls-sem-highlight-method 'font-lock) + (ccls-use-default-rainbow-sem-highlight) +#+END_SRC + ** Compilation *** Close window after errorless compilation #+BEGIN_SRC emacs-lisp @@ -596,23 +650,6 @@ then it takes a second \\[keyboard-quit] to abort the minibuffer." (message ""))))) #+END_SRC -*** Compilation functions -#+BEGIN_SRC emacs-lisp -(defun my/exec-f5 () - (interactive) - (defvar make) - (setq make "gmake -j5 asan") - (save-buffer) - (compile make) - (compilation-finish-function)) - -(defun my/exec-f6 () - (interactive) - (defvar exec) - (setq exec "./a.out; ret=$?; echo \"\e[1;35m~>\"; if [ $ret -ne 0 ]; then echo -n \"\e[1;31m$ret\"; if [ $ret -eq 127 ]; then echo \" - Missing a.out, comipler error! \"; exit; elif [ $ret -eq 134 ]; then echo \" - Abort! \"; elif [ $ret -eq 138 ]; then echo \" - Bus error! \"; elif [ $ret -eq 139 ]; then echo \" - Segmentation fault! \"; fi; fi; echo \"\e[1;35m\n\n.emacs v1.5 Tilde Edition by Joe\"") - (async-shell-command exec)) -#+END_SRC - ** Custom functions *** startsoon-mode #+BEGIN_SRC emacs-lisp @@ -653,8 +690,7 @@ then it takes a second \\[keyboard-quit] to abort the minibuffer." (global-set-key [f1] 'shell-pop) (global-set-key [f2] 'neotree-toggle) (global-set-key [f4] 'helm-make-projectile) -(global-set-key [f5] 'my/exec-f5) -(global-set-key [f6] 'my/exec-f6) +(global-set-key [f5] 'undo-tree-visualize) (global-set-key (kbd "C-x d") 'dired) (global-set-key (kbd "M-1") 'shell-command) (global-set-key (kbd "M-7") 'async-shell-command) |