all repos — website @ f9567068c0871a2ca8aea3941cf33b386476a5d1

My website

Use code fences instead of template tags for syntax highlighting

Alan Pearce
commit

f9567068c0871a2ca8aea3941cf33b386476a5d1

parent

f105fee2b4f3cb6995c06e344e1587de42869b64

1 file changed, 8 insertions(+), 8 deletions(-)

changed files
M post/repository-management-with-ghq.mdpost/repository-management-with-ghq.md
@@ -8,10 +8,10 @@ I recently encountered [ghq][], a tool for automatically organising VCS-backed
projects automatically. Give it a repository URL, it will clone a project to your projects dir (set by `$GHQ_ROOT`) like so: -{{< highlight sh >}} +```sh $ ghq get https://github.com/motemen/ghq # Runs `git clone https://github.com/motemen/ghq ~/.ghq/github.com/motemen/ghq` -{{< /highlight >}} +``` I don't like the idea of having projects hidden away, so I set `$GHQ_ROOT` to `$HOME/projects`.
@@ -23,11 +23,11 @@ I wanted a nicer way to visit project directories. Since I'm
using [fzf][] as a fuzzy-finder, I thought it would be nice to use it for this. I created a simple function, `fp` (find project) to do that: -{{< highlight sh >}} +```sh fp () { ghq look $(ghq list | fzf +m) } -{{< /highlight >}} +``` I ran into some issues with the subshell of `ghq look` and wondered whether it might be possible to create a zsh command to remove the
@@ -36,7 +36,7 @@
I found that `fzf` includes a [cd-widget function][fzf-cd-widget] and created something similar that uses `ghq` instead of `find`: -{{< highlight sh >}} +```sh cd-project-widget () { local cmd="ghq list" setopt localoptions pipefail 2> /dev/null
@@ -52,7 +52,7 @@ typeset -f zle-line-init >/dev/null && zle zle-line-init
return $ret } zle -N cd-project-widget -{{< /highlight >}} +``` It should be quite simple to modify it to work with other fuzzy-finders. The basic idea is to show the output of `ghq list` for
@@ -62,9 +62,9 @@
What's really nice about this, is that I can bind it to a key sequence: -{{< highlight sh >}} +```sh bindkey '\es' cd-project-widget -{{< /highlight >}} +``` Now I can press `M-s` in a shell, start typing "dotfiles" and press enter to `cd` to my [dotfiles][] project. Pretty neat!