diff options
-rw-r--r-- | .config/emacs/init.el | 2 | ||||
-rw-r--r-- | .config/emacs/org/config.org | 247 | ||||
-rw-r--r-- | .config/zsh/alias.zsh | 2 |
3 files changed, 115 insertions, 136 deletions
diff --git a/.config/emacs/init.el b/.config/emacs/init.el index 186c23b..30d31d2 100644 --- a/.config/emacs/init.el +++ b/.config/emacs/init.el @@ -36,7 +36,7 @@ '(jdee-db-spec-breakpoint-face-colors (cons "#1c1f2b" "#676E95")) '(objed-cursor-color "#ff5370") '(package-selected-packages - '(helm-ag evil-numbers ccls org-superstar company-lsp lsp-ui lsp-mode evil-mc vterm evil-surround cl-format company-irony neotree irony xr font-utils org-evil evil-vimish-fold crontab-mode symon toc-org yaml-mode helm-w3m helm-mu htmlize babel org-pdftools shell-pop which-key dmenu lua-mode dionysos helm-c-yasnippet helm-emms emms font-lock-cl restart-emacs w3m string-utils go-mode major-mode-icons dired-icon mode-icons evil-collection sed-mode zones kaolin-themes gruvbox-theme helm-themes yasnippet-classic-snippets yasnippet-snippets auto-yasnippet php-auto-yasnippets el-autoyas yasnippet cargo evil-ediff windresize helm-make spacemacs-theme centaur-tabs evil-magit dashboard ssh sudo-ext dockerfile-mode docker frame-local ov dash-functional helm-addressbook org-mime flyspell-correct pdf-tools websocket request emojify-logos emojify oauth2 circe web-mode doom-themes doom-modeline all-the-icons-dired all-the-icons-gnus all-the-icons html5-schema phps-mode org-babel-eval-in-repl rust-mode smart-mode-line-powerline-theme eshell-prompt-extras eshell-fixed-prompt pyenv-mode s realgud-lldb ranger ## color-theme-modern auto-complete-c-headers command-log-mode auto-complete magit smart-tabs-mode airline-themes paredit autopair tabbar-ruler tabbar use-package-el-get color-theme-approximate diminish rainbow-delimiters color-identifiers-mode use-package helm evil-visual-mark-mode)) + '(fzf helm-fuzzy helm-fuzzy-find workgroups2 helm-ag evil-numbers ccls org-superstar company-lsp lsp-ui lsp-mode evil-mc evil-surround cl-format company-irony neotree irony xr font-utils org-evil evil-vimish-fold crontab-mode symon toc-org yaml-mode helm-w3m helm-mu htmlize babel org-pdftools shell-pop which-key dmenu lua-mode dionysos helm-c-yasnippet helm-emms emms font-lock-cl restart-emacs w3m string-utils go-mode major-mode-icons dired-icon mode-icons evil-collection sed-mode zones kaolin-themes gruvbox-theme helm-themes yasnippet-classic-snippets yasnippet-snippets auto-yasnippet php-auto-yasnippets el-autoyas yasnippet cargo evil-ediff windresize helm-make spacemacs-theme centaur-tabs evil-magit dashboard ssh sudo-ext dockerfile-mode docker frame-local ov dash-functional helm-addressbook org-mime flyspell-correct pdf-tools websocket request emojify-logos emojify oauth2 circe web-mode doom-themes doom-modeline all-the-icons-dired all-the-icons-gnus all-the-icons html5-schema phps-mode org-babel-eval-in-repl rust-mode smart-mode-line-powerline-theme eshell-prompt-extras eshell-fixed-prompt pyenv-mode s realgud-lldb ranger ## color-theme-modern auto-complete-c-headers command-log-mode auto-complete magit smart-tabs-mode airline-themes paredit autopair tabbar-ruler tabbar use-package-el-get color-theme-approximate diminish rainbow-delimiters color-identifiers-mode use-package helm evil-visual-mark-mode)) '(pdf-view-midnight-colors (cons "#EEFFFF" "#292D3E")) '(pos-tip-background-color "#2E2A29") '(pos-tip-foreground-color "#d4d4d6") 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) diff --git a/.config/zsh/alias.zsh b/.config/zsh/alias.zsh index 9751f04..9654fb1 100644 --- a/.config/zsh/alias.zsh +++ b/.config/zsh/alias.zsh @@ -18,7 +18,7 @@ tree() { } alias c='clear' alias less='less --tabs 4' -alias bc='clear; bc -l' +alias bc='bc -l' alias mkf='gmake fclean' alias mkc='gmake clean' alias mk='gmake -j5' |