[emacs] add some settings

This commit is contained in:
Kaz Saita(raspi4) 2024-03-19 16:25:32 +09:00
parent 587b5ff192
commit 258d796798

View file

@ -1,13 +1,8 @@
;; init.el - part of dotfiles
;; https://git.kinoshita-lab.org/kazbo/dotfiles
;; !!!!!
;; IMPORTANT
;; use "M-x use-package packagename" instead of "M-x package-install" as well as possible
;; !!!!!
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; META Setup(setup package system, use-package, straight)
;; META Setup(setup package system, leaf straight)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; configure package
(require 'package)
@ -26,10 +21,6 @@
(setq url-http-attempt-keepalives nil)
(package-initialize))
;; install use-package if not
(dolist (package '(use-package))
(unless (package-installed-p package)
(package-install package)))
;; setup strait
;; cf. https://github.com/radian-software/straight.el
@ -48,68 +39,109 @@
(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)))
;; integrate use-package/strait
(straight-use-package 'use-package)
(setq straight-use-package-by-default t)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Actual Setup
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(use-package bind-key
:ensure t)
;; tmp settings for edit
(set-language-environment "Japanese")
(prefer-coding-system 'utf-8)
(setq system-time-locale "C")
(setq inhibit-startup-message t) ;; remove beautiful opening screen
(setq initial-scratch-message "") ;; scratchの初期メッセージ消去
(global-display-line-numbers-mode)
;; タイトルバーにファイルのフルパス表示
(setq frame-title-format
(format "%%f - Emacs@%s" (system-name)))
;; 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 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)
;; タイトルバーにファイルのフルパス表示
(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)
(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)) ;; バッファ自動再読み
;; 1行ずつスクロール
(setq scroll-conservatively 35
scroll-margin 0
scroll-step 5)
;; 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))
(setq scroll-conservatively 1)
(setq scroll-margin 10)
(setq scroll-preserve-screen-position t)
(setq next-screen-context-lines 5)
;; マウスホイールによるスクロール時の行数
;; Shift 少なめ、 Ctrl 多めに移動
(setq mouse-wheel-scroll-amount
'(5 ; 通常 (デフォルト 5)
((shift) . 1) ; Shift (デフォルト 1)
((control) . 40) ; Ctrl (デフォルト nil = 無効)
))
;; スクロールバーいらない
(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) ;; バッファ自動再読み
(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.
)