this post was submitted on 13 Jun 2023
15 points (100.0% liked)

Neovim

2155 readers
3 users here now

founded 1 year ago
MODERATORS
 

Hi all! I installed nvim and completed the tutorial. I have been using CLion, PyCharm, IntelliJ IDEA, and VSCode. I primarily use an Ubuntu OS. I am open to a different distro.

When I tried to configure VSCode to allow me to use C++, Python, Java, and Assembly on one IDE it became unstable. Can nvim handle that?

Where do I go to figure how to customize this thing? For example, I don't know what I should be installing for basic linting (I'm still a student). Do I need different modules for each language? Any resources would be most appreciated.

Thank you!

top 14 comments
sorted by: hot top controversial new old
[–] kahnclusions 5 points 1 year ago* (last edited 1 year ago) (1 children)

In addition to the others mentioned, I highly recommend trying out AstroNvim! It's got a great set of defaults, based on lazy.nvim, and it's easy to modify and extend.

I also do recommend taking the time to write your own config from scratch... even if you end up scrapping it just to use one of the pre-made configs, it's worth it to learn how vim works. And you'll quickly discover you have a new hobby in life... configuring your text editor.

[–] chaoticAnimals 3 points 1 year ago

Thank you! I'm very much into personalizing my tools. I've spent an embarrassing amount of time playing with Linux. I started to write my own configuration, but I quickly became lost in the lists of options. I wasn't sure what was really necessary or which plugin was doing what.

[–] howarddo 5 points 1 year ago (3 children)

If you are a beginner, I think you should try out preconfigured setup like NvChad, Lunarvim to get a feel of fully riced setup. But if you want to start config from scratch, I think kickstart.nvim from the video of TJ is a good starting point. Good luck on your journey!

[–] framboos 2 points 1 year ago (1 children)

I might try out those suggestions as well. (The Lunarvim website really reminds me of Spacemacs). I've been trying a few times to get used to Neovim. An editor with the power and documentation of vim and a more "modern" community and support for Lua seems interesting.

However, the last time I gave up after I it required a lot of configuration of plugins to set up autocomplete for Rust. In VS Code it is just a matter of installing the plugin using the already available plugin manager, but it would be nice to have some more flexible alternative. And after typing a few lines I often unintentionally press the Escape key.

Do NvChad or Lunarvim come with a plugin manager where I can just install a package to add support for a language? It appears that both setups use a Lua config file. Does this make a difference for using vim plugins?

[–] howarddo 3 points 1 year ago

Yes, with the lspconfig and mason, you can install language server with a friendly user interface. I think this video is perfect for u, the base is NvChad

[–] jnovinger 2 points 1 year ago

Great suggestions!

[–] chaoticAnimals 1 points 1 year ago (1 children)

That is awesome. Thank you!

[–] howarddo 2 points 1 year ago* (last edited 1 year ago) (1 children)

One more thing I forgot to mention, for linting in neovim you should take a look at null-ls, you will get to it when configuring LSP (language server protocol), mason, etc.

[–] chaoticAnimals 1 points 1 year ago

Perfect. Thanks again!

[–] jnovinger 4 points 1 year ago (1 children)

Hey @[email protected] , I can't answer that specific questions, as I don't generally do anything with Java or Assembly. However, vim/neovim's ability to target features base on filetype is really helpful. It means that you can configure any particular plugin or feature to only work with *.py files, which is the python filetype in neovim.

I started with vim a long time ago and migrated to neovim a couple of years ago, so my personal configuration is kind of all over the place. With vim, I used things like python-mode which is all-in-one sort of Python plugin for vim.

Recently, on neovim, I've switched that out to use a Language Server Protocol plugin, like neovim/nsm-lspconfig for overall LSP configuration and language specific LSP servers, like python-lsp-server for Python.

You can get the LSP stuff for Python going by following the directions in neovim/nsm-lspconfig's README and in the projects server_configurations.md. server_configurations.md also contains tips for many other language/project specific LSP servers.

I'll see if I can boil my current config down to a minimum for LSP stuff later and post a link.

[–] chaoticAnimals 3 points 1 year ago (1 children)

That would be so appreciated. Thank you for all the info too!

[–] jnovinger 2 points 1 year ago* (last edited 1 year ago)

Hey @[email protected], my apologies for not getting back to this. kickstart.nvim that @[email protected] mentions is exactly what I was thinking and is probably much better thought out.

[–] [email protected] 2 points 1 year ago* (last edited 1 year ago) (1 children)

Hey! I highly recommend checking out this starter config: https://github.com/nvim-lua/kickstart.nvim. From their readme:

A starting point for Neovim that is:

  • Small
  • Single-file (with examples of moving to multi-file)
  • Documented
  • Modular

This repo is meant to be used by YOU to begin your Neovim journey; remove the things you don't use and add what you miss.

To answer your question, vim (and consequently neovim) technically support a wide range of solutions for linting (there are a lot of plugins from the vim days, both language-specific and generalist), but nowadays neovim has leaned strongly into using LSP ("Language Server Protocol"), which was pioneered by the VS Code team.

Basically, in VS Code, when you get a language plugin, you're downloading a language server for that language, which is a program that your editor (whether VS Code or neovim) communicates with to get information that it then uses for linting, syntax highlighting, and code actions. The great thing is, these language servers are editor-agnostic; there are language servers for just about every language, typically written either by the language maintainers themselves, or by 3rd parties.

Neovim has built-in support for using LSP, but it can be a bit of a hassle to set up by hand. The configuration I've linked you has a pretty decent basic setup for that, including keybinds for common actions. It also has a couple plugins that make LSP stuff very easy, like Mason. I don't remember if it has null-ls, but if it doesn't, consider trying that out as well. The configuration in question uses a plugin manager called "Lazy"; it's linked in the documentation.

If you have any questions, let me know. Have fun!

[–] chaoticAnimals 2 points 1 year ago