My workflow, tmux, vim, etc.


I thought I should do the sort of post that everyone seems to do and show off my workflow, with all the horrendously try-hard command line utilities, and DIY config files. You can find my dotfiles here .

I spend most of my time working on my macbook pro, within an iTerm2 window running tmux.

I have a bash script that builds a tmux session and fills it with useful programs. I have vim in one window, then a whole load of small empty shell panes in the next window, and finally cmus in the last window for playing music:


# Create new session
tmux -2 new -s 'dash'

# Start vim
tmux send-keys "vim" Enter

# New window, split into 4
tmux new-window -n 'bash'
tmux split-window -v
tmux split-window -h
tmux select-pane -t 1
tmux split-window -h

# Split pane 1 vertically
tmux select-pane -t 1
tmux split-window -v

# Split pane 5 horizontally
tmux select-pane -t 5
tmux split-window -h

# Resize panes
tmux resize-pane -D 8

# New window, start cmus
tmux new-window -n 'cmus'
tmux send-keys "cmus" Enter

# Detach and reattach to make it work properly
tmux detach
tmux a -t dash
tmux select-window -t 1

I dabbled in using tmux-resurrect and tmux-continuum to save my tmux sessions when I rebooted, but I found that these plugins weren’t always reliable. Besides, I don’t usually reboot my laptop unless I’ve first saved all my files.

I used to have a lot more things running in tmux. I used alpine to manage email from my gmail account, and I used the calendar.vim plugin with a custom .vimrc to link to my google calendar, but when I started back working full time I found that it actually saved me a bit of time to just use the default macOS Calendar and Mail apps.


I use vim to take all my notes. I use markdown to format all my notes. I have a note for each day, or at least each workday. The basic format of my daily note is:

# Item 1
* Thing to do one
* Thing to do two
	* detail 1
	* detail 2


# Item 2
* Thing to do one

* Thing to do, done


At the end of the day, I copy that day’s note into a new note with tomorrow’s date. So in the end I have a folder of notes with names like this:

I also have this neat way of roughly tracking how productive I’ve been. I can count the number of lines within the ==================DONE=================== tags. Then I can turn that into a csv, then import that into R and plot a graph of how much I’ve done over time. It’s not that useful, but was a fun project to put together, and a way to learn about grep.

The bash script:


# Create csv file of completed items from daily notes by counting lines between #DONE# marks
touch ~/Desktop/word_count.txt

# Using a for loop and multiple sed arguments to amend the file (takes longer)
for f in ./*; do { printf '%s ' "$f"; sed -n '/DONE/,/DONE/p' "$f" | wc -l; } >> ~/Desktop/word_count.txt; done

# Make multiple whitespace into 1 whitespace, to csv
awk '{$1=$1}1' ~/Desktop/word_count.txt > ~/Desktop/word_count.csv

# Replace "md " with "md,"
perl -pi -w -e  's/md\s/md,/g;' ~/Desktop/word_count.csv

# Add column names
echo -e "date,count\n$(cat ~/Desktop/word_count.csv)" > ~/Desktop/word_count.csv

# delete txt file
rm ~/Desktop/word_count.txt

# Run R script
Rscript ~/Google_Drive/Code/R/done_count.R

The R script:

# Personal productivity by #DONE# items in Daily notes

# Packages ----

# Load data ----
prod <- read.csv("~/Desktop/word_count.csv")

# Clean up ----
prod$date <- prod$date %>%
	gsub("./Daily_", "", .) %>%  # Remove leading filename section
	gsub(".md", "", .) %>%  # Remove trailing filename section
	as.Date(., format = "%Y_%m_%d")  # Transform to Date class

# ggplot line graph ----
done_count <- ggplot(prod, aes(x = date, y = count)) +
	geom_line() +
	scale_x_date(date_labels = "%b", date_breaks = "1 month")

ggsave(filename = "ggplot_done_count.png",
			 plot = done_count,
			 width = 20, height = 20, units = "cm")

Edit 2017_12_08

I’ve been thinking more about the note-taking philosophy and have noticed a few trends in my own note-taking that make it easier for me to read things back at a later date. This has mostly come about because I am now starting to re-read my notes on academic papers as I start to write my confirmation report.

Screens and deskspace

I do nearly all of my work at my desk in the University. I have a widescreen monitor with a trailing HDMI cable that I can plug into my laptop, then to the right I have a HP all-in-one running Windows that is hooked up to the University network, just in case I need to use some piece of Windows software. For example, when I’m testing workshops for undergraduate students.