Category: vim

  • 5 Vim plugins you might need for everyday work

    5 Vim plugins you might need for everyday work

    I switched to NeoVim entirely only four months ago. That wasn’t too hard for me. I was preparing for years without even knowing that. I had a few reasons for that switch, but two of them are the most important.

    First, I wanted to have an efficient workflow without constantly changing a tool in my hand: it is really distracting for me. I was trying to achieve it using shortcuts, plugins for IDEA/PhpStorm, etc., but the process wasn’t complete. I always felt gaps.

    The second reason was the need to move somewhere from JetBrains products, as they decided to not allow Russians to use their products for political reasons. But that’s a common decision in the business area nowadays, so I don’t blame them. Especially, because they made me to do that important step, eventually.

    Many years ago, I realized that Vim was my favourite editor for editing files remotely, so basic movements and quitting weren’t a problem for me. However, working with projects looked like a nightmare to me. Watching ThePrimeagen’s videos, I found that even tools that come out of the box with Vim can solve the problem. NetRW is a simple and powerful tool.

    But it is not enough when you want to quickly switch between files. So I added Telescope and Harpoon to my tool set. First help to find anything in the project, the second is really helpful when you do an actual work and have to switch between more than 2 files.

    I can’t imagine my work without linters and language servers. I’ve set them up a few times from scratch, but there were different tiny issues that I didn’t know how to fix. Eventually, I came across LSP Zero, which did all the hard work for me. Accompanied by Mason, it leaves you almost with no work to do for setting it up properly.

    I have to mention Treesitter, which makes code look better, and Copilot which, generally, makes life easier, but, honestly, I can survive without them.

    The one I use rarely, but every time I’m happy I know about it is undotree. You know, sometimes you appear in a situation when you went into a wrong direction while coding and you want to find a place where things went wrong. Here it comes on the scene, providing an accessible (in my understanding) way to work with the changes history.

    The last plugin isn’t required at all. But I enjoy it. And it helps me to improve my Vim skills. vim-be-good. Try it. I believe you’ll fall in love.

  • Vim bindings in my browser

    Vim bindings in my browser

    Oh, I got used to Vim bindings so much! I think half of my work time I spend in NeoVim, so those bindings become my second nature.
    And because of that, working with text in Chrome (actually, it is not the single browser for me, but it is the default one at work) becomes less and less convenient.

    A few days ago I decided that it’s enough, and I have to find a solution. Previously, I heard about approaches to use you NeoVim inside your browser.

    I started looking for exactly this solution, and soon I found Firenvim. It wires your NeoVim with your browser. I was so excited! Until I tried to edit the description for my pull request on GitHub. It appeared to be a bit glitchy and I couldn’t use Cmd+V to insert some text from my clipboard. I’m pretty sure it was possible to solve those problems, but I decided to look farther, for something more native for the browser. I think I’ll come back to Firenvim later, but at the moment it is too much for me.

    I opened to Chrome Web Store and typed “vim mode” in. Markdown Anywhere appeared a very surprising solution for me. Its main purpose isn’t provide Vim-bindings, but to make editing of Markdown in browser more comfortable. At the same time, it provides bindings and does it perfectly.

    A short remark here: I had to search for “vim bindings” there to get more expected results.

    I checked Google with the same keywords: “vim mode”. And it brought Surfingkeys in front of my sight. This plugin solves the problem of navigation in the browser using Vim-bindings (and even more).

  • Vim, подстройка

    Уже наверное, года четыре постоянно приходится пользоваться Vim для редактирования файлов на серверах. Всегда знал, что настроить его можно, периодически встречал некоторые настройки, но никогда не обременял себя тем, чтобы взяться и отключить-таки этот злосчастный word-wrap или выставить-таки табуляцию нормальную. А сегодня просматривал Хабра-ленту и встретил, кажется, аж три поста, посвященный Vim’у. В общем, руки зачесались. Во-первых, чтобы где-то хранились настройки для редактора, надо создать файл .vimrc в вашей домашней директории, у меня это /home/decoder/.
    Открываем его и вбиваем самое главное:

    syntax on
    set tabstop=4
    set shiftwidth=4
    set smarttab
    set expandtab
    set smartindent
    set nowrap

    Думаю, все настройки вполне понятны. Вообще, в этом файле можно задавать кучу разных настроек, которые влияют на работу редактора. Я пока только мельком просмотрел, а разбираться толком буду чуть позже.