dotfiles/emacs.d/init.el

147 lines
5 KiB
EmacsLisp

;; 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)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; 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)) ;; バッファ自動再読み
;; 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))
(require 'bind-key)
(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 '((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.
)