mirror of
https://github.com/neovide/neovide.git
synced 2026-09-10 07:16:25 -04:00
feat: support working directory via env and config (#3301)
This commit is contained in:
parent
9fcbdef17c
commit
822874fd4f
|
|
@ -159,7 +159,7 @@ pub struct CmdLineSettings {
|
|||
pub opengl: bool,
|
||||
|
||||
/// Change to this directory during startup.
|
||||
#[arg(long = "chdir")]
|
||||
#[arg(long = "chdir", env = "NEOVIDE_CHDIR")]
|
||||
pub chdir: Option<String>,
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -60,6 +60,7 @@ pub struct Config {
|
|||
pub wsl: Option<bool>,
|
||||
pub backtraces_path: Option<PathBuf>,
|
||||
pub icon: Option<String>,
|
||||
pub chdir: Option<PathBuf>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
|
|
@ -125,6 +126,9 @@ impl Config {
|
|||
if let Some(icon) = &self.icon {
|
||||
env::set_var("NEOVIDE_ICON", icon);
|
||||
}
|
||||
if let Some(chdir) = &self.chdir {
|
||||
env::set_var("NEOVIDE_CHDIR", chdir.to_string_lossy().to_string());
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: should maybe return well-typed error?
|
||||
|
|
|
|||
|
|
@ -273,9 +273,12 @@ Wayland, depending on what you are running on.
|
|||
### Working Directory
|
||||
|
||||
```sh
|
||||
--chdir <path>
|
||||
--chdir <path> or $NEOVIDE_CHDIR
|
||||
```
|
||||
|
||||
**Unreleased yet.**
|
||||
|
||||
Start neovim in the specified working directory. This will impact neovim
|
||||
arguments that use relative path names (e.g. file names), and the initial
|
||||
working directory for all instances of neovim or terminal.
|
||||
working directory for all instances of neovim or terminal. This value can
|
||||
also be set via the `chdir` entry in the [Neovide Config File](config-file.md).
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ Settings currently available in the config file with default values:
|
|||
|
||||
```toml
|
||||
backtraces_path = "/path/to/neovide_backtraces.log" # see below for the default platform specific location
|
||||
chdir = "/path/to/dir"
|
||||
fork = false
|
||||
frame = "full"
|
||||
idle = true
|
||||
|
|
|
|||
Loading…
Reference in a new issue