Skip to content

allow for arguments in EDITOR and VISUAL env vars - #8105

Merged
fdncred merged 3 commits into
nushell:mainfrom
merelymyself:main
Feb 26, 2023
Merged

fdncred merged 3 commits into
nushell:mainfrom
merelymyself:main

Conversation

@merelymyself

Copy link
Copy Markdown
Contributor

Description

Fixes #8051.

User-Facing Changes

You can now put command arguments into the EDITOR and VISUAL config / env variables.

Tests + Formatting

I don't know how to write tests for this. However, I set $env.EDITOR to "nvim -R" and it seemed to work.

After Submitting

If your PR had any user-facing changes, update the documentation after the PR is merged, if necessary. This will help us keep the docs up to date.

@codecov

codecov Bot commented Feb 18, 2023 •

Copy link
Copy Markdown

Codecov Report

Merging #8105 (df2da18) into main (66398fb) will decrease coverage by 0.02%.
The diff coverage is 0.00%.

❗ Current head df2da18 differs from pull request most recent head 9360660. Consider uploading reports for the commit 9360660 to get more accurate results

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #8105      +/-   ##
==========================================
- Coverage   54.61%   54.59%   -0.02%     
==========================================
  Files         608      608              
  Lines       99003    99027      +24     
==========================================
+ Hits        54066    54067       +1     
- Misses      44937    44960      +23     
Impacted Files Coverage Δ
crates/nu-command/src/env/config/config_env.rs 28.98% <0.00%> (-3.28%) ⬇️
crates/nu-command/src/env/config/config_nu.rs 28.98% <0.00%> (-3.28%) ⬇️
crates/nu-command/src/env/config/utils.rs 0.00% <0.00%> (ø)
crates/nu-protocol/src/value/mod.rs 47.52% <0.00%> (+0.03%) ⬆️

@sholderbach

Copy link
Copy Markdown
Member

Thanks for tackling this! Fixing the invocations of the editors is definitely the right place.

Kind of annoying that we have this copy-paste duplication in the code for config nu and config env already. I think especially as the code grows with this patch it should be refactored out into its own function.

We also should validate that the Ctrl-O keybinding that launches an editor from reedline is tolerant to arguments.

@merelymyself

Copy link
Copy Markdown
Contributor Author

I've opened a PR for reedline to make Ctrl+O work: nushell/reedline#544

@fdncred
fdncred merged commit 9bbb971 into nushell:main Feb 26, 2023
@fdncred

fdncred commented Feb 26, 2023

Copy link
Copy Markdown
Contributor

Thanks for this + the refactor!

@bminer

bminer commented Nov 20, 2024

Copy link
Copy Markdown

Note to users: Please use a list of arguments instead of space-delimited command.

See #10210

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

EDITOR cannot contain arguments

4 participants