Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add autochdir option #2056

Closed
smolck opened this issue Apr 9, 2022 · 5 comments
Closed

Add autochdir option #2056

smolck opened this issue Apr 9, 2022 · 5 comments
Labels
A-helix-term Area: Helix term improvements C-enhancement Category: Improvements

Comments

@smolck
Copy link

smolck commented Apr 9, 2022

Describe your feature request

In Neovim, there's an option 'autochdir' that does the following:

'autochdir' 'acd'	boolean (default off)
			global
	When on, Vim will change the current working directory whenever you
	open a file, switch buffers, delete a buffer or open/close a window.
	It will change to the directory containing the file which was opened
	or selected.
	Note: When this option is on some plugins may not work.

I was wondering if something like this could be added to Helix?

(FWIW I actually managed to get it somewhat working but then realized what I had doesn't work for switching between splits, and probably several other edgecases I haven't considered, so figure it's probably best to make this issue about it.)

I will say that I've been using this option in Neovim for a while, but the more I think about it, this might not actually be a feature worth adding (and I might drop it from my neovim config actually). I'm honestly not sure, so interested to hear other's thoughts on this.

@smolck smolck added the C-enhancement Category: Improvements label Apr 9, 2022
@kirawi kirawi added the A-helix-term Area: Helix term improvements label Apr 9, 2022
@the-mikedavis
Copy link
Member

This could be interesting with something like the recently merged #1600. OTOH it seems like if I used it, I would end up having to think about which buffer I'm in before doing anything that takes the cwd into account which could be confusing.

@cjohansson
Copy link

Yes I would like this feature as well, Emacs works like this and you can have multiple projects open at the same time with different working directories

@noor-tg
Copy link

noor-tg commented Sep 2, 2022

I think this is a good feature . could the code related to this config be merged to allow the intended behavior ?
the author of the issue can make pull request as in autochdir or even if he is not available I could make a pull request with the same code.

@uncomfyhalomacro
Copy link
Contributor

uncomfyhalomacro commented Dec 19, 2022

This could be interesting with something like the recently merged #1600. OTOH it seems like if I used it, I would end up having to think about which buffer I'm in before doing anything that takes the cwd into account which could be confusing.

Maybe if it is enabled, there is an option to show the directory of the buffer. So here are a possible config options for this feature:

Defaults:

[editor]
autochdir = false  # by default, it is false

If enabled:

[editor.autochdir]
show-directory = false
truncation-length = 2  # truncate the directory paths as desired

I want it to be disabled by default since some people do get confused when it is enabled by default

@uncomfyhalomacro
Copy link
Contributor

There might be also an issue with the file-picker though. Maybe we could add an option to the file-picker too as well if we want it to respect the autochdir option or not from the editor section.

@helix-editor helix-editor locked and limited conversation to collaborators Apr 7, 2024
@pascalkuthe pascalkuthe converted this issue into discussion #10215 Apr 7, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
A-helix-term Area: Helix term improvements C-enhancement Category: Improvements
Projects
None yet
Development

No branches or pull requests

6 participants