summaryrefslogtreecommitdiffstats
path: root/.config/emacs/org/config.org
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-12-07 21:29:48 +0100
committerJozanLeClerc <bousset.rudy@gmail.com>2020-12-07 21:29:48 +0100
commitcbe41090b9314742cc41912a33767dca6665b3e0 (patch)
tree1b284e14d814e4269eaa4e78ab3dc68f1ce80441 /.config/emacs/org/config.org
parentCounting in kiB from now on (diff)
downloaddotfiles-bsd-cbe41090b9314742cc41912a33767dca6665b3e0.tar.gz
dotfiles-bsd-cbe41090b9314742cc41912a33767dca6665b3e0.tar.bz2
dotfiles-bsd-cbe41090b9314742cc41912a33767dca6665b3e0.tar.xz
dotfiles-bsd-cbe41090b9314742cc41912a33767dca6665b3e0.tar.zst
dotfiles-bsd-cbe41090b9314742cc41912a33767dca6665b3e0.zip
update
Diffstat (limited to '')
-rw-r--r--.config/emacs/org/config.org247
1 files changed, 113 insertions, 134 deletions
diff --git a/.config/emacs/org/config.org b/.config/emacs/org/config.org
index d7642cb..bdf0bb6 100644
--- a/.config/emacs/org/config.org
+++ b/.config/emacs/org/config.org
@@ -118,43 +118,46 @@
** Core packages
*** Evil mode
#+BEGIN_SRC emacs-lisp
-(setq evil-want-integration t) ;; This is optional since it's already set to t by default.
-(setq evil-want-keybinding nil)
-(setq evil-want-C-u-scroll t)
-(require 'evil)
-(require 'evil-magit)
-;; (require 'evil-collection)
-(evil-mode t)
-;; (evil-collection-init)
-
-
-(setq evil-emacs-state-cursor '("#b16286" box))
-(setq evil-normal-state-cursor '("#d79921" box))
-(setq evil-visual-state-cursor '("#b06597" box))
-(setq evil-insert-state-cursor '("#d79921" bar))
-(setq evil-replace-state-cursor '("#cc241d" hbar))
-(setq evil-operator-state-cursor '("#d79921" hbar))
-
-
-(evil-define-key 'insert global-map (kbd "C-o") 'delete-other-windows)
-(evil-define-key 'insert global-map (kbd "C-k") 'windmove-up)
-(evil-define-key 'insert global-map (kbd "C-j") 'windmove-down)
-(evil-define-key 'insert global-map (kbd "C-h") 'windmove-left)
-(evil-define-key 'insert global-map (kbd "C-l") 'windmove-right)
-(evil-define-key 'normal global-map (kbd "C-o") 'delete-other-windows)
-(evil-define-key 'normal global-map (kbd "C-k") 'windmove-up)
-(evil-define-key 'normal global-map (kbd "C-j") 'windmove-down)
-(evil-define-key 'normal global-map (kbd "C-h") 'windmove-left)
-(evil-define-key 'normal global-map (kbd "C-l") 'windmove-right)
-
-(global-evil-leader-mode)
-(evil-leader/set-leader ",")
-(setq evil-leader/in-all-states 1)
-
-(require 'evil-search-highlight-persist)
-(global-evil-search-highlight-persist 1)
-
-(evil-leader/set-key "SPC" 'evil-search-highlight-persist-remove-all)
+ (setq evil-want-integration t) ;; This is optional since it's already set to t by default.
+ (setq evil-want-keybinding nil)
+ (setq evil-want-C-u-scroll t)
+ (require 'evil)
+ (require 'evil-magit)
+ ;; (require 'evil-collection)
+ (evil-mode t)
+ ;; (evil-collection-init)
+
+
+ (setq evil-emacs-state-cursor '("#b16286" box))
+ (setq evil-normal-state-cursor '("#d79921" box))
+ (setq evil-visual-state-cursor '("#b06597" box))
+ (setq evil-insert-state-cursor '("#d79921" bar))
+ (setq evil-replace-state-cursor '("#cc241d" hbar))
+ (setq evil-operator-state-cursor '("#d79921" hbar))
+
+
+ (evil-define-key 'insert global-map (kbd "C-o") 'delete-other-windows)
+ (evil-define-key 'insert global-map (kbd "C-k") 'windmove-up)
+ (evil-define-key 'insert global-map (kbd "C-j") 'windmove-down)
+ (evil-define-key 'insert global-map (kbd "C-h") 'windmove-left)
+ (evil-define-key 'insert global-map (kbd "C-l") 'windmove-right)
+ (evil-define-key 'normal global-map (kbd "C-o") 'delete-other-windows)
+ (evil-define-key 'normal global-map (kbd "C-k") 'windmove-up)
+ (evil-define-key 'normal global-map (kbd "C-j") 'windmove-down)
+ (evil-define-key 'normal global-map (kbd "C-h") 'windmove-left)
+ (evil-define-key 'normal global-map (kbd "C-l") 'windmove-right)
+
+ (global-evil-leader-mode)
+ (evil-leader/set-leader ",")
+ (setq evil-leader/in-all-states 1)
+
+ (require 'evil-search-highlight-persist)
+ (global-evil-search-highlight-persist 1)
+
+ (evil-leader/set-key "SPC" 'evil-search-highlight-persist-remove-all)
+
+ (global-undo-tree-mode)
+ (evil-set-undo-system 'undo-tree)
#+END_SRC
*** Evil nerd commenter
@@ -230,6 +233,7 @@
(string-prefix-p "*Mingus*" name)
(string-prefix-p "*Mingus Browser*" name)
(string-prefix-p "TAGS" name)
+ (string-prefix-p "*lsp-ui-doc" name)
(and (string-prefix-p "magit" name)
(not (file-name-extension name))))))
@@ -499,7 +503,6 @@ then it takes a second \\[keyboard-quit] to abort the minibuffer."
(define-key minibuffer-local-completion-map [escape] 'minibuffer-keyboard-quit)
(define-key minibuffer-local-must-match-map [escape] 'minibuffer-keyboard-quit)
(define-key minibuffer-local-isearch-map [escape] 'minibuffer-keyboard-quit)
-(global-set-key [escape] 'evil-exit-emacs-state)
(defun my/insert-tab-char ()
(interactive)
@@ -596,109 +599,85 @@ then it takes a second \\[keyboard-quit] to abort the minibuffer."
*** 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)
+ (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)
+ (setq lsp-enable-indentation nil)
+(setq lsp-enable-completion-at-point t)
+ ;; (ccls-use-default-rainbow-sem-highlight)
#+END_SRC
** Compilation
*** Close window after errorless compilation
#+BEGIN_SRC emacs-lisp
-(setq compilation-finish-function
-(lambda (buf str)
- (if (null (string-match ".*exited abnormally.*" str))
- ;;no errors, make the compilation window go away in a few seconds
- (progn
- (run-at-time
- "0.5 sec" nil 'delete-windows-on "*compilation*")
- (message "")))))
+ (defun bury-compile-buffer-if-successful (buffer string)
+ "Bury a compilation buffer if succeeded without warnings "
+ (when (and
+ (buffer-live-p buffer)
+ (string-match "compilation" (buffer-name buffer))
+ (string-match "finished" string)
+ (not
+ (with-current-buffer buffer
+ (goto-char (point-min))
+ (search-forward "warning" nil t))))
+ (run-with-timer 0.5 nil
+ (lambda (buf)
+ (bury-buffer buf)
+ (switch-to-prev-buffer (get-buffer-window buf) 'kill)
+ (delete-window))
+ buffer)))
+ (add-hook 'compilation-finish-functions 'bury-compile-buffer-if-successful)
#+END_SRC
-** Custom functions
-*** startsoon-mode
- #+BEGIN_SRC emacs-lisp
- (defun my/startsoon ()
- (interactive)
- (split-window-right)
- (windmove-right)
- (split-window-below)
- (enlarge-window 10)
- (windmove-down)
- (switch-to-buffer "*Mingus*")
- (mingus-refresh)
- (windmove-up)
- (term "/usr/home/jozan/.local/bin/startsoon")
- (windmove-left)
- (zone))
- #+END_SRC
-
-*** brb-mode
- #+BEGIN_SRC emacs-lisp
- (defun my/brb ()
- (interactive)
- (split-window-right)
- (windmove-right)
- (split-window-below)
- (enlarge-window 10)
- (windmove-down)
- (switch-to-buffer "*Mingus*")
- (mingus-refresh)
- (windmove-up)
- (term "/usr/home/jozan/.local/bin/brb")
- (windmove-left)
- (zone))
- #+END_SRC
-
** Other key bindings
#+BEGIN_SRC emacs-lisp
(global-set-key [f1] 'shell-pop)