-
-
Notifications
You must be signed in to change notification settings - Fork 15.4k
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
vimUtils: customize accepts alternate {g}vimExecutable value #87639
Conversation
This enables vim implementations that don't strictly use the "vim" and "gvim" pattern for CLI and graphical respectively to still be wrapped using customize so that a vimrc can be generated. The primary example is MacVim on Darwin, which uses "vim" and "mvim".
An alternate idea I had but more invasive was to change |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Workflow looks to be transparent to users that are already using this.
Also, thanks for opening your first PR with nixpkgs @mitchellh :) |
If an installation of gvim and macvim are mutually exclusive, then it may also make sense for the macvim package to also export a This could be similar to |
Ah! So MacVim does BOTH so it supports gvim already. But at least in circles I’m familiar with it seems more idiomatic on Mac to use “mvim”. So this is just trying to get nix to play nice with the idiom. Hence that other comment of proposing maybe a new config to support multiple but that’d be a deeper change. I’m open to any of this |
I see two alternative options: The most expressiveway to model this would be a mapping from input name to output name (deprecating wrapperMapping = {
"vim" = "my-custom-vim-executable-name";
"gvim" = "gvim";
} The simplest way to do it would be to just always wrap Those are the two ends of the complexity spectrum, with your solution living somewhere in the middle. I think I'd favor the simplest option, configuring vim is already complicated enough. |
What do you view as the “simplest”? I’m fine with whatever you think should be done and I’m happy to make those changes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
assuming that name
is usually vim
and gvimExecutableName
is usually gvim, I think this was the original intended behavior.
vimExecutable ? "vim", | ||
gvimExecutable ? "gvim", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
vimExecutable ? "vim", | |
gvimExecutable ? "gvim", |
vimExecutable = "${vim}/bin/${vimExecutable}"; | ||
gvimExecutable = "${vim}/bin/${gvimExecutable}"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
vimExecutable = "${vim}/bin/${vimExecutable}"; | |
gvimExecutable = "${vim}/bin/${gvimExecutable}"; | |
vimExecutable = "${vim}/bin/${vimExecutableName}"; | |
gvimExecutable = "${vim}/bin/${gvimExecutableName}"; |
I'm good with those suggestions of reusing the existing arguments in a smarter way. I think that has a bigger risk of breaking userspace if anyone out there is doing something wacky like |
The second option, having it "just work". That means I'd wait until at least one other person agrees with this before implementing it though. The current implementation is also fine, but I'm very hesitant to add even more complexity to the vim configuration from a user perspective.
Yes, support renaming the executable is exactly the thing which I think should not have been added in the first place. Now it would need proper deprecation to remove though, which is out of scope for this PR. |
Agreed @timokau. @jonringer not sure what your thumbs up on my last comment is supposed to imply 😄 |
I'm largely of the opinion that the macvim package should just also export a
|
Just agreeing that it has the potential to break users who have set it to something else. |
It already does this, and this works no problem. Its just more idiomatic to use |
Oh, right, the mvim isn't being modified by home-manager, so it's just a vanilla experience. "In computer science, there's three values which make sense: 0, 1, many" |
If you then make that silently ignore the case where the executable is not present and default to If we wanted to get fancy, we could also add a |
Might be of interest #101265 . You could expose lower-level APIs so that the caller can customize the wrapper arguments itself. |
totally forgot about dealing with the 20.09 release. |
@mitchellh @jonringer ping |
I marked this as stale due to inactivity. → More info |
Motivation for this change
I use Nix on darwin and use MacVim. MacVim uses "mvim" as the shell executable to launch the GUI version. I want to wrap
pkgs.macvim
withvimUtil.makeCustomizable
so I can customize the vimrc but this doesn't work because of the hardcoded "vim" and "gvim" executables.I have to use
makeCustomizable
rather than callvimWithRC
directly becauseprograms.vim
in home-manager usespkgs.vim_configurable
to set all the Vim settings. So I have to make an overlay that setspkgs.vim_configurable
to the customizable version of macvim. But this is a blocker! See the vim module in home-manager here. Also, callingvimWithRC
directly in general feels kinda weird, like I'm digging too far into the abstraction.This introduces an argument to set the base name for these commands. I'm unsure what to name this so open to other requests.
This is my first PR so please let me know what else needs to be done. I followed the CONTRIBUTING.md guidelines as close as possible!
Things done
sandbox
innix.conf
on non-NixOS linux)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
./result/bin/
)nix path-info -S
before and after)