zabouti |||

What is modern Vim? — usevim — Medium


Drew Neil, the author of Practical Vim and Vimcasts is writing a new book called Modern Vim. Modern Vim is a great title and captures the significance of Vim 8 and Neovim: both of these versions add key features that streamline plugin management and improve the responsiveness of Vim’s UI (even in text mode!).

One of the main innovations in Vim 8 is asynchronous I/O, which allows plugins to communicate with other processes without interrupting the UI. If you’ve ever used a plugin that extends Vim’s search or autocomplete behaviour then you’ve probably noticed that the UI blocks while results are displayed.

Asynchronous I/O totally changes the behaviour of Vim, adding interactive features that are typically only enjoyed in GUI editors. Editors like Atom and Visual Studio Code come with real-time autocompletion out of the box, and although this can feel noisy and distracting to old school Vim users like me, it is definitely useful when working on new or complex projects.

If you’re not yet a Vim 8 or Neovim convert, then I recommend setting up a new installation of Neovim with asynchronous plugins in mind. The first plugin that I discovered had a real benefit to my workflow was w0rp/ale, an asynchronous linting engine. In my older Vim setup the linter only ran when I saved a file, but ale runs without any invocation.

Realtime linting with ale

Another great plugin is roxma/nvim-completion-manager, which shows the kind of autocompletion you might have seen in Atom. The following screenshot demonstrates nvim-completion-manager autocompleting Vim script functions.


Make sure you read the readme if you want to install the tern completion script. This vastly improves JavaScript completion, but requires an npm install to get everything ready. I was able to do run npm automatically by using Vim Plugs do option:

Plug 'roxma/nvim-completion-manager'  
Plug 'roxma/nvim-cm-tern', {'do': 'npm install'}

I use fuzzy finding all the time because I tend to remember file names rather than a file’s exact location in the source tree. Installing fzf requires some Python packages, so make sure you follow the readme properly. You’ll also want fzf.vim which adds some handy Vim scripts for working with fzf. The fzf.vim bundle can do things like search files, Git, buffers, Ctags, and many more lists of things.

Neovim still offers one large feature over Vim 8: an integrated terminal. By typing :term you can open a terminal that works like any other Vim buffer. That means you can quickly perform Git commands or any other project lifecycle tasks. The biggest strength of using a terminal embedded in the editor is for a REPL-based workflow: you can quickly yank code in and out of an interpreter to try out code as you’re working. It’s very similar to the benefits of working with split windows in tmux or iTerm 2, except the editor integration means all of your Vim editing and movement shortcuts work seamlessly.

Working with a split terminal in Neovim

Any command-line tool that you enjoy using alongside Vim can be used in Neovim’s split terminal. For example, if you like using tig, the text-mode Git interface, then you can open a panel that runs tig! This instantly gives you the power of integrated Git, without waiting for Neovim or a plugin author to add this functionality. Again, this usage is similar to the benefits of using tmux alongside command-line Vim, but you might prefer the integrated approach because it adds a modal layer for movement and yank/paste over tig.

Neovim and tig

Modern Vim is an editing style that draws on richer sources of information to improve developer experience. It’s also a runtime environment that provides plugin authors with tools to extend the editor, facilitated by features for asynchronous I/O and saner plugin management features. I’m looking forward to reading Drew’s book, not just because Practical Vim was excellent, but also because I want to see how far Drew can go with the concept of modern Vim.

Up next Political Strategy Notes — The Democratic Strategist Source As we commemorate Memorial Day, Samantha Layne’s “9 Ways Republicans Could Have Helped Veterans…But Decided Not To” at How to Try macOS on Windows 10 With a Virtual Hackintosh Source Windows 10 is a great operating system. Sure, it has its quirks and annoyances, but what OS doesn’t? But even if you’re beholden to Microsoft
Latest posts Vocabulary lesson Iris and I had an interesting discussion with Google Bard this morning. Discussion on the Pomona College class of 1964 listserv I’m illiterate Elon Musk I love photographing the artists at Wildacres Eating a Mouse It Really is a Fascist Flag (at least to some Americans) I love the New York Times Metropolitan Diary Watching The Ten Commandments in Gafsa, Tunisia, in the sixtes I wanna be like these guys when I’m their age! The insignificance of photography Enough photos from our trip to Japan MoveOn wants to amend the Constitution? Google Sheet Number Formatting Summer Brake Romantic technologies and ideologies PITY THE NATION Basho’s poem, Even in Kyoto War in Ukraine - an explanation Timothy Snyder’s History of Ukraine Fake Email Senders More on language learning Effect and Cause Soros is my Co-Pilot Note à une chère amie Arnold Schwarzenegger Why Purim upsets me I was a Programmer Who Swore Constantly I perceive new things as my nerves slow down