Neovim Config - Part 3 -- LSP

Sdílet
Vložit
  • čas přidán 5. 01. 2024
  • LIVE ON TWITCH: / theprimeagen
    Become a backend engineer. Its my favorite site
    boot.dev/?promo=PRIMEYT
    This is also the best way to support me is to support yourself becoming a better backend engineer.
    Get in on Discord: / discord
    Get in on Twitter: / theprimeagen
    Got Something For Me to Read or Watch??:
    / theprimeagenreact
  • Věda a technologie

Komentáře • 73

  • @germandavid2520
    @germandavid2520 Před 6 měsíci +12

    1:07:38 Prime is right, these snippet plugins have a lot of snippets that are not useful and only create noise, that's why I removed them from my configuration a few months ago, in my autocomplete I only have what LSP and nvim-async-path.
    Although you can still configure your own snippets, you just have to create a directory wherever you want and imitate the file structure of the rafamadriz/friendly-snippets repository, configure the package.json, the snippets are just a json file with some properties.

  • @Scooplar
    @Scooplar Před 6 měsíci +7

    @primeagen will share your config on github once you have dailed in the last few things you wanted? - it would be much appreciated!

  • @mjaysmileofficial
    @mjaysmileofficial Před 6 měsíci +1

    It's funny to look at Prime twitching without music, it reminds me of this joe rogan episode where they discussed hitler on meth on olymic games

  • @BucketHead6541
    @BucketHead6541 Před měsícem

    lsp-zero's changes and packer dying were the two best things that happened to my neovim journey after going through 0 to LSP. Learned so much through that process and my config is truly mine.

  • @themohmand
    @themohmand Před 5 měsíci +2

    My lua_ls won't show any hover documentation after migrating to Lazy, help please!

  • @bwemery5
    @bwemery5 Před 6 měsíci +6

    will these updates be pushed to github?

  • @vuongtran5799
    @vuongtran5799 Před 6 měsíci +1

    the diagnostic looks pretty slow, does it because it called after everything initialize?

  • @milindvaidya1599
    @milindvaidya1599 Před 4 měsíci +1

    Hey..I am big fan of vim and now neovim. Using it for personal programming and trying to use it on company laptops as well. Recently, I joined a company and they are discouraging using neovim and plugins. The concern of using something like GPT based plugin may be valid but in general the claim is plugins enable some random code executing in vim / neovim. I am not sure how plugin in mechanism works. But can you please throw some light as to security vulnerabilities of plugins if any.

  • @noodle69
    @noodle69 Před 6 měsíci +1

    I agree, too many people default to grabbing another plugin when it isn't necessary, which is why I have no plugins installed, and just write everything myself in Vimscript.

  • @LeeFlemingster
    @LeeFlemingster Před 5 měsíci

    I've just watched 2:15 of setting up neovim; no 2:45 because I found the packer 1 first. And it's taken me longer than that because I was playing along. I'll come back tomorrow for lsp.

  • @simonsolnes5190
    @simonsolnes5190 Před 6 měsíci +14

    You can just say `config = true` and it will do `function() require("x").setup { } end` automatically

    • @SiddharthPant
      @SiddharthPant Před 6 měsíci +6

      Also happens when you provide `opts = {}`, lazy.nvim will automatically call `require("your-plugin").setup(opts)`

    • @tauiin
      @tauiin Před 6 měsíci +3

      @@SiddharthPantyeah opts is great

  • @sinbruh
    @sinbruh Před 6 měsíci

    thanks primeagen

  • @tylorbarker9287
    @tylorbarker9287 Před 5 měsíci

    it's funny watching this now and knowing that blue hair does indeed happen

  • @Wh4tsupy0
    @Wh4tsupy0 Před 5 měsíci +1

    I'm trying to make the switch to neovim after VSCode's C/C++ extension has literally been crashing the editor from using 15+ GB of memory, the setup videos have been super helpful, definitely stealing some remaps too.

  • @lileightright
    @lileightright Před 5 měsíci

    anyone know what is his iterm2 colorscheme???

  • @mrAjor
    @mrAjor Před 6 měsíci

    LEEETS GO

  • @dnizamovv
    @dnizamovv Před 6 měsíci

    With copilot being so good I honestly feel like snippets are simply bloating my autocomplete.

    • @heroe1486
      @heroe1486 Před 4 měsíci

      Nonsense, a snippet is something that is 100% what you want, copilot is more often than not some bullshit you have to process before accepting, which takes you out of the flow. It's like saying you'd want to replace Lsp's autocomplete by copilot

  • @nimaimpatel
    @nimaimpatel Před 3 měsíci

    How do you debug?

  • @RyanGause
    @RyanGause Před 6 měsíci +14

    where the dotfiles?

    • @manojbijalwan
      @manojbijalwan Před 5 měsíci +3

      Create your own config

    • @MCroppered
      @MCroppered Před 3 měsíci +1

      You have to grow the moustache to get the files for free

  • @alexandruhritcan9727
    @alexandruhritcan9727 Před 6 měsíci +2

    I am surprised that you didn't use none-ls for diagnostics, formatting and linting. it is null-ls reloaded

  • @user-xd5gd4pc9h
    @user-xd5gd4pc9h Před 6 měsíci +5

    Besides lsp, would you like adding some AI stuff? Such as copilot.vim by teep and gen.nvim by david. BTW, will you share the neovim config to your funs? I am looking forward it.

  • @fastandfidler
    @fastandfidler Před 6 měsíci +1

    are his current dotfiles on github?

  • @mrudulmohan9219
    @mrudulmohan9219 Před 18 dny

    can anyone help me with installing undotree in nvchad?

  • @awesomedavid2012
    @awesomedavid2012 Před 6 měsíci +4

    I tried not using lsp zero and maybe I'm just bad, but I found it so infuriating having my lsp break anytime I opened a new language. I couldn't configure html for the life of me.

    • @ivanjermakov
      @ivanjermakov Před 6 měsíci

      mason-lspconfig auto-attaches installed LSPs to supported buffers. `html` LSP works out of the box for me. I think kickstart.nvim default config will handle your needs.

    • @gittawat6986
      @gittawat6986 Před 6 měsíci +1

      after I watch prime set up everything manually I suddenly understand why something like lsp_zero exists

    • @ivanjermakov
      @ivanjermakov Před 6 měsíci

      @@gittawat6986 true. But I had to figure out a way to go without it because it took 50ms to initialize lspzero for some reason and was a visible delay on startup. Now it's under 10ms.

    • @jaredteaches894
      @jaredteaches894 Před 6 měsíci +1

      It’s genuinely not hard.
      1.) Install LSP on host system
      2.) Call lspconfig.lang.setup
      3.) And cmp.

    • @anandmahamuni5442
      @anandmahamuni5442 Před 6 měsíci

      But in general is just so infuriating, the setup is so criss cross and complicated

  • @AlexKen-zv8mm
    @AlexKen-zv8mm Před 5 měsíci

    Did he push this entire config on github ? Sauce peweee !!

  • @venc0r
    @venc0r Před 6 měsíci

    min 36: append a comma to the end of some lines C-v3j$A,^]

  • @bagasek
    @bagasek Před 6 měsíci +1

    а че делать

    • @dez0rted291
      @dez0rted291 Před 6 měsíci +2

      дивитись

    • @imaksimus
      @imaksimus Před 6 měsíci +5

      І вчити державну

    • @fumanchez
      @fumanchez Před 6 měsíci +1

      @@imaksimus у нас все государственный знают

    • @andrii7879
      @andrii7879 Před 6 měsíci +4

      вивчити нормальну мову

    • @lmaorxenix7329
      @lmaorxenix7329 Před 6 měsíci

      @andrii7879 "нормальна мова" - это английский, остальное не нужно

  • @anasouardini
    @anasouardini Před 6 měsíci

    Why use a plugin when you're a masochissst

  • @fumanchez
    @fumanchez Před 6 měsíci

    How does this differ from vscode where everything is managed inside the editor? With nvim you just have to manually configure each LSP server using almost the same boilerplate code - it's terrible. Why Mason can't be an external command line tool and why haven't I seen configuration examples where the LSP server automatically starts based on file types or something else (like Helix does, seriously, you don't need to do anything for it, by default it tries to start the server based on directory contents or file types and has built-in config for almost all servers). Even such a basic thing like choosing a formatter is totally complicated.

    • @levdue6310
      @levdue6310 Před 6 měsíci +4

      It's hard to change direction in such a big and "old" project, the neovim team can't just throw away what they were doing for years. If you want that use helix, or write your own Text Editor.

    • @dez0rted291
      @dez0rted291 Před 6 měsíci

      what about lsp-zero?

    • @fumanchez
      @fumanchez Před 6 měsíci

      @@levdue6310 nvim-lspconfig is not shipped with NeoVim and it just has no options to automate the attaching of an LSP server, while in Helix you can store language or server specific settings separately and it takes a couple of lines in language.toml file. Writing code like `lspconfig.tsserver.setup()` will also throw an error message when you use your configuration on a machine without tsserver (which actually has a different name, it's just a clumsy alias that you need to find out first) installed. And remember that you need to maintain nvim-cmp for the same servers that you specified in nvim-lspconfig config.

    • @fumanchez
      @fumanchez Před 6 měsíci

      @@dez0rted291 you still have to juggle with nvim-cmp, nvim-lspconfig, mason, mason-lspconfig and call .setup() manually for each server. And also monitor all the breaking changes of lsp-zero.

    • @germandavid2520
      @germandavid2520 Před 6 měsíci

      @@fumanchez I will try to respond to everything you said.
      You: why Mason can't be an external command line tool?
      It's a Neovim plugin, it makes sense for it to run inside Neovim.
      You: why haven't I seen configuration examples where the LSP server automatically starts based on file types or something else?
      You are definitely speaking without knowing, a language server can be configured to attach to a specific file type, or to a list of file types. Also in Neovim you have another option to start a language server in a project, the option is root_dir, it is a list of files that must exist in the root of the project to start a language server, for example for tsserver nvim-lspconfig configure these: tsconfig.json, package.json, jsconfig.json and the directory .git, and these can be modified.
      You: Even such a basic thing like choosing a formatter is totally complicated
      not really, plugins like conform.nvim or formatter.nvim are really easy to use, there is also the builtin vim.lsp.buf.format function that formats using LSP, you can easily create a keymap or a user command to execute that function
      You: nvim-lspconfig is not shipped with NeoVim
      of course, because it is a plugin that offers extra functionality that should not be in the core of neovim, also I think you misunderstand the purpose of that plugin, that plugin helps facilitate configuring a language server, but it is not necessary for that, neovim has a built-in LSP client and you can configure a language server without nvim-lspconfig.
      I suggest you read the article "Neovim journey: using LSP without any plugins!" or another article "Can we manage neovim's LSP client without plugins?", google it, I won't put links here because I think CZcams eliminates comments with links, although I'm not sure. After reading those articles you will clearly understand how LSP works in Neovim.
      You: while in Helix you can store language or server specific settings separately and it takes a couple of lines in language.toml file
      Neovim and Helix have very different approaches, Neovim tries to give the most basic so that the user can build their own configuration on top, on the other hand Helix in my opinion I think it is more about being a kind of mix between Neovim/Vim and VSCode, it is similar to Neovim/Vim because it runs inside the terminal and has almost the same keybindigs and is similar to VSCode in the sense that it does a lot of things for you under the hood and implements some functionalities natively that in Neovim/Vim are found in the form of a plugin.
      Also VSCode is configured with a JSON, Helix with TOML, very similar, for me personally that is something that does not attract me, I guess I am already very used to Lua, configuring my code editor with JSON or TOML right now for me feels like having my hands tied, I really like the Neovim API and all the functionality it brings.
      You: Writing code like `lspconfig.tsserver.setup()` will also throw an error message when you use your configuration on a machine without tsserver installed
      The error you would probably get is that tsserver is not available in your PATH, which is not Neovim's fault, you have to install the language server and you can use mason.nvim for that, and it is also easy to create a command that install all the language servers you want, for example the :MasonInstall command receives as an argument the language server you want to install and you can pass as many as you want and it will install them all, in my configuration I created the :MasonInstallAll command that takes a list of strings with all the language servers I need, it concatenates them separated by a space, basically what it does is run something like MasonInstall gopls tsserver rust-analyzer.
      You: call .setup() manually for each server
      You can create a list of strings with the names of the language servers and with a for loop iterate it and run setup for each language server, that is what I do in my configuration since 2021, I have never needed lsp-zero or mason-lspconfig , I only use nvim-lspconfig because it offers me some useful defaults and useful commands and mason.nvim because I can install everything I need without problems with an easy-to-use interface.

  • @_idiot
    @_idiot Před 6 měsíci +13

    would've been better to do this off stream and come on a stream and re-do it with all the knowledge and configs ready. this was just way too spastic

    • @ditchcomfort
      @ditchcomfort Před 6 měsíci +5

      Most of the neovim config has been like that 😂

    • @sutirk
      @sutirk Před 6 měsíci +26

      This is not the main channel tho, he's probably gonna put it up on a repo and make a shorter, objective video with all of this + other things he read and configured off stream

    • @ditchcomfort
      @ditchcomfort Před 6 měsíci

      @@sutirk probably

    • @witchdoc-xp
      @witchdoc-xp Před 6 měsíci +12

      I like the process to figure things out. The polished "hey I did it" videos are 99% around

    • @reptilianbrain547
      @reptilianbrain547 Před 6 měsíci +1

      Tell me you don't have a beautiful wife without telling me you don't have a beautiful wife:
      "do this off stream..."

  • @saeedxgholami
    @saeedxgholami Před 6 měsíci

    His voice can be annoying from time to time, but we don't have many alternatives.

  • @talananiyiyaya8912
    @talananiyiyaya8912 Před 6 měsíci +4

    This is soul crushingly boring. Probably more entertaining live.