From dfa92e3cb7a07b56d75266335135757d92331a76 Mon Sep 17 00:00:00 2001 From: Peter Son Struschka Date: Tue, 11 Feb 2020 11:52:34 +0800 Subject: fixes and updates --- .../.config/systemd/user/battery-monitor.service | 2 +- doom-emacs/.doom.d/init.el | 8 +- doom-emacs/.doom.d/modules/tools/cc-ide/config.el | 61 +++++ .../.doom.d/modules/tools/cc-ide/packages.el | 10 + doom-emacs/.emacs.d | 2 +- emacs/.emacs.d/config.org | 300 +++++++++++++++++++++ emacs/.emacs.d/init.el | 46 +--- emacs/.emacs.d/myinit.org | 2 +- zsh/.zshrc | 4 +- 9 files changed, 383 insertions(+), 52 deletions(-) create mode 100644 doom-emacs/.doom.d/modules/tools/cc-ide/config.el create mode 100644 doom-emacs/.doom.d/modules/tools/cc-ide/packages.el create mode 100644 emacs/.emacs.d/config.org diff --git a/basics/.config/systemd/user/battery-monitor.service b/basics/.config/systemd/user/battery-monitor.service index c672ac5..ba6496b 100644 --- a/basics/.config/systemd/user/battery-monitor.service +++ b/basics/.config/systemd/user/battery-monitor.service @@ -5,7 +5,7 @@ Description=Battery Monitor Type=simple Environment=DISPLAY=:0 Environment=XAUTHORITY=%h/.Xauthority -ExecStart=/bin/bash %h/.bin/battery-monitor +ExecStart=/bin/bash %h/.local/bin/battery-monitor Restart=always RestartSec=10 diff --git a/doom-emacs/.doom.d/init.el b/doom-emacs/.doom.d/init.el index 470647f..3f75618 100644 --- a/doom-emacs/.doom.d/init.el +++ b/doom-emacs/.doom.d/init.el @@ -70,7 +70,13 @@ ;;term ; terminals in Emacs ;;vterm ; another terminals in Emacs + :checkers + syntax ; tasing you for every semicolon you forget + ;;spell ; tasing you for every misspelling + ;;grammer ; tasing grammer mistakes every you make + :tools + cc-ide ;;ansible debugger ; FIXME stepping through code, to help you add bugs ;;direnv @@ -78,8 +84,6 @@ editorconfig ; let someone else argue about tabs vs spaces ;;ein ; tame Jupyter notebooks with emacs (eval +overlay) ; run code, run (also, repls) - flycheck ; tasing you for every semicolon you forget - ;;flyspell ; tasing you for misspelling mispelling ;;gist ; interacting with github gists (lookup ; helps you navigate your code and documentation +docsets) ; ...or in Dash docsets locally diff --git a/doom-emacs/.doom.d/modules/tools/cc-ide/config.el b/doom-emacs/.doom.d/modules/tools/cc-ide/config.el new file mode 100644 index 0000000..c96fd19 --- /dev/null +++ b/doom-emacs/.doom.d/modules/tools/cc-ide/config.el @@ -0,0 +1,61 @@ +;;; tools/gtags/config.el -*- lexical-binding: t; -*- + +(use-package! ggtags + :unless (or (featurep! :completion ivy) (featurep! :completion helm)) + :config + (add-hook! (c-mode c++-mode java-mode asm-mode) (ggtags-mode 1)) + (map! :map ggtags-mode-map + "C-c g s" 'ggtags-find-other-symbol + "C-c g h" 'ggtags-view-tag-history + "C-c g r" 'ggtags-find-reference + "C-c g f" 'ggtags-find-file + "C-c g c" 'ggtags-create-tags + "C-c g u" 'ggtags-update-tags + "M-," 'pop-tag-mark) + (setq-hook! 'ggtags-mode-hook imenu-create-index-function 'ggtags-build-imenu-index) + ) + +(use-package! helm-gtags + :when (featurep! :completion helm) + :after helm + :init + (setq! helm-gtags-ignore-case t + helm-gtags-auto-update t + helm-gtags-use-input-at-cursor t + helm-gtags-pulse-at-cursor t + helm-gtags-prefix-key "\C-cg" + helm-gtags-suggested-key-mapping t) + :config + (add-hook! (dired-mode eshell-mode c-mode c++-mode asm-mode) (helm-gtags-mode)) + (map! :map helm-gtags-mode-map + "C-c g a" 'helm-gtags-tags-in-this-function + "C-j" 'helm-gtags-select + "M-." 'helm-gtags-dwim + "M-," 'helm-gtags-pop-stack + "C-c <" 'helm-gtags-previous-history + "C-c >" 'helm-gtags-next-history) + ) + +(use-package! counsel-gtags + :when (featurep! :completion ivy) + :after ivy + :config + (add-hook! (c-mode c++-mode asm-mode) #'counsel-gtags-mode) + (map! :map counsel-gtags-mode-map + "C-c g t" 'counsel-gtags-find-definition + "C-c g r" 'counsel-gtags-find-reference + "C-c g s" 'counsel-gtags-find-symbol + "C-c g f" 'counsel-gtags-find-file + "C-c g c" 'counsel-gtags-create-tags + "C-c g u" 'counsel-gtags-update-tags + "M-," 'counsel-gtags-dwim + "C-c <" 'counsel-gtags-go-backward + "C-c >" 'counsel-gtags-go-forward) + ) + +(use-package! function-args + :init + (setq-default semantic-case-fold t) + :config + (add-hook! (c-mode c++-mode asm-mode) #'function-args-mode) + ) diff --git a/doom-emacs/.doom.d/modules/tools/cc-ide/packages.el b/doom-emacs/.doom.d/modules/tools/cc-ide/packages.el new file mode 100644 index 0000000..f4840d5 --- /dev/null +++ b/doom-emacs/.doom.d/modules/tools/cc-ide/packages.el @@ -0,0 +1,10 @@ +;; -*- no-byte-compile: t; -*- +;;; tools/gtags/packages.el + +(if (featurep! :completion ivy) + (package! counsel-gtags) + (if (featurep! :completion helm) + (package! helm-gtags) + (package! ggtags))) + +(package! function-args) diff --git a/doom-emacs/.emacs.d b/doom-emacs/.emacs.d index 0dc173a..ae75326 160000 --- a/doom-emacs/.emacs.d +++ b/doom-emacs/.emacs.d @@ -1 +1 @@ -Subproject commit 0dc173a63156e8a875705d1ef9e820120c420839 +Subproject commit ae75326a408eb93a30550382efbf5d70831d6a46 diff --git a/emacs/.emacs.d/config.org b/emacs/.emacs.d/config.org new file mode 100644 index 0000000..544bda0 --- /dev/null +++ b/emacs/.emacs.d/config.org @@ -0,0 +1,300 @@ +* Emacs + :PROPERTIES: + :header-args: :tangle ~/.emacs.d/config.el + :END: + +** Essentials +*** Debugging essentials +#+BEGIN_SRC elisp +(setq debug-on-error t) +(setq debug-on-quit t) +#+END_SRC +*** Package setup +#+BEGIN_SRC elisp +(defconst emacs-start-time (current-time)) + +(setq straight-repository-branch "develop" + straight-vc-git-default-clone-depth 1 + straight-use-package-by-default t) + +(defvar bootstrap-version) +(let ((bootstrap-file + (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory)) + (bootstrap-version 5)) + (unless (file-exists-p bootstrap-file) + (with-current-buffer + (url-retrieve-synchronously + "https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el" + 'silent 'inhibit-cookies) + (goto-char (point-max)) + (eval-print-last-sexp))) + (load bootstrap-file nil 'nomessage)) + +(setq straight-use-package-by-default 't) +(straight-use-package 'use-package) +(let ((elapsed (float-time (time-subtract (current-time) + emacs-start-time)))) + (message "Loaded packages in %.3fs" elapsed)) +(setq gc-cons-threshold 100000) +#+END_SRC +*** Information +#+BEGIN_SRC elisp +(setq user-full-name "Peter Son Struschka" + user-mail-address "me@peter-struschka.com") +(setenv "SHELL" "/usr/bin/zsh") +#+END_SRC +*** Garbage collection +#+BEGIN_SRC elisp +(use-package gcmh + :straight t + :demand t + :init + (setq gcmh-verbose t + gcmh-lows-cons-threshold #x800000 + gcmh-high-cons-threshold #x800000 + gcmh-idle-delay 300) + :config + (gcmh-mode)) +#+END_SRC +*** Benchmarks +#+BEGIN_SRC elisp +(use-package benchmark-init + :demand t + :hook ((after-init . benchmark-init/deactivate))) +#+END_SRC +*** Littering +#+BEGIN_SRC elisp +(use-package no-littering) +(require 'no-littering) +#+END_SRC + +** Base +*** Helm +#+BEGIN_SRC elisp +(use-package helm + :init + (setq helm-split-window-default-side 'other) + (helm-mode 1) + :config + (define-key helm-find-files-map + (kbd "") #'helm-select-action) + (define-key helm-find-files-map + (kbd "C-i") #'helm-execute-persistent-action) + :bind + (([remap apropos] . helm-apropos) + ([remap find-library] . helm-locate-library) + ([remap bookmark-jump] . helm-bookmarks) + ([remap execute-extended-command] . helm-M-x) + ([remap find-file] . helm-find-files) + ([remap locate] . helm-locate) + ([remap imenu] . helm-imenu) + ([remap noop-show-kill-ring] . helm-show-kill-ring) + ([remap switch-to-buffer] . helm-buffers-list) + ([remap minibuffer] . helm-mini) + ([remap recentf-open-files] . helm-recentf) + ([remap occur] . helm-occur) + ([remap yank-pop] . helm-show-kill-ring) + ("C-x b" . helm-mini) + ("C-h d" . helm-info-at-point) + ("C-c r" . helm-resume))) + +(use-package swiper-helm + :bind (("C-s" . swiper-helm))) +#+END_SRC +*** Which +#+BEGIN_SRC elisp +(use-package which-key + :init + (setq which-key-separator " ") + (setq which-key-prefix-prefix "+") + :config + (which-key-mode)) +#+END_SRC +*** Evil +#+BEGIN_SRC elisp +(use-package evil + :config + (evil-mode 1)) +(use-package evil-escape + :init + (setq-default evil-escape-key-sequence "jk") + :config + (evil-escape-mode t)) +#+END_SRC +*** General +#+BEGIN_SRC elisp +(use-package general + :config + (general-define-key + :states '(normal visual insert emacs) + :prefix "SPC" + :non-normal-prefix "M-SPC" + ;; "/" '(counsel-rg :which-key "ripgrep") ; You'll need counsel package for this + "TAB" '(switch-to-prev-buffer :which-key "previous buffer") + "SPC" '(helm-M-x :which-key "M-x") + ;; Files + "f" '(:ignore t :which-key "Files") + "ff" '(helm-find-files :which-key "find files") + ;; Buffers + "b" '(:ignore t :which-key "Buffers") + "bb" '(helm-buffers-list :which-key "buffers list") + "bd" '(kill-this-buffer :which-key "buffer kill") + ;; Window + "w" '(:ignore t :which-key "Windows") + "wl" '(windmove-right :which-key "move right") + "wh" '(windmove-left :which-key "move left") + "wk" '(windmove-up :which-key "move up") + "wj" '(windmove-down :which-key "move bottom") + "w/" '(split-window-right :which-key "split right") + "w-" '(split-window-below :which-key "split bottom") + "wx" '(delete-window :which-key "delete window") + ;; Others + "a" '(:ignore t :which-key "Apps") + "at" '(ansi-term :which-key "open terminal") + )) +#+END_SRC +*** Completion +#+BEGIN_SRC elisp +(use-package company + :defer t + :diminish (company-mode . " ⓐ") + :init + (global-company-mode) + :config + (setq company-tooltip-align-annotations t + company-idle-delay 0.2 + ;; min prefix of 2 chars + company-minimum-prefix-length 2 + company-require-match nil)) + +(use-package company-quickhelp ; Show help in tooltip + :requires (company) + :defer t + :init (with-eval-after-load 'company + (company-quickhelp-mode))) +#+END_SRC + +*** Org Mode +#+BEGIN_SRC elisp +(use-package org-bullets + :hook (org-mode . (lambda () (org-bullets-mode t)))) +(setq org-hide-leading-stars t) +(add-hook 'org-mode-hook 'org-indent-mode) +(setq org-src-fontify-natively t) +(setq org-src-preserve-indentation t + org-edit-src-content-indentation t) +#+END_SRC + +*** Project +#+BEGIN_SRC elisp +(use-package projectile + :config + (projectile-mode t)) + +#+END_SRC +*** Git +#+BEGIN_SRC elisp +(use-package magit) +#+END_SRC +*** Treemacs +#+BEGIN_SRC elisp +(use-package treemacs + :ensure t + :defer t + :init + (with-eval-after-load 'winum + (define-key winum-keymap (kbd "M-0") #'treemacs-select-window)) + :bind + (:map global-map + ("M-0" . treemacs-select-window) + ("C-x t 1" . treemacs-delete-other-windows) + ("C-x t t" . treemacs) + ("C-x t B" . treemacs-bookmark) + ("C-x t C-t" . treemacs-find-file) + ("C-x t M-t" . treemacs-find-tag))) + +(use-package treemacs-evil) +(use-package treemacs-projectile) +(use-package treemacs-icons-dired) +(use-package treemacs-magit) +#+END_SRC +** Appearance +*** theme +#+BEGIN_SRC elisp +(use-package doom-themes + :config + (load-theme 'doom-one t)) +#+END_SRC + +*** Dashboard +#+BEGIN_SRC elisp +(use-package dashboard + :ensure t + :config + ;; Set the title + (setq dashboard-banner-logo-title "Welcome to Emacs Dashboard") + ;; Set the banner + (setq dashboard-startup-banner 'official) + ;; Value can be + ;; 'official which displays the official emacs logo + ;; 'logo which displays an alternative emacs logo + ;; 1, 2 or 3 which displays one of the text banners + ;; "path/to/your/image.png" which displays whatever image you would prefer + + ;; Content is not centered by default. To center, set + (setq dashboard-center-content t) + + ;; To disable shortcut "jump" indicators for each section, set + (setq dashboard-show-shortcuts nil) + (dashboard-setup-startup-hook)) +#+END_SRC + +*** Modeline +#+BEGIN_SRC elisp +(use-package doom-modeline + :hook (after-init . doom-modeline-mode) + :config (setq doom-modeline-height 25 + doom-modeline-bar-width 3 + doom-modeline-project-detection 'project + doom-modeline-buffer-file-name-style 'truncate-upto-project)) + +#+END_SRC +** Misc +*** QOL +#+BEGIN_SRC elisp +(show-paren-mode 1) +(setq sentence-end-double-space nil) + +(setq scroll-step 1 + mouse-wheel-scroll-amount '(1 ((shift) . 1)) + mouse-wheel-progressive-speed nil + mouse-wheel-follow-mouse 't + redisplay-dont-pause t) + +(when (version<= "26.0.50" emacs-version ) + (global-display-line-numbers-mode)) + +(tool-bar-mode -1) +(scroll-bar-mode -1) + +(defalias 'yes-or-no-p 'y-or-n-p) +#+END_SRC +*** Custom definitions +#+BEGIN_SRC elisp +(defun find-config () + "Edit config.org" + (interactive) + (find-file "~/.emacs.d/config.org")) + +(global-set-key (kbd "C-c I") 'find-config) +#+END_SRC +*** Finish +#+BEGIN_SRC elisp +(setq debug-on-error nil) +(setq debug-on-quit nil) + +(let ((elapsed (float-time (time-subtract (current-time) + emacs-start-time)))) + (message "Loading settings...done (%.3fs)" elapsed)) +(put 'narrow-to-region 'disabled nil) +#+END_SRC diff --git a/emacs/.emacs.d/init.el b/emacs/.emacs.d/init.el index fa6c5e8..7f731c6 100755 --- a/emacs/.emacs.d/init.el +++ b/emacs/.emacs.d/init.el @@ -1,45 +1 @@ -(require 'package) - -(let* ((no-ssl (and (memq system-type '(windows-nt ms-dos)) - (not (gnutls-available-p)))) - (proto (if no-ssl "http" "https"))) - ;; Comment/uncomment these two lines to enable/disable MELPA and MELPA Stable as desired - (add-to-list 'package-archives (cons "melpa" (concat proto "://melpa.org/packages/")) t) - ; (add-to-list 'package-archives (cons "marmalade" (concat proto "://marmalade-repo.org/packages/")) t) - (add-to-list 'package-archives (cons "melpa-stable" (concat proto "://stable.melpa.org/packages/")) t) - (add-to-list 'package-archives (cons "org" (concat proto "://orgmode.org/elpa/")) t) - (add-to-list 'package-archives (cons "gnu" (concat proto "://elpa.gnu.org/packages/")))) - -(package-initialize) - -(unless package-archive-contents - (package-refresh-contents)) - -(setq package-load-list '(all)) -(unless (package-installed-p 'org) - (package-install 'org)) -(unless (package-installed-p 'use-package) - (package-install 'use-package)) -(package-initialize) - - -(require 'org) - -(org-babel-load-file (expand-file-name "~/.emacs.d/myinit.org")) -(custom-set-variables - ;; custom-set-variables was added by Custom. - ;; If you edit it by hand, you could mess it up, so be careful. - ;; Your init file should contain only one such instance. - ;; If there is more than one, they won't work right. - '(custom-safe-themes - (quote - ("44961a9303c92926740fc4121829c32abca38ba3a91897a4eab2aa3b7634bed4" "fede08d0f23fc0612a8354e0cf800c9ecae47ec8f32c5f29da841fe090dfc450" "8e51e44e5b079b2862335fcc5ff0f1e761dc595c7ccdb8398094fb8e088b2d50" "7559ac0083d1f08a46f65920303f970898a3d80f05905d01e81d49bb4c7f9e39" default))) - '(package-selected-packages - (quote - (docker dockerfile-mode racer yaml-mode pkgbuild-mode zenburn-theme color-theme-modern base16-theme spacemacs-theme dumb-jump which-key use-package undo-tree try treemacs-projectile spaceline smartparens rainbow-delimiters org-plus-contrib nlinum magit ivy-hydra iedit fzf flycheck expand-region exec-path-from-shell doom-modeline diminish counsel-projectile company color-theme-sanityinc-solarized aggressive-indent)))) -(custom-set-faces - ;; custom-set-faces was added by Custom. - ;; If you edit it by hand, you could mess it up, so be careful. - ;; Your init file should contain only one such instance. - ;; If there is more than one, they won't work right. - ) +(org-babel-load-file (expand-file-name "~/.emacs.d/config.org")) diff --git a/emacs/.emacs.d/myinit.org b/emacs/.emacs.d/myinit.org index f53fa4d..aba6dc3 100755 --- a/emacs/.emacs.d/myinit.org +++ b/emacs/.emacs.d/myinit.org @@ -1,4 +1,4 @@ -* Interface + * Interface #+BEGIN_SRC emacs-lisp (setq inhibit-startup-screen t) (scroll-bar-mode -1) diff --git a/zsh/.zshrc b/zsh/.zshrc index 76c1411..b985a32 100644 --- a/zsh/.zshrc +++ b/zsh/.zshrc @@ -84,11 +84,11 @@ alias ec="emacsclient -c" [[ -e /usr/share/doc/pkgfile/command-not-found.zsh ]] && source /usr/share/doc/pkgfile/command-not-found.zsh -if ! zplug check --verbose; then +if ! zplug check; then printf "Install? [y/N]: " if read -q; then echo; zplug install fi fi -zplug load --verbose +zplug load -- cgit v1.2.3