Top/Editor/emacs/neotree

目次

neotree

環境構築

  1. 以下を git clone する
    repositoryURIremark
    neotreehttps://github.com/jaypei/emacs-neotree.git
    all-the-iconshttps://github.com/domtronn/all-the-icons.el.gitneotree が依存している
    memoizehttps://github.com/skeeto/emacs-memoize.gitall-the-icons が依存している

  2. 設定する
    ;;; neotree
    ;; emacs-memoize は、all-the-icons が依存している
    ;; 設定後初回起動は、M-x all-the-icons-install-fonts でフォントを DL する必要がある
    ;;   -> ${HOME}/.local/share/fonts に保存される
    ;;
    
    (setq load-path (cons (expand-file-name "~/.emacs.d/site-lisp/emacs-memoize") load-path))
    (setq load-path (cons (expand-file-name "~/.emacs.d/site-lisp/all-the-icons") load-path))
    (setq load-path (cons (expand-file-name "~/.emacs.d/site-lisp/emacs-neotree") load-path))
    
    
    (use-package neotree
      :init
      (setq-default neo-keymap-style 'concise)
      :config
      (setq neo-smart-open t)
      (setq neo-create-file-auto-open t)
      (setq neo-theme (if (display-graphic-p) 'icons 'arrow))
      (bind-key [f8] 'neotree-toggle)
      (bind-key "RET" 'neotree-enter-hide neotree-mode-map)
      (bind-key "a" 'neotree-hidden-file-toggle neotree-mode-map)
      (bind-key "<left>" 'neotree-select-up-node neotree-mode-map)
      (bind-key "<right>" 'neotree-change-root neotree-mode-map))
    
    
    ;; Change neotree's font size
    ;; Tips from https://github.com/jaypei/emacs-neotree/issues/218
    (defun neotree-text-scale ()
      "Text scale for neotree."
      (interactive)
      (text-scale-adjust 0)
      (text-scale-decrease 1)
      (message nil))
    (add-hook 'neo-after-create-hook
          (lambda (_)
            (call-interactively 'neotree-text-scale)))
    
    ;; neotree enter hide
    ;; Tips from https://github.com/jaypei/emacs-neotree/issues/77
    (defun neo-open-file-hide (full-path &optional arg)
      "Open file and hiding neotree.
    The description of FULL-PATH & ARG is in `neotree-enter'."
      (neo-global--select-mru-window arg)
      (find-file full-path)
      (neotree-hide))
    
    (defun neotree-enter-hide (&optional arg)
      "Neo-open-file-hide if file, Neo-open-dir if dir.
    The description of ARG is in `neo-buffer--execute'."
      (interactive "P")
      (neo-buffer--execute arg 'neo-open-file-hide 'neo-open-dir))

  3. 設定後初回の emacs 起動時に、以下のコマンドでフォントを DL する:
    M-x all-the-icons-install-fonts 
    • ${HOME}/.local/share/fonts に保存される

参考 URI


トップ   編集 凍結 差分 履歴 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: 2020-08-15 (土) 12:35:37