I’m thinking of switching from VSC to VIM because VSC is too heavy in term of ressources usage.

Currently, I use the VSC + VIM extension and I’m pretty happy.

But nowadays, I avoid to open some monorepo projects because it takes too much time and I use the Github explorer instead. Also, I use the mouse too much.

So I finally took the decision to give a try to Neovim.

I initially started with SpaceVIM and it was a good experience. But there is too much magic for me. Also, I have the feeling to not learn VIM.

So I setup CoC with VIM-plug + NerdTree. It looks promising.

Do you have any tips for me?

  • simonced@lemmy.one
    link
    fedilink
    arrow-up
    9
    ·
    1 year ago

    Hi there, glad to see new users. I would recommend using LSP instead of Coc if your language is supported. A good starting point could be with Lsp-Zero plugin, it can be used with some dependencies and you can customize to your liking. A bit of a steep learning curve maybe, but the result is worth the effort. Also, using Packer for plugin management might be a good alternative, and learning lua in the process. I finally converted my vim config into Lua, I can send a link to my repo if you want to take some inspiration.

    • zlatko@programming.dev
      cake
      link
      fedilink
      arrow-up
      2
      ·
      1 year ago

      I agree, there are several good starting points. But I think it’s more important what the OP said about his understanding of it. I think this is a lot more important - WHY do you use plugins, HOW they help you, WHAT can they do. Like, autoimport like vscode does? Autohighlight problems? Check. Check. Autofix linting issues? Check. Find files? Check. Search the project? Check. There’s a lot of things that can make your experience way better. Look up some videos. E.g. this one (if you can ignore some twitch memes, I found them mostly fun or tolerable).

      Also, when you give up on vim, come back again. It’s something that can take many iterations to really “get”. Even if things don’t work out, try again in a few years.

      Also, as an alternative to VSCode, try some native editor. I personally used sublime - for weak machines, it’s way better on resources then VSCode and it’s electron baggage.

    • madeindjs@lemmy.mlOP
      link
      fedilink
      arrow-up
      1
      ·
      1 year ago

      I might want to see your repo for sure !

      Is it better to use Lua for the config ? I feel Vimscript is kinda old school way but there is more ressource on the internet.

      Also, why do you recommend LSP instead of CoC ?

      • hisbaan@lemm.ee
        link
        fedilink
        arrow-up
        2
        ·
        1 year ago

        Not op; I don’t use LSPZero but the built in support with lsp-installer. I like to think I’ve organized my repo decently well so hopefully it can help you out: repo

        I used to use CoC a looong time ago so I don’t know if this has changed since but I’ve heard LSP is faster than CoC and has better support since it’s the defacto standard for neovim (and built in). Additionally it uses the same binaries used by something like vscode for the analysis so it’s part of a larger ecosystem that will get support

      • simonced@lemmy.one
        link
        fedilink
        arrow-up
        2
        ·
        11 months ago

        Sorry for my late answer.

        Here is the link to my dotfile:
        https://gitlab.com/simonced/dotfiles-nvim

        I used Vim before NeoVim and despite not liking VimL as a language, the basic Vim configuration was better than doing it with Lua IMO.
        But I got used to it, and it’s not bad after all.
        The thing though, when learning Vim, the commands, the motions, the settings… learning Lua on top of that can be daunting.

        About LSP vs CoC.
        CoC was a pain in the neck to setup, I needed python and other stuff (if I recall correctly) and it didn’t work as I wanted/expected. LSP-zero works almost out of the box, and Mason (optional but recommended) will install LSP for the languages you want. It’s very convenient and I use LSP everyday now, and it’s a very nice programming experience.

  • Scraft161@iusearchlinux.fyi
    link
    fedilink
    arrow-up
    4
    ·
    1 year ago

    CoC and Nerd tree are popular plugins, but I personally found CoC slow (on a 7 year old laptop) and I’ve switched to using coq with neovim’s native LSP (helped by LSPconfig) and I’ve always used Chad tree by the same author.

    A couple of other plugins I commonly use are: fzf, vim-polyglot, auto-pairs, nvim-treesitter (this has many IDE’s beat IMO), vim-which-key, lualine.nvim, nvim-web-devicons, barbar.nvim, gitsigns.nvim, rainbow-parentheses.vim

    You can also set scrolloff and sidescrolloff to something like 99999 to keep the cursor centered.

    For the rest I have Shift+hjkl for 10 line jumps and Ctrl+hjkl for jumping between panes. You might want to increase your keyboard repeat rate (I have a timeout of 200ms and a rate of 70Hz personally, but that might be a bit fast for you), some hardcore vim users may also like to swap caps lock and escape, but I had mixed results with that.

    • hisbaan@lemm.ee
      link
      fedilink
      arrow-up
      2
      ·
      1 year ago

      Using shift+hjkl for 10 line jumps you lose J to combine lines which I find myself using a lot. Do you have those kind of things bound to something else or do you just not use them?

      • zygo_histo_morpheus@programming.dev
        link
        fedilink
        arrow-up
        2
        ·
        1 year ago

        One option is to use alt+hjkl instead. Vim can be a bit weird about alt mappings so nothing is bound to alt by default. Neovim has better alt support out of the box so it’s a good way to add extra mappings without conflicting with the default ones.

  • zygo_histo_morpheus@programming.dev
    link
    fedilink
    arrow-up
    2
    ·
    1 year ago

    How familiar are you with vim? You’ve been using it with vscode for a while so I figure you’re somewhat familiar with vim shortcuts? If you haven’t already, you should run through vimtutor. The built in help is very good in vim, it’s good to develop a habit of using :help and :helpgrep before googling. When in help pages you can use C-] to go to references in the documentation.

    Some resources that I found useful when getting in to vim:

    Articles: Oil and vinegar, Death by a thousand files

    Talks: Let vim do the typing, How to do 90% of what plugins do with just vim

    Speaking of plugins, tpope has an excellent repo of very good plugins that feel like they fit in very naturally with vim. I can especially recommend fugitive, commentary and surround

    • madeindjs@lemmy.mlOP
      link
      fedilink
      arrow-up
      1
      ·
      1 year ago

      Yeah, I’m familiar with shortcurts to move the cursor and text manipulation. But I’m not familiar with buffers, tabs and splitting window (i used VSC GUI to handle this part).

      I’ll have a look to your links, thank you very much

      • zygo_histo_morpheus@programming.dev
        link
        fedilink
        arrow-up
        2
        ·
        edit-2
        1 year ago

        The help pages for buffers, tabs and manipulating windows (:help CTRL-W) are always a good place to start!

        Some basic pointers:

        Buffers

        A buffer is some text that vim has in memory, usually linked to a file, but not necessarily.

        You might want to :set hidden to allow for buffers to exist without being open in any window.

        I have this mapping in my .vimrc for moving between buffers

        " switch between buffers
        nnoremap <leader>b :ls<cr>:b<space>
        

        If you hit the leader key (backslash by default) you can see all open buffers. You can then type one of the numbers preceding the buffers, or start typing the name of one of the buffers and then tab complete.

        Windows

        A window is a particular view into a buffer. You can have windows that point to the same buffer but are scrolled to different places which can be convenient if you want to look at different parts of the same file side by side for example. You can split the current window with C-W S (horizontally) or C-W V (vertically). You can also close the current window with C-W Q. One common way to move between windows is C-W + one of hjkl, but there are a ton of other ways that can sometimes be more convenient listed under :help CTRL-W.

        Tabs

        A tab is a collection of windows. You can create a new tab with :tabnew or C-W T. You can navigate between tabs with :tabnext or gt and :tabprev or gT. Tabs are usually a bit counter-intuitive when coming from other editors since they work differently in vim, but they’re very convenient once you get used to them imo.

        Jumps

        Jumps are also worth checking out, the short version is that you can go to your previous position with C-O and then back with C-I.

        • madeindjs@lemmy.mlOP
          link
          fedilink
          arrow-up
          1
          ·
          1 year ago

          Thank you very much. I already checked some blog post about it but it’s still very useful to hear iy in different words

  • complacent_jerboa@lemmy.world
    link
    fedilink
    arrow-up
    1
    ·
    edit-2
    11 months ago

    Welcome! I recommend checking out 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.

    My current neovim config is basically this, plus a few plugins added / removed.