NeoVim and Atom

One of NeoVim's promises is a "better GUI architecture". That means you can access NeoVim over a lightweight protocol that allows it to act as a text manipulation engine. From what I understand, this will be supported by the Msgpack-RPC interface:

At this point, only plugins use msgpack-rpc, but eventually even user interaction will be achieved through the protocol, since user interfaces will be separate programs that control a headless Nvim instance.

Rather than using Vim emulators in GUI editors and IDEs, you could use plugins that map from the GUI tools directly to NeoVim. The first project that I've seen to attempt to take advantage of this is carlosdcastillo/vim-mode, which basically turns Atom into a NeoVim client. The author has a YouTube video that demonstrates the main features: keys are mapped to NeoVim in real time, and the results of edits are passed back.

Read More →

Selecta

Selecta

Tyler Benziger sent in Selecta (GitHub: garybernhardt/selecta, License: MIT) by Gary Bernhardt. It's a fuzzy file finder that also works with command names, help topics, identifiers, or anything else that has a list.

It's designed to be used with Vim, but you could use it with other programs as well. Given a list of items in stdin, it'll present a fuzzy selection interface. The subsequent selection will be printed on stdout.

Read More →

Interview with Bram Moolenaar

Binpress has an interview with Bram Moolenaar that focuses on the business-side of Vim: the choice of charity, keeping the project sustainable, and the future of Vim:

Nothing spectacular. Mainly small improvements. There are a few areas that could do with bigger improvements, such as making it easier to write and use plugins. But it's not clear how to do that. And plugin managers appear to be filling the gap quite well.

There are also some interesting comments about NeoVim:

Read More →

How a Broken Keyboard Improves Vim Skills

I've been reading a series of articles by Dan Prince about why he loves Vim. The second article is about how a broken laptop keyboard forced him to get better at Vim.

One day the left arrow key on my laptop broke. It completely stopped working.

This was at a time when I had projects to finish at work, assignments to write for University and I was attempting to devote time to working on personal projects too.

Read More →

Snapshot.vim

snapshot.vim (GitHub: gelguy/snapshot.vim, License: MIT) is a plugin for storing sections of code so you can quickly revert later. You might prefer to do this rather than doing something like git stash. It works well visually because it can dim regions as you select text to snapshot.

The default mappings are <leader>a for defining a snapshot region, <leader>s for storing the snapshot, and <leader>S for viewing and selecting the stored snapshots.

If you like the idea then be aware that snapshots aren't persisted so they'll be lost if you quit Vim. It's really intended as a tool to help you make potentially breaking changes that aren't cleanly encapsulated by an undo.

Read More →

Do You Remap Caps-Lock?

I've been remapping the caps-lock key to CTRL for a long time now. So long that it takes me a few minutes of fumbling before I can get used to the standard mapping. Vim uses CTRL for lots of handy shortcuts, and I find caps-lock easier to hit with my little finger than the standard position for CTRL. I think Apple keyboards made this worse, but I currently use a Topre Realforce and it's better there too.

If you want to do this then on Mac you're looking for "Modifier Keys":

Reset Modifier

Read More →

Resize Windows with directionalWindowResizer

Vim's default window resize shortcuts aren't bad, but I found them quite hard to get used to. directionalWindowResizer is an attempt to make resizing more intuitive by allowing the CTRL key to be used instead.

The directional keys are used (hjkl), and the windows are resized depending on the selected window. For example, if you've got four horizontal windows and you've selected one in the middle, then pressing CTRL-k will resize upwards, and CTRL-j will increase the size downwards. However, if you've got the top or bottom window selected, then the behaviour changes: pressing up or down just moves the opposite partition.

I found it easier to understand than CTRL-W + and -, and it's a small, hackable script that you can edit if required.

Read More →

Vim Opinion

Mark Steve sent in rstacruz/vim-opinion, a plugin that captures commonly used .vimrc settings so you can easily install and use it with Vundle or Pathogen. It's designed to be used with Tim Pope's sensible.vim.

The included documentation has instructions on how to install it for beginners, so if you've never used Vundle before then you'll find this useful.

Most of the settings are what I've got in my .vimrc. For example, set ruler, set incsearch, syntax on, and set ttyfast. You should check each setting before installing the whole thing, but using sensible.vim and vim-opinion is definitely preferable to installing a random .vimrc or dozens of plugins.

Read More →

Intercepting Writes to Files with BufWritePost

Sometimes you find yourself frequently running the same command whenever you save a file. Maybe it's restarting a local web server, running a build script, or checking your code with a linter. This can be scripted quite easily with BufWritePost command. The basic usage is:

autocmd BufWritePost *.ext call methodName()

This is used in lots of scripts. jshint.vim uses it to invoke a linter, and HgCi will make a commit in Mercurial whenever a file changes.

There's even a newer Git equivalent called YUNOcommit.vim which shows a message with echo and echohl when you haven't committed frequently enough. This plugin is actually quite short and readable, so you can use it as a basis for your own BufWritePost experiments.

Read More →