Skip to content

Instantly share code, notes, and snippets.

@kand
Last active March 20, 2019 20:10
Show Gist options
  • Save kand/d7ef1b2632bc6dbee558ce7803cf790a to your computer and use it in GitHub Desktop.
Save kand/d7ef1b2632bc6dbee558ce7803cf790a to your computer and use it in GitHub Desktop.
Dev Environment

Hey all, here are some of the tools I presented from my dev environment, I hope you can find some of these useful! Also, if you have suggestions, fixes, improvements etc. I’d love to hear them!

Command Line Tools

  • ag - Search tool that's fast and does pretty much anything you could hope for with a search tool.
  • fzf - A better version of ctrl-r backwards history search. It has a lot of other functionality as well that I'm not even really sure about!
  • hub - Tons of aliases for git commands and the ability to go from your command line to the repository.
  • tmux - This is a nice windowing program for the terminal in my keyboard-shortcut-heavy environment.

Custom Command Line Tools

gcleannup - Cleans up branches locally that are deleted on the remote. Also does some garbage cleanup. This is nice to run every other day or so because our repo is so large. Note, you may need to run git prune at least once before this command if you have a lot of old objects currently in your .git folder.

gcleanup() {
  # clean up local branches that no longer have a remote
  git fetch --prune --all && git branch -vv | grep -E ": (gone|deleted)]" | awk '{print $1}' | xargs git branch -D
  git gc
}

pom - My command line timer for the Pomodoro Technique to help focus. I don’t really follow the guidelines in the wiki exactly, but it’s pretty close:

# from https://superuser.com/a/611582/103848
countdown(){
    date1=$((`date +%s` + $1));
    while [ "$date1" -ge `date +%s` ]; do 
      days=$(($(($(( $date1 - $(date +%s))) * 1 ))/86400))
      clear
      echo -ne "\r \xe2\x8f\xb3 $(date -ju -f %s $(($date1 - `date +%s` )) +%H:%M:%S)\r"
      sleep 0.5
    done
    say 'countdown complete'
}
alias pom="countdown $((20*60))"

Then you type pom to start a 20 minute timer that will notify you when it’s complete. Note, I use oh my zsh for my command line, so this command may only work in a .zshrc.

vim

vim is awesome. This post on Stack Overflow got me into finally spending time learning it, check it out! Also, if you're a new or current vim user, checkout #talk-vim!

Here are some plugins I use:

  • vim-fugitive - Provides a number of really useful git/github integrations in vim. I use it a lot to go from VIM directly to a file on GitHub at a specific line and hash.
  • YouCompleteMe - vim autocomplete that has a kind of steep setup curve, but once it's setup it's very nice and makes vim feel more like a real IDE.
  • ALE - A linting plugin for vim that takes it another step closer to a real IDE.

Here are my insert date/time commands for a .vimrc:

" Set leader and custom key mappings
let mapleader = " "
map <leader>tt :r! date +"\%H:\%M\%z" \| tr -d "\n"<CR>
map <leader>td :r! date +"\%Y-\%m-\%d"<CR>
map <leader>ltt :r! date +"- (\%H:\%M\%z) " \| tr -d "\n"<CR>:startinsert!<CR>
map <leader>ltd :r! date +"\#\#\# \%Y-\%m-\%d"<CR>:startinsert!<CR>

Let me know if you have any questions or comments about keeping a personal log, I love it as a way to help in retrospectives and to keep on track.

Other Tools

  • vimium - Vim shortcuts for Chrome. This is great if you already use vim and kind of makes your computer feel more like a single unified environment.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment