I am very new to emacs, I am trying to get a directory tree. I have followed another StackOverFlow Emacs dirtree question and my .emacs and .emacs-d are as follows:
.emacs
;; line number plugin
(add-to-list 'load-path' "~/.emacs-load-path")
(require 'linum)
(global-linum-mode 1)
;; auto complete plugin
(add-to-list 'load-path "~/.emacs.d")
(require 'auto-complete-config)
(add-to-list 'ac-dictionary-directories "~/.emacs.d/ac-dict")
(ac-config-default)
;; directory tree plugin
(add-to-list 'load-path "~/.emacs.d")
(require 'dirtree)
(require 'tree-mode)
(require 'windata)
(autoload 'dirtree "dirtree" "Add directory to tree view" t)
.emacs.d
dirtree.el
tree-mode.el
windata.el
My questions are:
Have I set this up correctly, if not, what do I need to do?
How do you launch and use dirtree in emacs?
I tested your setup (as close as I could) and it loads the dirtree functions (and dependencies) fine. The dirtree.el file tries to map Cntl-o (\C-o
) to dirtree-display
function but on my system that function fails.
Happily the function dirtree-show
works fine. To invoke it manually do:
M-x
(type Alt-x or Esc-x)dirtree-show
Take a look at the "Tree" menu (if you have menus showing in emacs) and it will show you the keystroke shortcuts you can use. ("e" will toggle expand/collaspe of the current node, for example.)
If you don't want to type M-x dirtree-show
each time, then you can bind a keystroke to it. I have bound Cntl-o like this in my .emacs:
(global-set-key "\C-o" 'dirtree-show)
So my full setup for dirtree is this:
(require 'tree-mode)
(require 'windata)
(require 'dirtree)
(autoload 'dirtree "dirtree" "Add directory to tree view" t)
(global-set-key "\C-o" 'dirtree-show)
Also, as far I can tell the line (autoload 'dirtree "dirtree" "Add directory to tree view" t)
isn't required for basic functionality, but perhaps it is needed for some feature I haven't used.
Lastly, just to make sure we are on the same page, I downloaded all the .el files for this from https://github.com/zkim/emacs-dirtree.
Try NeoTree. It's easy to install and easy to use.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With