scottmuc / infrastructure

Documentation / Automation for personal third-party infrastructure
The Unlicense
10 stars 2 forks source link

Migrate to lua configuration for NeoVim #63

Closed scottmuc closed 11 months ago

scottmuc commented 11 months ago

I'm finding NeoVim a lot more mature now. The idea of porting the configuration to a general purpose language like lua that's used in other environments is appealing. Plus, future integrations should be less painful too.

Have to give respect to the vimscript configuration that has been used for a long time.

Why not use some out-of-the-box NeoVim (like LunarVim)? I love those when I'm in a work environment where everyone shares the configuration (❤️ Pivotal). In that type of environment, the activity of pairing brings you up to speed rapidly (we used luan's vimfiles). The intention of this task is not to do this quickly. It's going to be a slow-plod while I learn and get better at my tools. My skills have atrophied a bit over the last years.

scottmuc commented 11 months ago

Getting some inspiration from https://github.com/ThePrimeagen/init.lua but don't feel the need to create a user specific configuration. I think init.lua is fine for holding all the remaps and config settings. I will do the package separation configuration though. I find that rather cohesive. Removing the package, therefore also remove the package specific configuration file.

Packer does look much more complex that all the previous vim package configuration I've used in the past, but I'm accepting that as a necessary complexity to reach the more IDE like functionality.

scottmuc commented 11 months ago

I'm happy that I've removed jk as my <Esc> mapping. I've been in the habit of hitting jkjkjkjkjkjkjkjk on repeat. I'll stick with <Esc> until a something else feels better.

scottmuc commented 11 months ago

Some handy resources I've found along the way:

scottmuc commented 11 months ago

So far got packer working. I stripped out the machine automation from coalesce_this_machine. I feel like I want to be a bit more hands on with this. So bootstrapping a new environment will have a few more commands to run. The init.lua will still be symlinked so it should be easy. Things that need to run:

I think I can live with those steps for now.

scottmuc commented 11 months ago

When trying to configure telescope it complained that my version if nvim is too old (running 0.5). To upgrade, I followed the instructions here: https://launchpad.net/~neovim-ppa/+archive/ubuntu/stable

I've been using <C + p> as my shortcut for a while so this might take a little getting used to. I went with the keymaps that they suggested: https://github.com/nvim-telescope/telescope.nvim#usage

mamachanko commented 11 months ago

https://lunarvim.org is my workhorse 🐴

scottmuc commented 11 months ago

@mamachanko I can see myself switching to that at some point. So far this has been a good exercise is learning the lua configuration method and getting acquainted to the plugins that this new configuration strategy has enabled.

scottmuc commented 11 months ago

With treesitter and lsp stuff I'm seeing some issues.

Also noticed that LSP Zero has a version v2 but requires neovim > 0.8. So I might be in for a "fun" upgrade.

At this point, tree-sitter and lsp-zero have fulled in a ton of stuff. I've lost my terraform highlighting so I'll try and get that back.

mamachanko commented 11 months ago

I enjoyed watching this series from the originator of LunarVim https://youtube.com/playlist?list=PLhoH5vyxr6Qq41NFL4GvhFp-WLd5xzIzZ It's not about LunarVim.

scottmuc commented 11 months ago

@mamachanko, yup! Got that listed in the description as part of my original inspiration for this. I'm watching it as I go with (along with some of the other resources).

scottmuc commented 11 months ago

After upgrading to neovim v0.10.0-dev, and installing nodejs with nvm. Things are working really well! The bashls is working great for my bash scripts. My .editorconfig is handled by neovim itself (as of >= 0.9.x). The files I open with telescope don't require me to use :w! to save. My *.tf files.

Things to look at documenting/automating:

scottmuc commented 11 months ago

The inspection assistance that comes from :LspInfo is great!

image

Now that I see it detected it as a gitcommit, I can add some configuration around treesitter and cmp to ignore these.

scottmuc commented 11 months ago

Thankfully v2.x of lsp-zero is working, but it appears that v3.x is going to break a lot of my configuration (https://github.com/VonHeikemen/lsp-zero.nvim#future-changesdeprecation-notice). Something to keep in mind in a few months.

scottmuc commented 11 months ago

Summary

I've published a demo video (24m) displaying the results of this migration.

Upon completing this, it really solidified in my head the core components of a good editor experience:

NeoVim shines by being able to store the configuration in a repo and be able to write the configuration in lua. I can configure it to be as noisy or as quiet as I prefer.

thenbe commented 11 months ago

This randomly popped up on my yt feed.

Bad news is packer is more or less dead. Good news is that there is a better replacement You can start with it like this, which gives you immediate access to this. But since you're intentionally taking it slow this might be a better fit. Good luck!

scottmuc commented 11 months ago

Thanks @thenbe! I recently learnt about kickstart.nvim after the video released. I love over-explained configuration for learning. I'll look at lazy.nvim and switch. This ecosystem is moving so fast!

scottmuc commented 11 months ago

With the above commit, the video is out-of-date. I think this is what I like about attaching a GitHub issue to the video. The code is always "latest" while a video/tutorial/quickstart is often a snapshot in time.