Using Swipes in MacVIM in OS X

Distributed Systems with Node.js, O'Reilly 2020, has been published!

The awesome folks working on MacVIM have a convenient way for hooking into the OS X swipes for performing VIM actions. All you need to do is map the and inputs to a vim action!

The following chunk of VIM commands are copied from my personal .vimrc file. I've wrapped everything specific to configuring MacVIM inside of a conditional statement. The reason for this is my config file is shared across different environments, and trying to map the swipe actions in a linux terminal isn't going to make a lot of sense.

if has("gui_macvim")
    set transparency=15            " Makes the background window 85% opaque
    set guifont=Monaco:h10         " Monaco 10 is my favorite font
    set noantialias                " Especially when it isn't aliased
    map  :bprev                    " Swipe left opens a previous hidden buffer
    map  :bnext                    " Swipe right opens the next hidden buffer

You'll see that I've got the swipes setup to use the bprev and bnext commands. These are provided by the buftabs plugin. You can, of course, map these to any other VIM command you would like to use.

Tags: #ide #macos #vim
Thomas Hunter II Avatar

Thomas has contributed to dozens of enterprise Node.js services and has worked for a company dedicated to securing Node.js. He has spoken at several conferences on Node.js and JavaScript, is an O'Reilly published author, and is an organizer of NodeSchool SF.