Another week, another plugin manager for vim...
github.com/wbthomason/packer.n

This one is written in and makes use of newly-added features... but is it worth the time to switch? VimPlug works just fine...

Follow

I actually tried out Packer and converted my neovim-only plugins from Plugger to Packer. It's not bad!

Until replaces the classic in most Linux distros, I want my .vimrc to work on both, so I am not going to convert everything to Lua.

And so I ended up with two competing plugin managers in my text editor 😅

· · Web · 2 · 0 · 0

Next, after freaking out at coq.nvim's complexity (it needs python3-venv and sqlite), I installed vim-cmp, which is entirely written in , and thus doesn't require compiling:
github.com/hrsh7th/nvim-cmp

One thing I didn't initially understand is that 's built-in LSP client isn't enough to get autocmpletion!

First, you need to configure which Language Server should be spawned for each file type you open. For this, there's nvim-lspconfig, which is maintained by the Neovim devs as a separate project:
github.com/neovim/nvim-lspconf

But wait! The LSP configuration needs to be configured... in Lua, of course! And don't forget to define some mappings for "Go To Definition" etc...

Do we have completion yet? Not so fast!

You see, has builtin completion, but what you really want for programming is *autocompletion*, which requires an external plugin:
github.com/neovim/nvim-lspconf

It says nvim-cmp is the recommended plugin, so it will be easy to integrate, right?

Easy peasy! My nvim-cmp configuration is only... 73 lines of config!

I copy-pasted most of the config, and when it breaks I'm not quite sure how to debug it.

In fact, it's not working right now. If I open a Rust project and start typing, I get plenty of useless snippets instead of the semantic completion. I see rust-analyzer running and eating CPU time... I even see inline errors... so why?

Why do I have to learn before I can code in ?

WHYYYY?!?! 😩

Hey, it seems I gave up too fast!

My semantic completions were already in the menu, just BELOW the useless snippets...

I guess I just I need to tweak my config to reorder them... and also use TAB to complete (instead of Enter)...

...and also figure out how to theme the menu so I don't get flashes of shocking pink while I'm trying to focus on the code 😂

@codewiz Yes! I use packer and the experience was really good for me. Since I use neovim as a ~ IDE and vim as a simple text editor, I did not want to share the configuration between both, so I kept one simple and one complex.

This is in my *.anyshrc

alias vi=vim
alias vim=neovim

@codewiz I used an out of the box configuration format so that I can get started with neovim with Lua faster!

github.com/NvChad/NvChad

It has most features and toolsets enabled by default, and also we can add our own custom configuration in a separate file, to make it modular.

@codewiz Adding on to the default plugins, I have lervag/vimtex, github/copilot.vim, and hashivim/vim-terraform

@codewiz I would also consider nvchad.github.io/getting-start as an interesting and useful resource for anyone new to the world of lua 😄

@srevinsaju @eriol Could you please share the output of these commands on your vim?

:hi Pmenu
:hi PmenuSel
:hi PmenuSbar
:hi PmenuThumb

I finally made my menu non-magenta, but I'm not good at matching colors...

@codewiz @eriol

Pmenu xxx ctermfg=0 ctermbg=13 guifg= guibg=

PmenuSel xxx ctermfg=242 ctermbg=0 guifg= guibg=

PmenuSbar xxx ctermbg=248 guibg=

PmenuThumb xxx ctermbg=15 guibg=

btw, that probably uses my also favorite One Dark Theme, and would probably look like this

(PS: thats github copilot with the suggestions)

@srevinsaju @eriol Nope. Your color scheme gives me that ugly magenta background.

It's color 13 in the xterm-256 palette:
ditig.com/256-colors-cheat-she

@codewiz Can you show the output of
`:echo $TERM`

ctermbg should actually be a fallback to guibg

@srevinsaju Oh, you probably have termguicolors set. I had to disable it because it made the text selection light gray. How did you override it?

@codewiz right now, I have nvchad doing the theming for me, because when I tried manually theming every component myself, I started breaking a lot of UI stuff 😅

@srevinsaju @eriol And that's what's been happening to me 😞

I think I finally got it to work properly, but it wasn't easy nor fun:

