September 09, 2013
Using Vim as your editor with Octopress works well enough except that you have to either exit out of the editor or open a second session in order to generate the site to see your new posting. Using Vimux you can run commands in a separate pane without losing focus in your Vim pane. This turns out to be perfect for creating or editing posts for an Octopress site.
First you need to add the Vimux bundle to your Vim configuration. Since I’m
using Vundle I just added this
line to my
And then installed the new bundle.
The Vimux help (
:h vimux) does a great job of explaining the various commands
and options provided by the bundle. Here are the settings I added to my
The height setting controls what percentage of your current pane will be
given over to the Vimux pane. The orientation settings controls whether the new
pane is vertically below the current one (
v) or horizontally to the right of
VimuxUseNearestPane when set to true (
1) will use the nearest
open tmux pane rather than space within the pane containing your Vim session.
With these settings in place I added some general Vimux mappings.
This brings up a
Command? prompt where you can enter any command your shell
As the name suggests,
VimuxRunLastCommand reissues the last command.
VimuxCloseRunner closes the Vimux pane.
The interrupt runner command halts the command in the runner.
Rather than have to bring up the Vimux command prompt with
,vp and then type
in my Octopress generate alias, I created some more mappings with Octopress
The first of these,
vg runs my alias for
rake generate, building what ever
is currently in the
source/_posts directory. I make heavy use of
isolate as my site contains over 2,000 entries and takes more than 8 minutes
Which explains the next mapping,
ingen is my alias that runs a
integrate followed by a
rake generate. Typically I only run this command
when a new posting has been proofread and is ready to be published.
I have two Octopress sites, one of which is
still on an much older version of Octopress. The
rake deploy task for this
older version doesn’t handle
.htaccess files, so my
dz alias chains
together the commands necessary to rsync my site and copy the
vd mapping issues my alias for a regular
rake deploy which
works for my new Octopress site.
Having Vimux in place allows me to work on a new page or posting, generating the site as I go, without losing focus in my Vim session. It has made creating new content for my sites simpler and more satisfying.