-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
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
vimPlugins.fzf-vim: automatically add fzfWrapper #52685
Conversation
Can you recheck, please? I just tried this with the following expression on master (dee617c): with import ./. { };
vim_configurable.customize {
name = "vim";
vimrcConfig.vam = {
knownPlugins = pkgs.vimPlugins;
pluginDictionaries = [
{ name = "fzfWrapper"; }
{ name = "fzf-vim"; }
];
};
} With this VIM the commands EDIT: I misunderstood your comment I guess, I'll check if this is still the case as well :) |
I wrongly assumed that you meant the list of VIM plugins (i.e. in |
Hmm although the build itself works fine, the evaluation of a
|
Makes sense, since Maybe we can come up with a proper |
Thinking about it again: Shouldn't adding |
Actually testing it again now, it does work to simply add Can you confirm that this also works for you @Ma27? |
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.
Unfortunately this doesn't work for me (with fixed evaluation), :Files
still breaks in a vim configured by vim_configurable
with fzf-vim
loaded as plugin.
It works with packages but fails with vam. Adding let g:nix_plugin_locations = {}
let g:nix_plugin_locations['fzf-vim'] = "/nix/store/fkp4swn162iq7pp309srkp6z0sgl2fk6-vimplugin-fzf-vim-2018-12-11/share/vim-plugins/fzf-vim"
let g:nix_plugin_locations['fzf'] = "/nix/store/a9qnz59i7xgjlh57kg5jybqmdizqd3pb-vimplugin-fzf-0.17.5/share/vim-plugins/fzf"
let g:nix_plugin_locations['vim-addon-manager'] = "/nix/store/1xh8pflfs94f0cmii7cfq5j11k6by2aw-vimplugin-vim-addon-manager-2018-07-27/share/vim-plugins/vim-addon-manager"
[...]
call add(l, {'name': 'fzf-vim'}) while adding it manually to the dictionaries generates this: let g:nix_plugin_locations = {}
let g:nix_plugin_locations['fzf-vim'] = "/nix/store/fkp4swn162iq7pp309srkp6z0sgl2fk6-vimplugin-fzf-vim-2018-12-11/share/vim-plugins/fzf-vim"
let g:nix_plugin_locations['fzfWrapper'] = "/nix/store/a9qnz59i7xgjlh57kg5jybqmdizqd3pb-vimplugin-fzf-0.17.5/share/vim-plugins/fzf"
[...]
call add(l, {'name': 'fzf-vim'})
call add(l, {'name': 'fzfWrapper'}) So adding it to the deps uses the |
fzfWrapper is needed for fzf-vim to work.
This is probably something I messed up in my refactor. I pushed a commit that works at least in this case. However with vam, I really don't know what I'm doing. I removed the "vam plugin -> toNix" thing completely and replaced it by a simple name dictionary. That is probably not valid in some cases. |
WIth the latest patches the Pinging @Mic92 as he worked quite much on the vim-plugins sub-package. |
I wonder if we should reduce the number of plugin manager we support? |
Building and running all the vim tests seems to work: $ nix-build -A vimUtils |
No idea admittedly. I've been using vam for ~2 years now and I never had a reason to change that. |
@@ -27,6 +27,9 @@ self: super: { | |||
dependencies = with super; [ vim-addon-manager ]; | |||
}; | |||
|
|||
# Mainly used as a dependency for fzf-vim. Wraps the fzf program as a vim | |||
# plugin, since part of the fzf vim plugin is included in the main fzf | |||
# program. | |||
fzfWrapper = buildVimPluginFrom2Nix { |
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.
Do we need to expose it then to the user?
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.
Just having fzf-vim
there would create less confusion what the right package is.
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.
I think it makes sense to keep it because
- Backwards compatibility. No need to break the configuration of some users who have added
fzfWrapper
. - According to upstream's readme:
fzf in itself is not a Vim plugin, and the official repository only provides the basic wrapper function for Vim and it's up to the users to write their own Vim commands with it
So that sounds like fzfWrapper
is intended to be used by end-users. To be honest I doubt that there are many users that do this, but it makes sense to support.
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.
In that case I'd keep fzfWrapper
for now (at least) and do a proper deprecation phase.
With my refactors of the plugin infrastructure, I've noticed that pretty much every corner case is used by somebody (https://xkcd.com/1172/). While I wouldn't be opposed to remove stuff, there should be a proper deprecation period and I don't think we have deprecation quite figured out yet. Also there would be some bikeshedding to be done to select the "one true" implementation. VAM and "vim packages" are probably the only serious contenders. I'd argue that vim packages are the way to go nowadays (native upstream support, provides everything we need), but I'm sure some disagree. Also most "legacy" configurations will be VAM. |
Did you encounter any behavioral differences? Or is it possible that your changes in the plugin attr set breaks functionality?
If this simplifies things and the migration is not too hard, I'd say 👍 Unless I'm missing something, there shouldn't a big advantage from VAM. Do you want to open an issue to discuss about this? |
Behavioral differences between what? I haven't tested the VAM version thoroughly (i.e. I just made sure it starts and I've used the old
I've opened #56338. I do not intend to remove anything myself though, as I don't want to deal with the inevitable fallout of people complaining. |
I wanted to know if you observed any differences (or breakage) after changing the I can have a more detailed look at this at the end of the week, but I'm not sure about the consequences of this change as well ATM. |
Just dropping by. I haven't tried this branch, but in nixpkgs-unstable right now, it looks like there's a missing dependency on actual |
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.
Just dropping by. I haven't tried this branch, but in nixpkgs-unstable right now, it looks like there's a missing dependency on actual fzf, so :Files prompts to download a binary. nix-env -i fzf fixes it.
You're right, this probably got unnoticed, at least I have fzf
installed on my system. @timokau I assume this could be fixed by simply patching the Vim script's sources?
Judging from the sources, I currently don't think that this actually breaks a user's setup, we simply add transitive dependencies (if not specified manually in pluginDictionaries
), so if we hit an edge case, it's probably because of wrongly specified dependencies in overrides.nix
.
I tested this with my historically-grown Vim config and didn't encounter further issues. Also I tested several plugins with dependencies (fzf-vim, vim-bazel, ensime-vim) and the patch seems fine.
I'd suggest we merge this for now (not sure if this should be backported) and wait for further feedback.
@@ -291,7 +291,7 @@ let | |||
|
|||
" tell vam about which plugins to load when: | |||
let l = [] | |||
${lib.concatMapStrings (p: "call add(l, ${toNix p})\n") vam.pluginDictionaries} | |||
${lib.concatMapStrings (p: "call add(l, {'name': '${p.pname}'})\n") plugins} |
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.
With the removal of that reference, toNix
is not needed anymore.
Is anything holding back this PR? |
No worries, I just hit the same issue today so finding this PR was quite helpful actually. What will happen to users who already have both plugins in their list, will it de-duplicate? |
I'm not entirely sure anymore as it's some time ago that I had a closer look at this. Let me check what happens tonight on my setup ok? :) |
I don't remember the details with the different plugin managers, but if this works for everyone (or at least doesn't break anything), we can merge. Can't believe it has been 8 months already, didn't seem that long ago. Personally I've been using the original |
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.
As requested by @zimbatm I tested if this works with the old configuration (it appears to deduplicate) and with a vim config that only uses fzf-vim
. As this is a pretty confusing bug and I guess that it took most of us to find out the cause (or this PR) I guess that it's a good thing to merge this now 👍
@timokau thanks! |
Motivation for this change
fzf-vim doesn't work without "regular" fzf. Currently that makes it necessary to manually add both
fzf-vim
andfzfWrapper
.I don't think the
symlinkJoin
approach is ideal, but it is the best I could come up with (not being very familiar with the vim plugin infrastructure). Just adding"fzfWrapper"
to the dependencies offzf-vim
didn't work.CC @andsild
Things done
sandbox
innix.conf
on non-NixOS)nix-shell -p nox --run "nox-review wip"
./result/bin/
)nix path-info -S
before and after)