configs: use Notepad as default editor on Windows

This commit is contained in:
Martin von Zweigbergk 2023-08-10 08:50:25 -07:00 committed by Martin von Zweigbergk
parent 32b07d6b79
commit a367f13c72
9 changed files with 22 additions and 11 deletions

View file

@ -27,6 +27,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* The `push.branch-prefix` option was renamed to `git.push-branch-prefix`. * The `push.branch-prefix` option was renamed to `git.push-branch-prefix`.
* The default editor on Windows is now `Notepad` instead of `pico`.
### New features ### New features
* `jj init --git-repo` now works with bare repositories. * `jj init --git-repo` now works with bare repositories.

View file

@ -433,7 +433,7 @@ struct InterdiffArgs {
/// Update the change description or other metadata /// Update the change description or other metadata
/// ///
/// Starts an editor to let you edit the description of a change. The editor /// Starts an editor to let you edit the description of a change. The editor
/// will be $EDITOR, or `pico` if that's not defined. /// will be $EDITOR, or `pico` if that's not defined (`Notepad` on Windows).
#[derive(clap::Args, Clone, Debug)] #[derive(clap::Args, Clone, Debug)]
struct DescribeArgs { struct DescribeArgs {
/// The revision whose description to edit /// The revision whose description to edit

View file

@ -343,13 +343,18 @@ pub fn default_config() -> config::Config {
config::File::from_str(include_str!($file), config::FileFormat::Toml) config::File::from_str(include_str!($file), config::FileFormat::Toml)
}; };
} }
config::Config::builder() let mut builder = config::Config::builder()
.add_source(from_toml!("config/colors.toml")) .add_source(from_toml!("config/colors.toml"))
.add_source(from_toml!("config/merge_tools.toml")) .add_source(from_toml!("config/merge_tools.toml"))
.add_source(from_toml!("config/misc.toml")) .add_source(from_toml!("config/misc.toml"))
.add_source(from_toml!("config/templates.toml")) .add_source(from_toml!("config/templates.toml"));
.build() if cfg!(unix) {
.unwrap() builder = builder.add_source(from_toml!("config/unix.toml"))
}
if cfg!(windows) {
builder = builder.add_source(from_toml!("config/windows.toml"))
}
builder.build().unwrap()
} }
/// Environment variables that override config values /// Environment variables that override config values

View file

@ -5,6 +5,5 @@
# Placeholder: added by user # Placeholder: added by user
[ui] [ui]
editor = "pico"
pager = { command = ["less", "-FRX"], env = { LESSCHARSET = "utf-8" } } pager = { command = ["less", "-FRX"], env = { LESSCHARSET = "utf-8" } }
log-word-wrap = false log-word-wrap = false

2
cli/src/config/unix.toml Normal file
View file

@ -0,0 +1,2 @@
[ui]
editor = "pico"

View file

@ -0,0 +1,2 @@
[ui]
editor = "Notepad"

View file

@ -294,8 +294,8 @@ a `$`):
`$JJ_EDITOR` > `ui.editor` > `$VISUAL` > `$EDITOR` `$JJ_EDITOR` > `ui.editor` > `$VISUAL` > `$EDITOR`
Pico is the default editor in the absence of any other setting, but you could Pico is the default editor (Notepad on Windows) in the absence of any other
set it explicitly too. setting, but you could set it explicitly too.
```toml ```toml
ui.editor = "pico" ui.editor = "pico"

View file

@ -7,7 +7,7 @@ user.email = "YOUR_EMAIL@example.com"
ui.color = "auto" # the default ui.color = "auto" # the default
# ui.color = never # no color # ui.color = never # no color
ui.editor = "pico" # the default ui.editor = "pico" # the default on Unix
# ui.editor = "vim" # ui.editor = "vim"
ui.diff-editor = "meld" # default, requires meld to be installed ui.diff-editor = "meld" # default, requires meld to be installed

View file

@ -39,8 +39,9 @@ Now let's say we want to edit the `README` file in the repo to say "Goodbye"
instead of "Hello". Let's start by describing the change (adding a instead of "Hello". Let's start by describing the change (adding a
commit message) so we don't forget what we're working on: commit message) so we don't forget what we're working on:
```shell script ```shell script
# This will bring up $EDITOR (or `pico` by default). Enter something like # This will bring up $EDITOR (or `pico` or `Notepad` by default). Enter
# "Say goodbye" in the editor and then save the file and close the editor. # something like "Say goodbye" in the editor and then save the file and close
# the editor.
$ jj describe $ jj describe
Working copy now at: e427edcfd0ba Say goodbye Working copy now at: e427edcfd0ba Say goodbye
``` ```