The only way i know to make NeoTree show hidden files is to use neotree-hidden-file-toggle, but this is meant to be used interactively when the NeoTree buffer is the active buffer. Is there a way to globally set in my .emacs init file to make NeoTree always have the behavior of showing hidden files?


Found here: https://github.com/jaypei/emacs-neotree/issues/117#issuecomment-126751086

add (setq-default neo-show-hidden-files t) to your init.el.

Just in case you use Spacemacs: add '(neo-show-hidden-files t) in custom-set-variables of your .spacemacs file.

  • 1
    When a variable is global (like neo-show-hidden-files), setq is sufficient. setq-default is generally used for things like buffer-local variables where a user wishes to start with a particular default value which may or may not be set differently in certain buffers. Using setq-default in an answer leads the reader to believe that the variable is buffer-local, which is not the case here. – lawlist May 25 '17 at 18:27
  • @lawlist Thank you rounding out the answer. However, I actually do want to be able to set this differently in different NeoTree buffers, so only setting the initial default buffer behavior is correct. Thus the answer is best suited to my needs, even though my question doesn't indicate the need for such flexibility. – eestrada May 27 '17 at 16:55
  • 1
    @eestrada -- Making a global variable capable of buffer local settings is normally achieved by adding (make-variable-buffer-local 'neo-show-hidden-files) and then it can be set locally in any buffer using setq. However, it is possible to use setq-local to make a global variable local in a current buffer. There are a few other methods to take a global variable and use it locally ... – lawlist May 27 '17 at 17:04
  • 1
    Shouldn't the instructions for spacemacs say the same thing, that is to use t instead of nil? – Juraj Martinka Oct 13 '20 at 5:43
  • @JurajMartinka you are correct. I don't know what i was thinking back then. I updated the answer. Thanks! – Mingwei Zhang Oct 13 '20 at 14:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.