標準 layer の設定変更
方法1
特定の変数だけ変更できれば良い場合
(setq-default dotspacemacs-configuration-layers '(
(org :variables org-enable-github-support t))
)
方法2
ドキュメントに書かれている方法
(with-eval-after-load 'org
(setq org-agenda-files
'("c:/Users/USERNAME/Dropbox/org/"))
)
方法3
Stack Exchange で紹介されている方法
(spacemacs|use-package-add-hook org-mode
:post-config
(progn
(setq org-agenda-files '("c:/Users/USERNAME/Dropbox/org/")
))
不要なマイナーモードを表示しない
Function: smacemacs|diminish
(spacemacs|diminish hybrid-mode "" "")
evil-mode 用のキーバインドの追加
geiser-doc-mode に入ったとき q で抜けられない
-> evil-collection を利用する
(evil-collection-init 'geiser)
hybrid-state 時のキーバインドの追加
一部のレイヤーでは normal-state と insert-state にしかキーバインドが設定されていないものがあるため,必要なキーを hybrid-state にバインドする必要がある.
Wiki では global-set-key を利用するとの記述があるが,うまく動作しなかったので,
古いスタイルとされている evil-hybrid-state-map で変更する.
(bind-keys :map evil-hybrid-state-map
("C-t" . other-window-or-split))
モード表示色の変更
いくつか stackoverflow に情報があるが、user-init に以下の設定を追記して元の情報を書き換える以外に無さそう。以下は normal-state と hybrid-state の色を入れ替えている。(vim と合わせるため)
(setq spacemacs-evil-cursors '(("normal" "SkyBlue2" box)
("insert" "chartreuse3" (bar . 2))
("emacs" "SkyBlue2" box)
("hybrid" "DarkGoldenrod2" box)
("replace" "chocolate" (hbar . 2))
("evilified" "LightGoldenrod3" box)
("visual" "gray" (hbar . 2))
("motion" "plum3" box)
("lisp" "HotPink1" box)
("iedit" "firebrick1" box)
("iedit-insert" "firebrick1" (bar . 2))))
カーソルの色、形を変える方法の確認
定義の元、 ここから evil-*-state-cursor が作られる。
(defvar spacemacs-evil-cursors '(("normal" "DarkGoldenrod2" box)
("insert" "chartreuse3" (bar . 2))
("emacs" "SkyBlue2" box)
("hybrid" "SkyBlue2" (bar . 2))
("replace" "chocolate" (hbar . 2))
("evilified" "LightGoldenrod3" box)
("visual" "gray" (hbar . 2))
("motion" "plum3" box)
("lisp" "HotPink1" box)
("iedit" "firebrick1" box)
("iedit-insert" "firebrick1" (bar . 2)))
"Colors assigned to evil states with cursor definitions.")
カーソルの形状を変更する場合は以下のようにしても設定可能、たとえば hybrid モードのカーソルを bar から box に変更するには
(setq evil-hybrid-state-cursor '("SkyBlue2" box))
mode-line の表示色の変更
- おそらく spaceline の設定から辿れそう。
- デフォルトはわかりにくい
- spacemacs-%S-face を変更するだけだと powerline フォントの部分が変更されない
- spacemacs-evil-cursors を直接変更すれば期待通りになるが、powerline フォント用にこの値を渡している場所がわからない
キーバインドに bind-key を使う
- use-package を使うのに,bind-key ではなく define-key を使う理由がわからん.
- 内部では普通に (require 'bind-key) を呼びだしているので、使えそう
org-mode の header のカスタム face を無効にする
一時的に無効にする
M-x(SPC SPC) org-bullet-mode
特定のファイルだけ無効にする
以下の内容をファイルに追記する
# Local Variables:
# eval: (org-bullets-mode 0)
# End:
完全に無効化する
(dotspacemacs-excluded-packages '(org-bullets))
init-loader を使う
user-config の中に以下の設定を入れて使えた.
Messeage を見ると,user-config はかなり後で呼ばれるので,一部は user-init から個別に load するように変更する.
(when (require 'init-loader nil t)
(init-loader-load "~/.spacemacs.d/inits"))
設定ファイルのロード順序
message コマンドでファイルのロード順序を確認
Loading /home/hoge/.emacs.d/core/core-load-paths.el (source)...done
Loading /home/hoge/.spacemacs.d/init.el (source)...done
debug: dotspacemacs/init
debug: user-init
... user-init で別ファイルのロード
Loading /home/hoge/dotfiles/dot.spacemacs.d/before-init.el (source)...
before init
Loading /home/hoge/dotfiles/dot.spacemacs.d/before-init.el (source)...done
Setting the font...
PNG warning: Interlace handling should be turned on when using png_read_image
Open the quickhelp.
... layers ファイルのロード
Spacemacs is ready.
... ここから user-config の設定
... init-loader でファイルの読み込み
Require success: init-loader
Loading /home/hoge/.spacemacs.d/inits/00_init.el (source)...
test init loader
Loading /home/kyamada/.spacemacs.d/inits/00_init.el (source)...done
debug: init-loader
... user-config の最後で別ファイルのロード
Loading /home/hoge/dotfiles/dot.spacemacs.d/after-init.el (source)...
after init
Loading /home/hoge/dotfiles/dot.spacemacs.d/after-init.el (source)...done
参考
- evil-mode :: https://github.com/emacs-evil/evil
- rainbow-delimiters("rainbow parentheses) :: https://github.com/Fanael/rainbow-delimiters
- spaceline :: https://github.com/TheBB/spaceline
mozc の挙動
mozc が on のまま hybrid-state から normal-state に移行して
normal-state にいるときに mozc を off にすると期待している動作にならないのでメモをする。
Key | state | IME1 | IME2 | memo |
---|---|---|---|---|
start | normal | off | off | |
i | hybrid | off | off | |
KANJI | hybrid | on | on | |
ESC | normail | on | on or off | <- vi コマンドを受け付ける |
KANJI | normail | off | on or off | <- vi コマンドを受け付ける |
i | hybrid | off | on | <- modeline は off だが日本語入力できる |
KANJI | hybrid | on | on | <- nodeline が on になり、日本語入力は維持 |
KANJI | hybrid | off | off | <- off になる |
IME1 : modeline の表示
IME2 : 実際の動作
mozc 挙動対策
自分の使い方の場合 state 移行時に ime の状態を覚えておく必要性は低いので
以下の設定で使い勝手がかなり良くなった。
- hybrid state の時だけ IME On/Off 可能
- hybrid state から抜けるときに IME を必ず Off
(defun toggle-ime ()
(interactive)
(when (eq evil-state 'hybrid)
(toggle-input-method)))
(bind-key [zenkaku-hankaku] 'toggle-ime)
(defun force-ime-off ()
(interactive)
(when current-input-method
(evil-deactivate-input-method)))
(add-hook 'evil-hybrid-state-exit-hook 'force-ime-off)
現在の設定
(defun dotspacemacs/user-config () ""
(require 'use-package)
(require 'bind-key)
(setq my:v:text-dir (concat (getenv "HOME") "/memo-rep"))
(setq open-junk-file-format (concat my:v:text-dir "/%Y/%m/%Y-%m-%d."))
(set-face-attribute 'default nil :family my:v:font-family-ascii)
(set-face-font 'fixed-pitch (face-font 'default) nil)
;;
;; init-loader
;;
(my:m:require-and-when 'init-loader
(progn
(init-loader-load "~/.spacemacs.d/inits")
(message "debug: init-loader")
))
(setq cljr-inject-dependencies-at-jack-in nil)
;; (setq cider-repl-display-in-current-window t)
(setq inferior-lisp-program "/usr/bin/sbcl")
(setq geiser-active-implementations '(chicken))
(setq geiser-repl-use-other-window nil)
(with-eval-after-load 'geiser
(message "debug: geiser")
(evil-collection-init 'geiser)
(push '("*Geiser dbg*") popwin:special-display-config)
)
(with-eval-after-load 'company
(setq company-minimum-prefix-length 3) ; default: 4
(bind-keys :map company-active-map
; 'company-indent-or-complete-common
("<return>" . company-abort)
("RET" . company-abort)
("<tab>" . company-complete-selection)
("C-SPC" . company-complete-selection)))
(with-eval-after-load 'ivy
(setf (cdr (assoc 'counsel-M-x ivy-initial-inputs-alist)) ""))
(with-eval-after-load 'markdown-mode
(setq tab-width 2)
(setq markdown-asymmetric-header t))
;; mozc
(my:m:require-and-when 'mozc
(require 'mozc-popup)
(setq default-input-method "japanese-mozc")
;; (global-set-key [zenkaku-hankaku] 'toggle-input-method)
(bind-key [zenkaku-hankaku] 'toggle-input-method)
(custom-set-variables '(mozc-leim-title "[も]"))
(setq mozc-candidate-style 'popup))
(with-eval-after-load 'open-junk-file
(message "debug: eval after open-junk-file loaded")
(setq open-junk-file-format (concat my:v:text-dir "/%Y/%m/%Y-%m-%d.")))
(with-eval-after-load 'org
(setq org-directory my:v:text-dir)
(load-library "find-lisp")
(setq org-agenda-files (find-lisp-find-files (concat org-directory "/org") "\.org$"))
(setq org-archive-location
(concat my:v:text-dir "/org/archive/archive-"
(format-time-string "%Y%m" (current-time)) ".org_archive::"))
(org-defkey org-mode-map [(meta return)] 'org-meta-return)
(setq org-blank-before-new-entry
'((heading . always)
(plain-list-item . nil)))
(defun org-capture-journal-filename ()
(format-time-string "%Y/%m/%Y-%m-%d.org"))
(setq org-src-fontify-natively t)
;; (setq org-indent-indentation-per-level 2)
(setq org-log-done 'time)
(setq org-todo-keywords
'((sequence "TODO(t)" "DOING(i)" "|" "DONE(d)" "DEFERRED(e)" "CANCEL(c)" "SOMEDAY(s)")
(type "ARTICLE(a)")
(type "MEMO(m)")
))
(setq org-capture-templates
`(("t" "Todo" entry (file+headline "org/todo.org" "New Task")
"* TODO %?\n %i\n %a"
:empty-lines 1)
("a" "Appointment" entry (file+headline "org/test.org" "Calendar")
"* APPT %^{Description} %^g % Added: %U")
("n" "Notes" entry (file+datetree "org/test.org")
"* %^{Description} %^g %? Added: %U")
("c" "Task Diary" entry (file+datetree "org/test.org")
"* TODO %^{Description} %^g %? Added: %U")
("f" "Log Time" entry (file+datetree "org/test.org" )
"** %U - %^{Activity} :TIME:")
("g" "English" item (file+headline "org/test.org" "English")
"- %^{Word} :: %? % Added: %U")
("b" "Log" entry (file ,(org-capture-journal-filename))
"* %U\n %?\n %i\n %c\n %a"
:empty-lines 1)
("j" "Journal" entry (file+datetree "org/journal.org" )
"* %?\n\nEntered on %U\n %i\n %a\n\n"
:empty-lines 1)))
;; 検索結果を indirect-buffer で開く
;; http://emacs.rubikitch.com/org-sparse-tree-indirect-buffer/
(defun org-sparse-tree-indirect-buffer (arg)
(interactive "P")
(let ((ibuf (switch-to-buffer (org-get-indirect-buffer))))
(condition-case _
(org-sparse-tree arg)
(quit (kill-buffer ibuf)))))
(set-face-attribute 'org-level-1 nil :height 1.0)
(set-face-attribute 'org-document-title nil :height 1.0))
(with-eval-after-load 'smartparens
(sp-use-smartparens-bindings)
(bind-keys :map smartparens-mode-map
("C-M-n" . sp-beginning-of-next-sexp) ;; default sp-next-sexp
("C-M-p" . sp-beginning-of-previous-sexp) ;; default sp-previous-sexp
("M-C" . sp-wrap-round)
("C-)" . sp-forward-slurp-sexp)
("C-}" . sp-forward-barf-sexp)
("C-(" . sp-backward-slurp-sexp)))
(spacemacs|diminish hybrid-mode "" "")
(spacemacs|diminish which-key-mode "" "")
(save-place-mode 0)
)
素の Emacs に use-package でインストールしていたパッケージ
移行検討要(spacemacs の標準 layer、同等機能あり、移行要)
spacemacs 標準
- company
- counsel
- ivy
- ivy-rich
- magit
- markdown-mode
- open-junk-file :: spacemacs/open-junk-file
- org
- ox-gfm
- recentf
- smartparens
- swiper
- yasnippet
- yasnippet-snippets
未確認
- ag
- autoinsert
- color-moccur
- color-theme
- easy-kill
- ensime
- moccur-edit
- ox-qmd
- sbt-mode
- scala-mode
- search-web
- server
- stem
- twittering-mode
- wanderlust
- wgrep
- wgrep-ag
- zenburn-theme