Skip to content
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

neovim: add config to passthru #101100

Merged
merged 1 commit into from Oct 20, 2020
Merged

neovim: add config to passthru #101100

merged 1 commit into from Oct 20, 2020

Conversation

teto
Copy link
Member

@teto teto commented Oct 19, 2020

  • register the config in the store under the name init.vim which is more
    appropriate for neovim.
  • generated config added to passthru so that one can easily pass the current config to a raw/unwrapped neovim (helps with development).

For instance, home-manager could reference the config in $XDG_CONFIG_HOME/nvim/init.vim
without the need to wrap nvim with a --cmd.

I develop on neovim and I would like to run the raw binary with the nix generated config but because it keeps changing name it's not always easy. This adds an easy way out.

cc @timokau

Motivation for this change
Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@teto teto requested a review from jonringer as a code owner October 19, 2020 22:39
@ofborg ofborg bot added the 6.topic: vim label Oct 19, 2020
Copy link
Member

@timokau timokau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ofBorg eval fails, but other than that looks good to me 👍

pkgs/applications/editors/neovim/wrapper.nix Outdated Show resolved Hide resolved
first will register the config under the name init.vim which is more
appropriate for neovim.
Pass the generated config to passthru so that one can easily pass the
current config to a
raw/unwrapped neovim (helps with development).

For instance, home-manager can reference the config in $XDG_CONFIG_HOME/nvim/init.vim
without the need to wrap nvim with its config.
@teto
Copy link
Member Author

teto commented Oct 20, 2020

thnaks for the review. I had forgotten to cherry-pick some changes from my fork of nixpkgs. It should be good now.

@teto
Copy link
Member Author

teto commented Oct 20, 2020

actually hold on I might have a better idea than this PR. will reopen when I sort it out.

EDIT: the alternative looks a bit complex so I will postpone it.

@teto teto closed this Oct 20, 2020
@teto teto reopened this Oct 20, 2020
@teto teto merged commit 4c4c487 into NixOS:master Oct 20, 2020
@teto teto deleted the neovim_module2 branch October 20, 2020 10:26
@teto
Copy link
Member Author

teto commented Oct 20, 2020

the problem (in my usage etc) is that the wrapper writes the file. I am preparing a PR with a function genNeovimConfig that returns { wrapperFlags, rcContent } so that the caller can choose wether or not to wrap neovim with -u init.vim (which breaks neovim behavior and is not necessary in home-manager, which could write the file in ~/.config/nvim/init.vim

@teto
Copy link
Member Author

teto commented Oct 20, 2020

finally got my genNeovimConfig working \o/ will post after cleanup (this WE ?). Got it integrated with my home-manager fork and the experience is much more pleasant.

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

Successfully merging this pull request may close these issues.

None yet

2 participants