add emacs configs

This commit is contained in:
kaz saita 2024-04-27 12:07:52 +09:00
parent 258d796798
commit 59f7ebe92c
3 changed files with 123 additions and 1 deletions

View file

@ -1,2 +1,10 @@
# dotfiles
## For windows
emacs:
```
mklink /D .emacs.d .\dotfiles\emacs.d
```

2
emacs.d/.gitignore vendored
View file

@ -1,3 +1,4 @@
recentf
auto-save-list/
eln-cache/
elpa/
@ -6,3 +7,4 @@ strait/
tutorial/
straight/

View file

@ -107,7 +107,40 @@
(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)) ;; バッファ自動再読み
(global-auto-revert-mode t) ;; バッファ自動再読み
(cd "~/") ;HOMEディレクトリに移動
)
;; ファイル名がぶつからないようにする (uniquify)
(use-package uniquify
:config
(setq uniquify-buffer-name-style 'post-forward-angle-brackets)
(setq uniquify-ignore-buffers-re "*[^*]+*"))
;; recentf
(use-package recentf
:ensure t
:straight t
:init
(use-package 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
@ -129,6 +162,85 @@
;;: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)
(add-to-list 'company-backends #'company-tabnine)
(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))
(require 'bind-key)
(bind-key "C-t" 'other-window global-map)