blog Offline Code Reference

Tags:
alfred

While most code forges have a decent way of navigating code, going back and forth becomes tedious and it can often be easier to check things offline. The trick I use on my machine, is to combine alfred and a alfred-repos plugin for helping make things easier to search.

Using my own forked version to add some icons, I have a configuration file that looks like this.

{
  "__workflow_last_version": "4.1.0",
  "app_alt": "Terminal",
  "app_cmd": "Gitup",
  "app_default": "Visual Studio Code",
  "app_ctrl": "Browser",
  "global_exclude_patterns": [],
  "search_dirs": [
    // Projects is self explanitory
    {
      "depth": 2,
      "path": "~/Projects",
      "icon": "project.png"
    },
    // References is any 3rd party code I might want to view
    {
      "depth": 2,
      "path": "~/References",
      "icon": "references.png"
    },
    // I keep some documents in git as well
    {
      "depth": 2,
      "icon": "document.png",
      "path": "~/Documents"
    }
  ]
}

Adding icons gives me an extra visual hint what type of repo is found from Alfred.

With this, anything that I reference a lot (like django ), I can clone to my ~/References directory, and then use Alfred to quickly open it up in my default code editor to reference when I need a reminder of how things work.