Vim Sexp Cheat Sheet

August 20, 2015

There are two fantastic Vim plugins that make it delightful to edit parentheses-heavy Lisp code (e.g., Racket or Clojure). I don’t know how I lived without making much use of these for years: parentheses can be terribly unwieldy.

Install them both now if you haven’t already! And read on for the cheat sheet that makes wrangling parentheses a walk in the park.

Continue reading →

GPG Howto

August 8, 2015

Audience:anyone

Keywords:gpg security privacy encryption

❧❧❧

Continue reading →

Stack Overflow’s Motivation Engine

July 20, 2015

Audience:programmers

You’ve spent plenty of time on Stack Overflow. Google loves it. Several visits per day? But unless you’re one who answers questions there, you’re probably not aware of how they get so much participation.

I’ve recently been answering questions on Stack Overflow. Well, I had to in order to be able to do things like upvoting. Aren’t we obligated to upvote when someone has taken the time to teach us something valuable? And that was the first hook. But it turns out that SO has a very sophisticated set of motivators to keep you participating …​ frequently!

Continue reading →

Vi-Mode Ubiquitous Cursor Indicator

July 20, 2015

Audience:programmers

It should be as easy as possible to tell if you’re in normal or insert mode. Your eye tends to be on your cursor, so you’ll find the cursor to be the best indicator of your mode. Of course, you’re effectively in Vim when in Zsh (bindkey -v, right?), too, so it should have the same cursor indicator.

This recipe has been described scattershot in various places, but never comprehensively. This version will give you a solid block cursor in normal mode, and a blinking, gray underscore cursor in insert mode. I’ve also set it to green block for Zsh, blue for Vim. Change it to whatever you like. It’s big and bright so you can easily find it. Then it’s small and flashing to remind you to get out of insert mode. Whatever colors/styles you choose, rejoice that it now works!

Continue reading →

Clojure, Vim, nREPL, Fireplace, REDL Setup

July 13, 2015

These are the steps I take to set up a new Arch system with a Clojure environment for vim.

  • Get lein up to date

    lein update
  • Install new version of clojure, eg, Arch: yaourt -S clojure

  • Update lein search index: lein search whatever

  • Set up fireplace, highlighting, mappings, sexp into .vimrc with Vundle:

    Plugin 'guns/vim-clojure-static.git'
    Plugin 'guns/vim-clojure-highlight.git'
    Plugin 'tpope/vim-leiningen.git'
    Plugin 'tpope/vim-dispatch.git'
    Plugin 'tpope/vim-fireplace.git'
    Plugin 'tpope/vim-sexp-mappings-for-regular-people'
    Plugin 'guns/vim-sexp'
    Plugin 'guns/vim-slamhound'
    Plugin 'dgrnbrg/redl'
  • Add to ~/.lein/profiles.clj:

    {:user {:plugins [...
                      [cider/cider-nrepl "0.10.0"] ]
            :dependencies [...
                           [spyscope "0.1.5"]
                           [redl "0.2.4"] ]
            :injections [...
                         (require 'spyscope.core)
                         (require '[redl complete core]) ]}}
  • Create new project:

    lein new foo
  • Add to each project:

    :main foo.core
    :repl-options {:init-ns foo.core})
  • Run lein deps

  • Start tmux? Maybe not; slime not working now anyway

Now you need an nrepl running somewhere. You can either:

Continue reading →