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

Adding nvim-cmp plugin #25

Merged
merged 15 commits into from Jul 28, 2022
Merged

Adding nvim-cmp plugin #25

merged 15 commits into from Jul 28, 2022

Conversation

Alexnortung
Copy link
Contributor

@Alexnortung Alexnortung commented Jul 17, 2022

This pull request is a draft just to share my initial work on this.

As a user of nvim-cmp, I think it would be nice to have cmp as a module which this pull request aims to add.

If you have any inputs to this or any suggestions on how to improve it, please add a comment.

I will probably finish this over the next couple of days.

Config options completed:

  • enabled
  • performance
  • preselect
  • mapping
  • snippet
  • completion
  • confirmation
  • formatting
  • matching
  • sorting
  • sources
  • view
  • window
  • experimental

@Alexnortung
Copy link
Contributor Author

Alexnortung commented Jul 18, 2022

In a6be8f0 I have added a lot of cmp source plugins.
The goal was to make nixvim automatically detect if a source was added to the source array and then enable the plugin. However this lead to infinite recursion for some reason and I have no idea why, I hope someone can take a look at it.
Please let me know if you have questions.

Edit: to be more accurate, the code that gives infinite recursion is on the following lines https://github.com/pta2002/nixvim/pull/25/files#diff-98662669466febb1092560d3d70ddf0ac38aa1b5fb1a66bd4aae8b4f1de6cb76R324-R336

@pta2002
Copy link
Collaborator

pta2002 commented Jul 18, 2022

Hi! I'd love to have nvim-cmp on NixVim, actually setting up LSP and autocomplete automatically was what made me create it in the first place, just never got around to finishing support... 😅 So this is definitely extremely welcome!

Unfortunately I can't review this right now though, as I'm away for vacation and will be for the next two weeks, but I'll make sure to check it out. If you can get it working and can confirm it works, I'll merge it though!

@Alexnortung
Copy link
Contributor Author

Everything should work now, I haven't tested out all options, since I am not completely sure on some of them.
Source plugins will be automatically installed, but weirdly enough from the plugins that I tested it cannot find the cmp-nvim-lsp plugin.

I think this must be a problem with the nix package of the plugin.

Output from :CmpStatus

# ready source names
- buffer
- path
- luasnip

# unknown source names
- nvim_lsp

But the plugin is installed as I can see from the following output

$ ls /nix/store/vyjg8p1cn68yd633ksl63x6q3qhilizf-vim-pack-dir/pack/home-manager/start/ | grep cmp-nvim-lsp
cmp-nvim-lsp

Anyway I think the module is fine and is ready for merge, but I might tidy up some of the code.

@Alexnortung Alexnortung marked this pull request as ready for review July 19, 2022 21:50
@pta2002
Copy link
Collaborator

pta2002 commented Jul 20, 2022

Could you maybe try using cmp-nvim-lsp as the source name?

@Alexnortung
Copy link
Contributor Author

I tried with cmp-nvim-lsp and nvim-lsp, but I just get the same output from :CmpStatus

@pta2002
Copy link
Collaborator

pta2002 commented Jul 28, 2022

Alright then, gonna merge this, but please open an issue for the non working plugin.

@pta2002 pta2002 merged commit f12a79b into nix-community:main Jul 28, 2022
@Alexnortung Alexnortung deleted the cmp branch July 28, 2022 19:53
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.

None yet

2 participants