I've used emacs in various configurations over the years, but the one aspect I couldn't find a good proxy for is relative directory logic.

My goal is to use evil-mode + web-mode. I'm not interested in doing everything possible in emacs. I just want really good vim emulation and syntax highlighting. I think emacs does a better job of these things at the cost of added complexity and trying to parse emacs-lisp.

In Sublime Text you can "open a folder" and then when you go to open a file it assumes it's contained within the "current" directory.

In VIM I can "cd" to a directory and all all files I open are relative to that directory i.e. "e foo/bar.py" in the command prompt assumes current_directory/foo/bar.py.

tl;dr Is there a simple way to "cd" to a folder, so that opening and searching for files to open are relative to that folder? I've tried dired & projectile but wonder if there's a much simpler option that more closely maps to the UX of vim.

1 Answer 1


There is command cd: M-x cd (or bind it to a key).

There is also Dired: C-x d, then C-h m. Or C-h r g dired, which takes you to node Dired of the Emacs manual.

Both of those should help you. See also variable default-directory, using C-h v.

C-h f cd tells you this:

cd is an interactive compiled Lisp function in files.el.

(cd DIR)

Make DIR become the current buffer’s default directory.

If your environment includes a CDPATH variable, try each one of that list of directories (separated by occurrences of path-separator) when resolving a relative directory name. The path separator is colon in GNU and GNU-like systems.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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