Skip to content

Instantly share code, notes, and snippets.

@augustoroman
Last active January 24, 2019 02:42
Show Gist options
  • Select an option

  • Save augustoroman/410ff529683ce0a20281570c269d9128 to your computer and use it in GitHub Desktop.

Select an option

Save augustoroman/410ff529683ce0a20281570c269d9128 to your computer and use it in GitHub Desktop.
aroman's new computer setup (.bash_profile w/ colors, sublime plugins, etc)
# This is for OSX
tput colors > /dev/null
if [ "$?" == "0" ]; then
color_prompt="yes"
fi
export CLICOLOR=1
export LSCOLORS=ExFxCxDxBxegedabagacad
source /usr/local/etc/bash_completion.d/git-completion.bash
source /usr/local/etc/bash_completion.d/git-prompt.sh
source /usr/local/etc/bash_completion # brew install bash_completion for this
## source /usr/local/go/misc/bash/go # bash completion for go command
# The next line enables bash completion for gcloud.
#source /Users/aroman/sdk/google-cloud-sdk/completion.bash.inc
source ~/.aliases
if [ "$color_prompt" = yes ]; then
# If it's an interactive shell, update the prompt:
LAST_COMMAND='$(if [ "$?" = 0 ]; then echo "\[\e[1;32m\](✔)"; else echo "\[\e[1;31m\](✘)"; fi)'
GIT_BRANCH_IF_AVAILABLE='$(__git_ps1 "\[\e[1;36m\]%s\[\e[0m\] ")'
HOST_AND_PATH='${debian_chroot:+($debian_chroot)}\[\e[0;32m\]\h\[\e[0m\] \[\e[1;35m\]\w\[\e[0m\]'
FINAL_PROMPT='\$ \[\e[1;33m\]'
PS1=${LAST_COMMAND}' '${HOST_AND_PATH}' '${GIT_BRANCH_IF_AVAILABLE}${FINAL_PROMPT}
# Reset color immediately after hitting enter
trap "echo -n $'\e[0m' > $(tty)" DEBUG
fi
unset color_prompt force_color_prompt
# Perform file completion in a case insensitive fashion
bind "set completion-ignore-case on"
# Treat hyphens and underscores as equivalent
bind "set completion-map-case on"
## History management ##
# Append to the history file, don't overwrite it
shopt -s histappend
# Save multi-line commands as one command
shopt -s cmdhist
# Huge history
export HISTSIZE=100000
export HISTFILESIZE=100000
# Avoid duplicate entries
export HISTCONTROL="erasedups:ignoreboth"
# Don't record some commands
export HISTIGNORE="&:[ ]*:exit:ls:bg:fg:history"
# Record each line as it gets issued -- this screws up the new terminal dir.
export PROMPT_COMMAND='history -a;update_terminal_cwd'
# Useful timestamp format
export HISTTIMEFORMAT='%F %T '
# Correct spelling errors during tab-completion
# shopt -s dirspell
# Correct spelling errors in arguments supplied to cd
shopt -s cdspell
# This defines where cd looks for targets
# Add the directories you want to have fast access to, separated by colon
# Ex: CDPATH=".:~:~/projects" will look for targets in the current working directory, in home and in the ~/projects folder
CDPATH="."
# This allows you to bookmark your favorite places across the file system
# Define a variable containing a path and you will be able to cd into it regardless of the directory you're in
shopt -s cdable_vars
# Examples:
# export dotfiles="$HOME/dotfiles"
# export projects="$HOME/projects"
# export documents="$HOME/Documents"
# export dropbox="$HOME/Dropbox"
export GOPATH=$HOME/go
export PATH=/usr/local/bin:${PATH}:$HOME/bin:$HOME/go/bin:/usr/local/share/npm/bin
export EDITOR="sublime_text -n -w"
# Up/down completes via history rather than merely scroll blindly through hist.
bind '"\e[A": history-search-backward'
bind '"\e[B": history-search-forward'
# The next line updates PATH for the Google Cloud SDK.
source '/Users/aroman/code/google-cloud-sdk/path.bash.inc'
# The next line enables shell command completion for gcloud.
source '/Users/aroman/code/google-cloud-sdk/completion.bash.inc'
# For brew: It puts some binaries in sbin.
export PATH="/usr/local/sbin:$PATH"

Some nice software to have installed:

OSX

  • Chrome: of course.
    • disable chrome's swipe-to-go-back: defaults write com.google.Chrome AppleEnableSwipeNavigateWithScrolls -bool FALSE
  • Sublime: or vscode, or both
  • f.lux: don't stay up too late
  • iterm2: better than the built-in terminal
  • dash: programming reference material
  • moom: convenient window management additions
  • scroll reverser: I like my trackpad and my mouse wheel to be opposite
  • caffeine: avoid the screensaver kicking in, especially during presentations (running in mojave)
  • menumeters: keep an eye on your system
  • FuzzyFileNav: Allows easily navigating to nearby files using sublime's awesome filtering dialogs. I configure this to replace the default file open action:

    Keybindings:

    [
        // Start from the parent folder of the current view's file
        { "keys": ["super+o"], "command": "fuzzy_start_from_file" },
        // Show bookmarked folders
        { "keys": ["super+shift+o"], "command": "fuzzy_bookmarks_load" }
    ]

    Config:

      {
          // If the "FuzzyStartFromFileCommand" is run outside of a open buffer
          // or from a buffer that does not exist on disk, you can specify
          // its default action to do instead of starting navigation from
          // a file's location.  Options are "bookmarks", "home", "root", "project".
          "start_from_here_default_action": "bookmarks",
    
          // Bookmarked paths
          "bookmarks": [
              {"name": "Home", "path": {"#multiconf#": [{"os:osx": "~"}]}},
              {"name": "Root", "path": {"#multiconf#": [{"os:linux": "/"}, {"os:osx": "/"}]}}
          ],
    
          // Add your folders relative to the project file (if project file exists on disk)
          "add_folder_to_project_relative": true,
      }
  • Origami: Allows arbitrarily splitting windows. The keyboard shortcuts take a little getting used to, but it works.

  • MaxPane: Especially combined with Origami, this is nice. Maximize any pane temporarily with cmd+shift+enter

  • Alignment: Horizontally align multiple cursors on various lines.

  • Git:

  • GitGutter:

  • SideBarEnhancements:

  • Missing Palette Commands: Adds most of the standard menu operations to the cmd-shift-P command menu.

  • Case Conversion: Includes tons of different target case conversions, e.g. PascalCase, camelCase, snake_case, etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment