;; init.el - part of dotfiles ;; https://git.kinoshita-lab.org/kazbo/dotfiles ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; META Setup(setup package system, leaf straight) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; configure package (require 'package) (eval-and-compile (when (or load-file-name byte-compile-current-file) (setq user-emacs-directory (expand-file-name (file-name-directory (or load-file-name byte-compile-current-file)))))) (setq package-enable-at-startup nil) (eval-and-compile (customize-set-variable 'package-archives '(("org" . "https://orgmode.org/elpa/") ("melpa" . "https://melpa.org/packages/") ("gnu" . "https://elpa.gnu.org/packages/"))) (setq url-http-attempt-keepalives nil) (package-initialize)) ;; setup strait ;; cf. https://github.com/radian-software/straight.el (defvar bootstrap-version) (let ((bootstrap-file (expand-file-name "straight/repos/straight.el/bootstrap.el" (or (bound-and-true-p straight-base-dir) user-emacs-directory))) (bootstrap-version 7)) (unless (file-exists-p bootstrap-file) (with-current-buffer (url-retrieve-synchronously "https://raw.githubusercontent.com/radian-software/straight.el/develop/install.el" 'silent 'inhibit-cookies) (goto-char (point-max)) (eval-print-last-sexp))) (load bootstrap-file nil 'nomessage)) (setq straight-vc-git-default-clone-depth 1) ;; shallow clone ;; setup leaf if not (eval-and-compile (straight-use-package 'leaf) (straight-use-package 'leaf-keywords) (leaf-keywords-init)) (leaf leaf-keywords :ensure t :init ;; optional packages if you want to use :hydra, :el-get, :blackout,,, (leaf hydra :straight t) (leaf el-get :straight t) (leaf blackout :straight t) (leaf leaf :require t :init (leaf leaf-convert :straight t) (leaf leaf-tree :straight t :blackout t :custom (imenu-list-position . 'left)) :config ;; initialize leaf-keywords.el (leaf-keywords-init))) (leaf macrostep :ensure t) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Actual Setup ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; basic settings (leaf basic-settings :config (set-language-environment "Japanese") (prefer-coding-system 'utf-8) (setq system-time-locale "C") (setq inhibit-startup-message t) ;; remove opening screen (setq initial-scratch-message "") ;; scratchの初期メッセージ消去 (global-display-line-numbers-mode) ;; タイトルバーにファイルのフルパス表示 (setq frame-title-format (format "%%f - Emacs@%s" (system-name))) (setq gc-cons-threshold (* 10 gc-cons-threshold)) (setq message-log-max 10000) (setq enable-recursive-minibuffers t) (setq use-dialog-box 0) (defalias 'message-box 'message) (setq history-length 1000) (setq echo-keystrokes 0.1) (setq large-file-warning-threshold (* 25 1024 1024)) (defadvice abort-recursive-edit (before minibuffer-save activate) (when (eq (selected-window) (active-minibuffer-window)) (add-to-history minibuffer-history-variable (minibuffer-contents)))) (defalias 'yes-or-no-p 'y-or-n-p) ;; スクロールバーいらない (scroll-bar-mode -1) ;; mode bar の設定 (line-number-mode) (column-number-mode) (transient-mark-mode 1) (blink-cursor-mode 0) ;;; カーソルの点滅を止める (tool-bar-mode 0) ;;; toolbarいらない (setq-default tab-width 4 indent-tabs-mode nil) ;; tab = 4 spaces (ffap-bindings) ;; ffap カーソル位置のファイルを開こうとする (setq completion-ignore-case t) ;; file名の補完で大文字小文字を区別しない (global-auto-revert-mode t) ;; バッファ自動再読み (cd "~/") ;HOMEディレクトリに移動 (setq auto-save-default nil) ; .# とかの謎ファイルを作らない (setq make-backup-files nil) ; .~ とかの謎ファイルを作らない ) ;; ファイル名がぶつからないようにする (uniquify) (leaf uniquify :config (setq uniquify-buffer-name-style 'post-forward-angle-brackets) (setq uniquify-ignore-buffers-re "*[^*]+*")) ;; recentf (leaf recentf :ensure t :straight t :init (leaf counsel :ensure t) (recentf-mode 1) :config (setq recentf-max-saved-items 2000) ;; 2000ファイルまで履歴保存する (setq recentf-auto-cleanup 'never) ;; 存在しないファイルは消さない (setq recentf-exclude '( "/recentf" "COMMIT_EDITMSG" "/.?TAGS" "^/sudo:" "/\\.emacs\\.d/games/*-scores" "/\\.emacs\\.d/\\.cask/" "/\\elpa/*" "*/share/emacs/*" )) (setq recentf-auto-save-timer (run-with-idle-timer 30 t 'recentf-save-list)) :bind ("C-c t" . 'counsel-recentf)) ;; configure look and feel (leaf lookandfeel :if window-system (leaf color-theme-modern :straight t) (leaf dracula-theme :straight t) :config (load-theme 'dracula t t) (enable-theme 'dracula) (set-face-italic-p 'italic nil) (set-face-attribute 'default nil ;;:font "Noto Sans Mono CJK JP" :font "kazbo_pragmata_mplus2" ;;:font "Iosevka Fixed SS03" :weight 'medium ;;:font "Code New Roman" ;;:font "Hack" ;;:font "Rounded M+ 1m regular" ;;:font "xos4 Terminus" :height 130)) ;; markdown (leaf markdown-mode :ensure t :mode ("README\\.md\\'" . gfm-mode) :init (setq markdown-command "multimarkdown")) (leaf company-quickhelp :ensure t) (leaf company-irony :ensure t) (leaf company-c-headers :ensure t) (leaf slime-company :ensure t) ;; company (leaf company :ensure t :straight t :init (company-quickhelp-mode) :config (setq company-minimum-prefix-length 1) (setq company-selection-wrap-around t) (setq company-auto-expand t) ;; 1個目を自動的に補完 (setq company-transformers '(company-sort-by-backend-importance)) ;; ソート順 (setq company-idle-delay 0) ; 遅延なしにすぐ表示 (setq company-minimum-prefix-length 2) ; デフォルトは4 (setq company-selection-wrap-around t) ; 候補の最後の次は先頭に戻る (setq completion-ignore-case t) (setq company-dabbrev-downcase nil) (setq company-selection-wrap-around t) (setq company-tooltip-maximum-width 50) (setq company-show-numbers t) (slime-setup '(slime-fancy slime-company)) (add-to-list 'company-backends '(company-bbdb company-nxml company-css company-eclim company-semantic company-clang company-xcode company-cmake company-mode/company-capf company-dabbrev-code company-gtags company-etags company-keywords company-oddmuse company-files company-dabbrev mapcar company-mode/backend-with-yas slime-company company-irony company-c-headers company-elisp)) :hook (prog-mode-hook . global-company-mode) :bind ("C-M-i" . 'company-complete) (company-active-map ("C-n" . 'company-select-next) ("C-p" . 'company-select-previous) ("[tab]" . 'company-complete-selection) ("C-h" . nil) ("C-S-h" . 'company-show-doc-buffer))) (leaf slime :ensure t :straight t :init (leaf slime-company :ensure t) :config (setq inferior-lisp-program "sbcl") (setq slime-contribs '(slime-fancy slime-company slime-quicklisp)) (setq slime-net-coding-system 'utf-8-unix) (setq slime-complete-symbol*-fancy t) (setq slime-complete-symbol-function 'slime-fuzzy-complete-symbol) (setq slime-fuzzy-completion-in-place t) (setq slime-fuzzy-explanation "") (setq slime-kill-without-query-p t)) (leaf rainbow-delimiters :ensure t :straight t :init (require 'cl-lib) (require 'color) (defun rainbow-delimiters-using-stronger-colors () (interactive) (cl-loop for index from 1 to rainbow-delimiters-max-face-count do (let ((face (intern (format "rainbow-delimiters-depth-%d-face" index)))) (cl-callf color-saturate-name (face-foreground face) 100)))) :hook (after-init . rainbow-delimiters-using-stronger-colors) (prog-mode-hook . rainbow-delimiters-mode) :config (setq rainbow-delimiters-outermost-only-face-count 1) (set-face-foreground 'rainbow-delimiters-depth-1-face "#c49696") (set-face-foreground 'rainbow-delimiters-depth-2-face "#ff5e5e") (set-face-foreground 'rainbow-delimiters-depth-3-face "#ffaa77") (set-face-foreground 'rainbow-delimiters-depth-4-face "#dddd77") (set-face-foreground 'rainbow-delimiters-depth-5-face "#80ee80") (set-face-foreground 'rainbow-delimiters-depth-6-face "#66bbff") (set-face-foreground 'rainbow-delimiters-depth-7-face "#da6bda") (set-face-foreground 'rainbow-delimiters-depth-8-face "#afafaf") (set-face-foreground 'rainbow-delimiters-depth-9-face "#f0f0f0")) ;; smartparens ;; M-x sp-cheat-sheet to shee commands available ;; https://github.com/Fuco1/smartparens (leaf smartparens :ensure t :config (require 'smartparens-config) (smartparens-global-mode) :bind (("C-" . sp-forward-slurp-sexp) ("C-" . sp-forward-barf-sexp)) ) (leaf bind-key :ensure t :config (bind-key "C-t" 'other-window global-map) (bind-key "C-h" 'delete-backward-char global-map)) (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. '(warning-suppress-types '((leaf) (comp) (comp)))) (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. )