Skip to content

Instantly share code, notes, and snippets.

@hohonuuli
Created December 29, 2018 23:17
Show Gist options
  • Save hohonuuli/d2e6d18657fd2e370ce7328a5c288458 to your computer and use it in GitHub Desktop.
Save hohonuuli/d2e6d18657fd2e370ce7328a5c288458 to your computer and use it in GitHub Desktop.
# I keep all my config settings in .bashrc.
# .bash_profile redirects there
if [ -f ~/.bashrc ]; then
source ~/.bashrc
fi
# Prompt shows scp style path with git branch
PS1=$'\n\[\033[35m\]\u@\h:$PWD`git branch 2> /dev/null | grep -e ^* | sed s/"* "// | sed s/^/"\[\033[31\]m ⏣ \[\033[0;32m\]"/`\n\[\033[35m\]>> \[\033[m\]'
# ========== ENVIRONMENT VARIABLES ====================================
export AWS_ACCESS_KEY_ID=XXXXXXXXXXXXXXXXXXXX
export AWS_SECRET_ACCESS_KEY=XXXXXXXXXXXXXXXXX
export BAT_THEME=TwoDark
export BRIAN_KATAKANA="ブライァン" # Ya never know when you need your name in Japanese
export CONDA_HOME="$HOME/Applications/miniconda3"
export COPYFILE_DISABLE=true # Make clean tarballs and more in Leopard+. 'unset' to re-enable this feature
export EDITOR=nvim # In bash, [ctr]-x-e opens line in EDITOR
export GEM_HOME=$HOME/.gem
export GEM_PATH=$HOME/.gem
export GITHUB_TOKEN=XXXXXXXXXXXXXXXX
export GOROOT='/usr/local/opt/go/libexec/'
export GPG_TTY=$(tty) # I sign my git commits. This is needed
export GRAILS_HOME='/usr/local/opt/grails/libexec'
export GROOVY_HOME='/usr/local/opt/groovy/libexec'
export HISTCONTROL=erasedups # Ignores dupes in the history
export HOMEBREW_GITHUB_API_TOKEN=$GITHUB_TOKEN # Used for brew search
export JAVA_HOME=`/usr/libexec/java_home -v 1.8` # Default to JDK 8 (for now)
export MAVEN_OPTS="-Duser.timezone=UTC -Xmx4096m -XX:MaxPermSize=512m -XX:PermSize=256m -XX:+CMSClassUnloadingEnabled -noverify"
export NODE_PATH=/usr/local/lib/node_modules
export SBT_HOME='/usr/local/opt/sbt/libexec'
export SBT_OPTS="-Duser.timezone=UTC -Xmx4g -XX:+CMSClassUnloadingEnabled -noverify"
export XMLLINT_INDENT=' ' # Sets the indentation used by xmllint (default is 2)
# ========== PATH =====================================================
export PATH=$PATH:/usr/local/sbin:$GOROOT/bin:.
# ========== ALIASES ==================================================
alias cat='bat'
alias docker-kill='docker kill $(docker ps -q)' # Kill all docker containers
alias docker-down='docker-kill && docker-rm' # Kill and remove all docker containers
alias docker-prune='docker rmi $(docker images -q)' # Remove all docker images
alias docker-rm='docker rm $(docker ps -q -a)' # Remove all docker containers
alias docker-scrub='docker rmi $(docker images -q -f "dangling=true")' # Remove dangling containers
alias docker-sh='docker history --no-trunc "$@"' # Show docker image history
alias gitcp='git add -u && git commit -m "check point" && git push' # lazy git user
alias jpsa='jps -l -m -v' # Show running JVM processes
alias jvms='/usr/libexec/java_home -V' # Show available JVMs
alias jvmsettings='java -XX:+UnlockDiagnosticVMOptions -XX:+PrintFlagsFinal -version' # Show JVM Settings
alias ls='exa' # Use exa instead of ls
alias la='ls -la'
alias lc='lsof -i tcp -i udp' # Show all TCP and UDP connections
alias mkdirs='mkdir -p -v' # mkdir with itermediate directories
alias psall='ps -axww' # show all processes
alias scala='scala -Dscala.color'
alias spot='mdfind -onlyin `pwd`' # Use spotlight to search current directory
# ========== FUNCTIONS ================================================
# Run a query in Dash.app
dq () { open dash://$*; }
# Display ip adress
myip () { ifconfig en0 | grep inet | grep -v inet6 | awk '{print $2}' ; }
# Select the version of Java to use
usejava() {
export JAVA_HOME=`/usr/libexec/java_home -v $1`
}
# I prefer Conda, but it can clash with macOS build int python and homebrew
# This function prepends conda to front of path so that it becomes the selected
# Python when I want to run analysis or tasks
useconda() {
export PATH=$CONDA_HOME/bin:$PATH
}
# ========== ENVIRONMENT VARIABLES ====================================
set -x AWS_ACCESS_KEY_ID XXXXXXXXXXXXXXXXXXXXXX
set -x AWS_SECRET_ACCESS_KEY XXXXXXXXXXXXXXXXXXXXXX
set -x BAT_THEME TwoDark
set -x BINTRAY_KEY XXXXXXXXXXXXXXXXXXXXXX
set -x BINTRAY_USER hohonuuli
set -x CONDA_HOME "$HOME/Applications/miniconda3"
set -x EDITOR nvim
set -x GEM_HOME $HOME/.gem
set -x GEM_PATH $HOME/.gem
set -x GITHUB_TOKEN XXXXXXXXXXXXXXXXXXXXXX
set -x GPG_TTY (tty)
set -x GROOVY_HOME "/usr/local/opt/groovy/libexec"
set -x JAVA_HOME (/usr/libexec/java_home -v 1.8)
set -x MAVEN_OPTS "-Duser.timezone=UTC -Xmx4g -XX:+CMSClassUnloadingEnabled -noverify"
set -x SBT_HOME "/usr/local/opt/sbt/libexec"
set -x SBT_OPTS "-Duser.timezone=UTC -Xmx4g"
# ========== PATH =====================================================
if status --is-interactive
set PATH $PATH $HOME/Applications/bin .
end
# ========== BINDINGS =====================================================
function fish_user_key_bindings
bind $argv \cx edit-command
end
# ========== ALIASES ==================================================
alias cat 'bat'
alias docker-kill 'docker kill (docker ps -q)' # Kill all docker containers
alias docker-down 'docker-kill; and docker-rm' # Kill and remove all docker containers
alias docker-prune 'docker rmi (docker images -q)' # Remove all docker images
alias docker-rm 'docker rm (docker ps -q -a)' # Remove all docker containers
alias docker-scrub 'docker rmi (docker images -q -f "dangling=true")' # Remove dangling containers
alias gitcp 'git add -u; and git commit -m "check point"; and git push'
alias jpsa 'jps -l -m -v'
alias jvms '/usr/libexec/java_home -V'
alias jvmsettings 'java -XX:+UnlockDiagnosticVMOptions -XX:+PrintFlagsFinal -version'
alias ls 'exa'
alias lc 'lsof -i tcp -i udp'
alias mkdirs 'mkdir -p -v'
alias psall 'ps -axww'
alias scala 'scala -Dscala.color'
alias spot 'mdfind -onlyin (pwd)'
alias unset 'set --erase'
# Dash Query
#
# Usage:
# dq List
# dq scala:Node
# dq javafx:Node
function dq
open dash://$argv
end
# Edit the current command line with $EDITOR
function edit-command
set -q EDITOR; or return 1
set -l tmpfile (mktemp fish-edit-command-temp.XXXXXX); or return 1
commandline > $tmpfile
eval $EDITOR $tmpfile
commandline -r (cat $tmpfile)
rm $tmpfile
end
set -g __fish_git_prompt_show_informative_status 1
set -g __fish_git_prompt_hide_untrackedfiles 1
set -g __fish_git_prompt_color_branch green
set -g __fish_git_prompt_showupstream "informative"
set -g __fish_git_prompt_char_upstream_ahead "↑"
set -g __fish_git_prompt_char_upstream_behind "↓"
set -g __fish_git_prompt_char_upstream_prefix ""
set -g __fish_git_prompt_char_stagedstate "●"
set -g __fish_git_prompt_char_dirtystate "✚"
set -g __fish_git_prompt_char_untrackedfiles "…"
set -g __fish_git_prompt_char_conflictedstate "✖"
set -g __fish_git_prompt_char_cleanstate "✔"
set -g __fish_git_prompt_color_dirtystate blue
set -g __fish_git_prompt_color_stagedstate yellow
set -g __fish_git_prompt_color_invalidstate red
set -g __fish_git_prompt_color_untrackedfiles $fish_color_normal
set -g __fish_git_prompt_color_cleanstate green
function fish_prompt --description 'Write out the prompt'
set -l last_status $status
if not set -q __fish_prompt_normal
set -g __fish_prompt_normal (set_color normal)
end
set_color magenta
echo
printf '%s' (whoami)
printf '@'
printf '%s' (hostname|cut -d . -f 1)
printf ':'
printf '%s' (pwd)
set_color normal
printf '%s ' (__fish_git_prompt)
if not test $last_status -eq 0
set_color $fish_color_error
end
set_color magenta
echo
printf '↪ '
#printf '🐠 '
set_color normal
end
" https://github.com/junegunn/vim-plug ----------------------------
call plug#begin('~/.config/nvim/plugged')
Plug 'airblade/vim-gitgutter'
Plug 'cloudhead/neovim-fuzzy'
Plug 'derekwyatt/vim-scala'
Plug 'elzr/vim-json'
Plug 'fatih/vim-go'
Plug 'inside/vim-search-pulse'
Plug 'larsbs/vimterial'
Plug 'neovimhaskell/haskell-vim'
Plug 'othree/html5.vim'
Plug 'pangloss/vim-javascript'
Plug 'plasticboy/vim-markdown'
Plug 'RRethy/vim-illuminate'
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
Plug 'tpope/vim-fireplace', { 'for': 'clojure' }
Plug 'tpope/vim-fugitive'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
call plug#end()
" --- Customzations -----------------------------------------------
" Configure UI defaults
set hlsearch
set incsearch
set number
set cursorline
set nowrap
set colorcolumn=100
set showmatch
syntax on
filetype on
filetype plugin on
filetype indent on
set background=dark
if (has("termguicolors"))
set termguicolors
endif
colorscheme vimterial
let g:airline_theme='vimterial'
" Configure keymap
nnoremap <C-n> :NERDTreeToggle<CR>
nnoremap <C-p> :FuzzyOpen<CR>
nnoremap <silent> <Esc> :nohlsearch<Bar>:echo<CR>
" Configure plugins
" deoplete
let g:deoplete#enable_at_startup = 1
" vim-illumintate
hi link illuminatedWord Visual
" vim-search-pulse
let g:vim_search_pulse_duration = 200
nnoremap <silent> gd :call LanguageClient_textDocument_definition()<CR>
function useconda
set -x PATH $CONDA_HOME/bin $PATH
end
function usejava
set -x JAVA_HOME (/usr/libexec/java_home -v $argv[1])
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment