My Upcase Show Notes Workflow

My Upcase Show Notes Workflow

I was talking to @geoffharcourt the other day about how I use the Upcase show notes as
sort of a cheat sheet or reference guide after I’ve finished the Upcase trail.
This started because I found myself constantly heading back to Upcase trails to reference
something I learned before. Well, that started to seem inefficient so I came up
with this solution, it works well for me so I thought I would share how I reference
my show notes first from the terminal and then from vim.

Terminal Integration

Here goes, so generally what I do while going through a trail is I will copy
something (or most things) from the show notes and paste it into a markdown file
that I can reference later.

(Note: I don’t keep my show note cheat sheets on github because the Upcase
material is not open source and it wouldn’t be cool to do that, so I won’t be
posting them here. However you can easily take the workflow and do it yourself.
I recommend using the Dropbox or Google Drive desktop apps and keeping them there.)

For instance, when going through the Mastering Git course, one thing
that I really wanted to incorporate in my daily habits was the the Thoughtbot
Worklfow for git, so I created a file called git.md in my notes directory
and I pasted in some excerpts from the show notes. A sample of that file looks
like this:

THOUGHTBOT WORKFLOW
Start with a branch:         co -d <branch>
Check git diff before push:  Gdiff master
Push up PR with tracking:    push -u origin <branch>
Open pr:                     pr or hub pull-request
Rebase for FF merge          mup
Interactive Rebase           rebase -i master
Force push branch            pf
...

Now I’ve got my cheat sheet made, but I want to be able to access it really
quickly because I don’t want it to slow my workflow down by going to my notes
folder and opening the file and then switching back to my project, and now I’ve
got this other buffer open and soon I’ll be experiencing tab death, etc.

So one thing I’ve gotten used to is using leader keys in vim. If you’ve taken
the Art of Vim trail on Upcase, you know that @r00k encourages you to use
leader keys and I wanted similar functionality in the terminal even if I don’t have
vim open for whatever reason, so I came up with this solution in my .aliases
file for quick access to the show notes:

alias cg="less ~/Google\ Drive/notes/git.md"

This uses the less pager to display my cheat sheet immediately in the terminal
and all I have to do is press cg to open it.

(Note: I chose cg as the alias because I used to have all the show notes in
one huge file called code_notes.md and then I extracted them all out into their
own files and just kept that pattern [code_git, code_ruby, etc.] because it’s
easy to remember and it wasn’t being used by any other programs, but use whatever
alias makes you happy and isn’t taken by another program.)

Now you can just repeat that step for all your cheat sheets and you’ll have
nice quick access whenever you need them from the terminal.

Integrating with Vim

For vim integration I took a slightly different route. I wanted to take
advantage of leader keys, but I didn’t want one for every cheat sheet and I
wanted to be able to open the cheat sheets in vim as opposed to using less. So,
here’s what I came up with:

First I wanted to open up my notes directory in a split and have it show all my
notes so that I could select the one I wanted for viewing or editing. Enter
the :Sexplore command. :Sexplore opens up a horizontal split in the
current directory, which is almost what I wanted, but not quite. I wanted it to
open my notes directory, so I used this mapping in my .vimrc for that:

" Code notes
nnoremap <Leader>cn :Sex ~/Google\ Drive/notes/<cr>

Now I can hit <leader>cn from any vim buffer and I will get a horizontally split
directory that shows all my show note files and then I can just select the one
I’m looking for.

So that is my whole show notes workflow. I hope you find it useful and if you
have any thoughts on how to improve it feel free to let me know. Thanks.

2 Likes

Absolutely bonkers. :sparkles:

1 Like

Wow! Thanks a lot, that’s going to be helpful!

I’ve been keeping my snippets in an Evernote notebook so far, but I’d like to have them in my vim or tmux sessions.

I’ll try your approach instead

1 Like

This is a great tip. Although I use all my snippets and notes with Alfred, I like your less pager approach to display right there in the terminal. Alfred has been fast enough for me to display these kind of snippets, but I think I might try this! Thanks for sharing!

2 Likes

Finally I managed to get some spare time to play with this. Here’s what I did, if it’s useful to you:

I did a simple bash function to show the note that matches a search using the pager as you did. When the search has multiple results, I pipe them to fzf, although I could also use thoughtbot’s pick.

So, whenever I need them I open an split, yank the snippet, and close it.

As for vim, I went with CtrlP instead, which I’m already familiar with. Again, this allows me to open the note where I need, either with a vertical or horizontal split.

2 Likes

Ha, wow! This is a great improvement. I’m stealing it. Thanks @sauloperez.

I hope you have better bash-scripting skills than me! because I don’t like those repeated finds at all.

1 Like

I basically just use this as a reference guide: The Unix Shell's Humble If
But no, my skills are not great, however if I come up with a decent refactor, I’ll post it up here. Thanks again!

2 Likes