@codewiz I'm happy that it's starting to work as you want. I agree it was not easy and not so fun also for me... and still I have to do more tweaking to my config!

@srevinsaju
@codewiz @srevinsaju here mine:

Pmenu xxx ctermfg=0 ctermbg=13 guifg=#B0BEC5 guibg=#1A1A1A
PmenuSel xxx ctermfg=242 ctermbg=0 guifg=#1A1A1A guibg=#FF9800
PmenuSbar xxx ctermbg=248 guibg=#1A1A1A
PmenuThumb xxx ctermbg=15 guibg=#404040

I'm using this theme: https://github.com/marko-cerovac/material.nvim
@codewiz maybe you already know, but to tweak the order of completions you can use priority or just order sources as you want them. I chose the latter:
https://noa.mornie.org/eriol/ansible-collection-dotfiles/src/branch/main/roles/neovim/files/config/nvim/lua/plugins/nvim-cmp.lua#L47-L56

I also moved recently to neovim (I think about 3 week ago), and I don't know lua (yet!) but I decided to full switch, so my conf is only lua.
@codewiz please feel free to take a look if it can help you:
https://noa.mornie.org/eriol/ansible-collection-dotfiles/src/branch/main/roles/neovim/files/config/nvim

Ignore the ansible layer on top, it's only because I have more than one machine were I want my stuff and all the other systems I tried (from pure git of the HOME to handcrafted Makefile, to home management software) did not worked well at the end.

@eriol Thank you so much for sharing!

In spite of all the sarcasm, I _do_ believe that is on the right path... we need to get rid of the awful VimL and give plugin writers a solid base to work on.

Perhaps better integration will come in time... but we also need the developers to pick good defaults to avoid the paradox of choice.

@eriol Hmm... I already had nvim_lsp as first entry in cmp.config.sources, so it must be something else.

One difference between my configuration and yours is that I used vsnip instead of luasnip. I'll try switching, since I only really care about semantic completion with nvim_lsp at this time.

By the way, your nvim config is *neat*! I can't believe you've been using it nly for 3 weeks.

@eriol Ah, after tweaking the menu appearance to show the completion source, I found out that those snippets were actually coming from rust-analyzer! 🤦

I still need to figure out how to remove them, but that's prograss...

This is how I added the cool icons:
github.com/hrsh7th/nvim-cmp/wi

@eriol Semantic completion in is starting to look and behave reasonably well, but I'm still getting those stupid snippets before the methods...

Also, does LSP support assisted editing for function arguments?

@eriol @srevinsaju I've also hit a bug in lsp-config and reported it to them (their bug report template is quite good!):

github.com/neovim/nvim-lspconf

@eriol @srevinsaju My nvim-lspconfig bug was fixed in just 6 hours... great service, would buy again!

@codewiz maybe I don't get snippets because I don't have a general collection of them, my use case was to have my custom snippet for a new blog entry[¹] it was not too fun to write in the DSL of luasnip...
I will try what happen when I add more snippets and I will tell you, maybe also my conf is broken!

[¹] https://noa.mornie.org/eriol/ansible-collection-dotfiles/src/branch/main/roles/neovim/files/config/nvim/lua/plugins/luasnip.lua#L15-L26
@codewiz for LSP support of function signature, I found this https://github.com/ray-x/lsp_signature.nvim that seems to do what we want but I have not tried it yet.

@eriol It works! (and it took much less configuration than expected)

@codewiz oh, I did not know that rust-analyzer shows also snippets! Thanks for sharing that wiki page I will also tweak my config to show the completion source and icons!
@codewiz thanks I used vim for several years, and I simply tried to keep the new configuration organized as the old one :)
@codewiz I fully agree with you on VimL, and I also hope that we will avoid the paradox of choice. It can be fun configure you editor but maybe you just want to use it!
Maybe as showed by [email protected] the way is to provide ready to go configs... I really don't know.

@eriol @srevinsaju It's the oh-my-zsh way... a pre-baked, well maintained, extensible config with reasonable defaults.

Sign in to participate in the conversation
Mastodon

The social network of the future: No ads, no corporate surveillance, ethical design, and decentralization! Own your data with Mastodon!