4DA / eshell-toggle

Show/hide eshell at the bottom of active window with directory of its buffer
39 stars 14 forks source link

Allow `eshell-toggle-init-eshell` to search Git root. #12

Closed keyehzy closed 4 years ago

keyehzy commented 4 years ago

This commit allows eshell-toggle-init-eshell to first look for Git root directory first, if not found falls back to default DIR.

In principle this can be refactored out as a function that returns DIR (default-directory or/and look for Git root directory if user choose so) and let eshell-toggle-init-eshell, eshell-toggle-init-ansi-term and eshell-toggle-init-tmux fetch from it.

4DA commented 4 years ago

This will be a great feature.

Please add defcustom similar to eshell-toggle-use-projectile-root to toggle this feature. I'd like to keep this feature disabled by default to preserve current behaviour for users.

Also, could you please extend eshell-toggle--get-directory() function so that it returns git-root-directory if eshell-toggle-use-projectile-root is not set and new eshell-toggle-use-git-root is set.

Thank you.

keyehzy commented 4 years ago

This last commit makes the modifications necessary to eshell-toggle--get-directory and creates a defcustom for the user.

Please tell me if everything is alright, I can squash the commits if want to.

One special case is when both projectile and git options are turned on. In this case projectile should come first in priority, I think this is OK, what do you think?