Neovim Lazy Lua IDE - my simple but powerful setup for 2024

Поділитися
Вставка
  • Опубліковано 29 вер 2024

КОМЕНТАРІ • 81

  • @MesoCarib
    @MesoCarib 2 години тому

    For a "simple" setup, wouldn't you just install LazyVim (that has the plugins and configurations)? And then edit that to your liking?

  • @LightSquares
    @LightSquares 3 місяці тому

    23:13 - Instead of this why not just setup a virtual environment in the python project you are working on, enter it using source myvenv/bin/activate, pip install pyright and then open up neovim?

    • @ZazenCodes
      @ZazenCodes  3 місяці тому

      This is what I’ve started doing. I haven’t needed to install pyright in the venvs though

    • @LightSquares
      @LightSquares 3 місяці тому

      @@ZazenCodes Thanks, yes you are right, pip install pyright is not required.
      This LSP can be provided by NodeJS using npm commands in the terminal.
      I managed to simplify your setup by discarding mason and mason-lspconfig (seemed overkill) and using the following lines in lua to get C++ and Python LSP stuff working.
      -- LSP Stuff
      require'lspconfig'.pyright.setup{}
      require'lspconfig'.clangd.setup{}
      require'cmp'.setup()
      local cmp = require('cmp')
      cmp.setup({
      sources = {
      {name = 'nvim_lsp'},
      },
      mapping = cmp.mapping.preset.insert({
      -- Enter key confirms completion item
      [''] = cmp.mapping.confirm({select = false}),
      -- Ctrl + space triggers completion menu
      [''] = cmp.mapping.complete(),
      -- Use tab to select next item
      [''] = cmp.mapping.select_next_item(),
      }),
      snippet = {
      expand = function(args)
      require('luasnip').lsp_expand(args.body)
      end,
      },
      })

  • @TheChameleon84
    @TheChameleon84 2 місяці тому +1

    You don’t need to do all this complicated setup to get Python autocompletion. I don’t know about pyright, but if you install Jedi instead, all you need is to make sure your Python environment is activated before launching nvim. Jedi will automatically inspect your activated environment and provide autocompletion and hover for your installed modules.

  • @davidomar742
    @davidomar742 6 місяців тому +2

    this guy is too attractive to be using vim. Is this AI generated?

  • @nicop175
    @nicop175 3 дні тому

    Very nice video. It really helped me get started and also finally use virtualenvs inside vim. There is a small issue I cannot find how to solve. I would also like to add CNTRL + Space to act as CNTRL + n, basically to select suggestions of the autocomplete. Can you give me a hint how to do it? I have tried different things but nothing seems to work. Thank you very much.

  • @lliliiliillliliiliili5180
    @lliliiliillliliiliili5180 5 годин тому

    How do you get your moonlander to actually keeep its tilt? The wrist wrest doesn’t lock right?

  • @paddypimblett62
    @paddypimblett62 6 місяців тому +8

    you have a really good talent at explaining things really simple yet informative ; really beginner friendly. great job and keep it up!

    • @ZazenCodes
      @ZazenCodes  6 місяців тому +2

      Thanks! I appreciate you taking a moment to let me know

  • @hichamelkaissi7786
    @hichamelkaissi7786 6 днів тому

    Thank you for the video. Definitely need to watch it multiple times.

  • @Qazi-it9mo
    @Qazi-it9mo 3 місяці тому +1

    For some reason, pyright can't recognize pandas dataframes, even though it(maybe not pyright but something) is providing code suggestions. This has been a well documented issue in reddit by many people and I'm facing this too. How did you solve that?

    • @ZazenCodes
      @ZazenCodes  3 місяці тому +1

      Hmm I’m not sure it never gave me a problem. Try installing a new virtual environment then pip install pyright and pandas and activating it, then run vim and see if that works

  • @BadlyNeedAHug
    @BadlyNeedAHug Місяць тому

    Any of you guys got an error when loading the Markdownpreview on lazy?

  • @XandriaAlexandria
    @XandriaAlexandria 4 місяці тому +1

    mate, but what about change venvs for each project? Do u have any automatic solution for that?

    • @ZazenCodes
      @ZazenCodes  4 місяці тому

      I tried something, but never could get it working. I activate the virtual environment before going into vim- that works

  • @ahasibrifat7568
    @ahasibrifat7568 5 місяців тому +1

    23:00
    If it's active in the shell it should be active in neovim.
    So just activate it with source venv/bin/activate and then enter neovim

  • @rohitbhanot7809
    @rohitbhanot7809 Місяць тому

    But thats not how you would use python for a real world project, you would use diff interpretor per project most likely. So how would you configure neovim to use diff venv for each project?

    • @ZazenCodes
      @ZazenCodes  Місяць тому

      How I do it now is just activate the virtual environment before opening nvim

  • @DAVE-GM
    @DAVE-GM 5 місяців тому +2

    Wow! finally, a comprehensive guide to setting up Python with Neovim! Your tutorial is incredibly helpful. I would greatly appreciate it if you could delve deeper into LSP integration related to Python virtual environments. Your insights are invaluable!

  • @aleatoirealeatoire-s2j
    @aleatoirealeatoire-s2j 17 днів тому

    Hi alex i'm in windows and i want to know how you do for install your IDE in Windows . I create a alias for change nvim in vim but for this stape ->
    mkdir ~/.config
    cp -r .config/nvim ~/.config/nvim
    i don't know how i can do , in windows the neovim path is C:\Program Files\Neovim do you have an idea . thank you :)

  • @drkwrk5229
    @drkwrk5229 19 днів тому

    The keyboard sound is so annoying 🙉

  • @devnchill
    @devnchill 5 місяців тому +1

    hey in File tree i installed it sucessfully but when i use space e it says that command as not an editor command . Can you please help me with that

    • @ZazenCodes
      @ZazenCodes  5 місяців тому

      Follow the installation instructions on be GitHub repository for the plugin. Then try :NvimTreeOpen and if that doesn’t work it means it was not installed properly

  • @dominiqueehrlich1668
    @dominiqueehrlich1668 Місяць тому

    do you have a tutorial on how to setup and configure obsidian within vim?

  • @medhavimiddha9882
    @medhavimiddha9882 Місяць тому

    Hey, is it possible to share your data science setup on NVIM? I am new to NVIM and my setup is on VSCode + iTerm and want to migrate to NVIM. I work with a bunch of Jupyter notebooks and virtual environments. It would be great to see a working setup.

  • @SouthFacedWindows
    @SouthFacedWindows 2 місяці тому

    Experts dont use Chrome!

  • @Onyx-it8gk
    @Onyx-it8gk 2 місяці тому

    Awesome video, thanks! As a long-time Neovim user, I recently moved to Helix. It still has a ways to go for full maturity, but it's very productive.

  • @Sam-rb1id
    @Sam-rb1id Місяць тому

    Good video. By the way you dont really need to specify to neovim which interpreter to use. It will use the one available to it. Ie if you activate and env then start neovim and do `:! which python` you will see you are using the python from your venv. So I have a venv for each project and in theat I have my linteres like mypy for example (and black). Now it will use mypy and black and better yet mypy will use the libs in the venv for getting the types and checking exports. This is prob the best and simplest way to do it. Otherwise if you use a mypy in a different env it wont know about the types in the libs you import. I use pylsp with flake8 and mypy because it is a touch more standard than pyright and not everyone I work with is using neovim :)

    • @JazzBrown-ym8ku
      @JazzBrown-ym8ku Місяць тому

      Friend how will “it” know which venv to use for the project, is there a standard naming convention for the venv in the project root say .venv or .env? Appreciate the help, a noob here.

    • @Sam-rb1id
      @Sam-rb1id Місяць тому

      @@JazzBrown-ym8ku it uses whichever venv is currently active. Just in the same way the terminal does

    • @JazzBrown-ym8ku
      @JazzBrown-ym8ku Місяць тому +1

      @@Sam-rb1id Thank you for replying so what one should do is activate a venv in your shell and then run neovim from that shell so that it knows which venv it is in?

    • @Sam-rb1id
      @Sam-rb1id Місяць тому

      @@JazzBrown-ym8ku exactly that :)

    • @JazzBrown-ym8ku
      @JazzBrown-ym8ku Місяць тому +1

      @@Sam-rb1id Thank you, bro. Appreciate the help.

  • @aleatoirealeatoire-s2j
    @aleatoirealeatoire-s2j 3 місяці тому

    Hi thank you for your video continue it's very good work :), I want to know , with which key did you replace ESC to activate the different modes (insert,visual,ect ....), because the esc key is rather difficult to reach I don't find it practical do you have any ideas? thx :)

    • @ZazenCodes
      @ZazenCodes  3 місяці тому

      Thanks! I use ctrl+c (command on mac, I think) to go from insert to visual mode. It works by default

  • @israelomola3806
    @israelomola3806 Місяць тому

    Jj

  • @green3438
    @green3438 5 місяців тому

    thank you for awesome video! i'm very noob on neovim. by the way i have one question for you from 22:47 on video. actually i want to connect with my conda env so i did 138 line as like ( env_path.join(vim.env.HOME, "/opt/homebrew/anaconda3/envs", "lab", "bin", "python") (lab is for my conda env name). but it seems like not working for me. i made test directory like as you did, and made test.py (also i ensured that i have been installed numpy in my conda env). when i import numpy, there are some error (Unable to import 'numpy' (import-error), Import 'numpy' could not be resolved). can you help me?

    • @ZazenCodes
      @ZazenCodes  5 місяців тому

      Thank you. I dont believe conda envs should be a problem. In the code you wrote you start your path with vim.env.HOME - remove that part. /opt/hormbrew/… is an absolute path. Also try without using the path.join utility function and just use a string that has the absolute path to your environment

  • @wadechang
    @wadechang 4 місяці тому

    Thanks for the tutorial. Very informative.

  • @parthrathod4130
    @parthrathod4130 2 місяці тому

    This was really cool, thanks man I am glad I watched this even though it is a python setup and I work on full-stack with node I can now make my own version and extend it when needed. Really appreciate this tutorial ❤

  • @SahilRai2
    @SahilRai2 4 місяці тому

    Super cool. I tried your configs, and kinda starting to like it. Can I know which terminal you're using?

    • @ZazenCodes
      @ZazenCodes  4 місяці тому

      Nice! I’m using alactritty

  • @don_heidi
    @don_heidi 6 місяців тому

    I love the overlaying of the relevant information with you talking in the background. Overall, it was great editing. The subtitles placed right in the middle of the screen confused me. And great office setup.

    • @ZazenCodes
      @ZazenCodes  6 місяців тому

      Haha noted! Thank you

  • @Just_Add_Coffee
    @Just_Add_Coffee 3 місяці тому

    I would pay an obscene amount of $$$ for a web dev course, from html and css on up to fullstack and modern stuff, that included setting up Neovim and then using it exclusively to build things on my Linux machine. Obscene $$$!!! 👍

    • @ZazenCodes
      @ZazenCodes  3 місяці тому +1

      lol thank you. I'm working on ML courses that just have light frontend- I'm not a web dev

    • @Just_Add_Coffee
      @Just_Add_Coffee 3 місяці тому

      @@ZazenCodes Even better! I found your Patreon. See you there!

  • @WhatNameHere
    @WhatNameHere 6 місяців тому

    I’m unable to reproduce the buffer tabs, it replaces current tab with new one when I open any other file from the tree

    • @ZazenCodes
      @ZazenCodes  6 місяців тому

      Hmm I'm not sure. You could try using regular vim buffer commands (":bn" or ":bp"). This will let you know if they are opening but just not being rendered by the plugin. You can also check the install/usage instructions for "bufferline.nvim" on github. Another plugin you could try is "lualine.nvim" which gives tab info at the bottom of the window, I believe.

  • @rzimmerdev
    @rzimmerdev 6 місяців тому

    Hey there, didn't see you running the code, as of now this is more of a Text Editor setup right? You didn't show any debugging, environment selection or unit testing, or did I miss something?

    • @rzimmerdev
      @rzimmerdev 6 місяців тому

      Not to criticize or anything, but would like to know if it is possible to do such things in NVIM, I tried using nvim-dap-python, with Anaconda + unittesting some cases, but to no avail.

    • @ZazenCodes
      @ZazenCodes  6 місяців тому

      ​@@rzimmerdev No worries! Its true this setup doesn't include any help for unit testing or interactive debugging, for example. There are nvim plugins for these things that you can add to your lazy.lua file. I configure my python env in neovim at 23:10 - you can see how I'm telling neovim what python to look for on my computer to provide proper linting. You can write more complicated lua code to automatically find the appropriate python, e.g. if you have a virtual env running. I have not tried this with conda, but you can find see my "dotfiles" repository on github (link in comments) and find my lsp.lua file and look for a function "get_python_path" that might help you

  • @soulspirit8687
    @soulspirit8687 3 місяці тому

    Debugger? Sike

  • @jlaviews
    @jlaviews 6 місяців тому

    Does this work with mamba as package manager and environments?

    • @ZazenCodes
      @ZazenCodes  6 місяців тому

      I'm not sure. Looks similar to conda for python? I don't use conda with neovim myself but there is probably a way to configure conda env with LSP - if that's what you mean

    • @jlaviews
      @jlaviews 6 місяців тому

      It is a package manager but much faster than conda. Setting up lsp pyright is cumbersome. Perhaps it had to do with mason being in the middle. It works so much better in viscode.

  • @heiah
    @heiah 6 місяців тому

    y u no use mason for lsp installation?

    • @ZazenCodes
      @ZazenCodes  6 місяців тому +1

      I believe this setup does include mason - but true, I didn't use it for the demo

  • @thederpykrafter
    @thederpykrafter 5 місяців тому

    Hmm human music, i like it.

    • @ZazenCodes
      @ZazenCodes  5 місяців тому

      Peace among worlds ✌️

  • @wolfisraging
    @wolfisraging 6 місяців тому

    Just brilliant!

  • @RohitJuyal-kj2lp
    @RohitJuyal-kj2lp 4 місяці тому

    sir do you still use yank to clipboard now?

    • @ZazenCodes
      @ZazenCodes  4 місяці тому

      Hell yea love that one

  • @jakescotting3915
    @jakescotting3915 5 місяців тому

    Very good video

  • @ordinarygg
    @ordinarygg 6 місяців тому

    Didn't see any benefit over VSCodium yet, a lot of friction for nothing

    • @ZazenCodes
      @ZazenCodes  6 місяців тому

      That's fair. The friction is real!

    • @badluckprophet9103
      @badluckprophet9103 6 місяців тому

      There may never be a benefit for you. There are some out of the box like startup time, integration with tmux, native vs emulated vim motions etc. but nothing game changing. Then you need nvim plugins to get up to the baseline of what vscodium offers. Then vscodium extensions and nvim plugins stay pretty neck and neck for offering additional functionality. Then nvim pulls ahead with the last 10% or so of customization because its more flexible IF you want to put the work in. It's little things like luasnips offering more powerful snippet functionality because you can perform function evaluations in the snippet itself, or being able to custom keybind execution of your personal scripts and small programs. For the majority of people vscodium vs nvim will be gui vs terminal. And you'll see more benefit from learning your tool very well then just using another tool. Heck, I might be wrong about that last 10% simply because I don't know vscodium well enough to know there are extensions or built in functionality to do the same things in vscodium that I want to do in nvim.

    • @ordinarygg
      @ordinarygg 6 місяців тому

      @@badluckprophet9103 I have 2-5 extensions and color theme, for last 5 years worked perfectly and did the job.

  • @anon_y_mousse
    @anon_y_mousse 6 місяців тому

    I've never gotten a good answer to this question yet, but I'll ask in the hopes that you can answer. Why NeoVim over vanilla Vim? If you want to use Lua for configuration you can still do that for vanilla Vim if you build it manually with Lua support, and you can do the same with Python, Perl, Ruby and some other languages. Most of what you do here with plugins I can do in vanilla Vim with just editing my ~/.vimrc, and some of it I have already been doing for a while. Although, I use regular tabs instead of buffers, and you can open multiple files from the command line into separate tabs with `vim -p foo bar baz`. If you've never built it from source then let me reassure you that it's easy to do. I have to enable mouse support every time I update and I've yet to find a distro that enables that in their build.
    The only other questions I have are why use space for your leader and do you use a different leader for insert mode?

    • @ZazenCodes
      @ZazenCodes  6 місяців тому +2

      I probably won't give you the answer you're looking for. I went with neovim because that seemed to be where the most development / community support was. I believe that having lua builtin and standard for neovim if a big upside. For me it's time consuming enough to set all this up without any extra work and I want to make it as easy as I can while still getting that awesome vim experience.
      I'm not sure why I use space for leader but I like that I can use my thumb for it. Do you use the default key? In insert mode its still space for me, I just leave insert mode with before I use leader

    • @anon_y_mousse
      @anon_y_mousse 6 місяців тому

      @@ZazenCodes I'm not sure I remember what the default key is. If it's \ then yes. As for setup, I just keep pulling my same ~/.vimrc forward onto new systems and as long as I've configured the build right, which you can easily put into a bash script and carry as well, then it's just a matter of make -j8 and wait. I only use 8 cores because I have it running in the background. As for using the leader in code, it introduces a visual delay when I have to type an escape in some string, but it doesn't prevent me from continuing to type, so I don't really need to handle it specially. I can't imagine how space has affected your speed. For that matter, I kind of wonder how much time you spend on configuring when you move to a new system. For me, since my home drive is separate I can just keep going and simply use it. If I need a fresh install I clone the repository, configure, make, copy over my config and done.

  • @No_Underscore
    @No_Underscore 6 місяців тому +13

    black is slow, use ruff instead

    • @ZazenCodes
      @ZazenCodes  6 місяців тому +1

      👀

    • @TheRich107
      @TheRich107 2 місяці тому +1

      I love python and it's libraries
      As the libraries age turn to rust the tooling gets faster 😊