Skip to content

Instantly share code, notes, and snippets.

@motiejus
Last active March 19, 2018 14:51
Show Gist options
  • Save motiejus/f1437d43869a3057be17a83c008aa8d0 to your computer and use it in GitHub Desktop.
Save motiejus/f1437d43869a3057be17a83c008aa8d0 to your computer and use it in GitHub Desktop.
dotfiles 2018-03-19
arc() {
if [[ -z "$(which node)" ]]; then d; fi
env arc "$@"
}
. $HOME/.gg.sh
export LC_CTYPE=en_US.UTF-8
export LC_ALL=en_US.UTF-8
export PS1='\[\e[0;32m\]\u\[\e[m\] \[\e[1;34m\]\w\[\e[m\] \[\e[1;32m\]\$\[\e[m\] '
export LSCOLORS=ExFxBxDxCxegedabagacad
export CLICOLOR=y
export HISTSIZE=50000
export UNISONLOCALHOSTNAME=motiejus-MBP.lan
export GOTRACEBACK=all
export VAGRANT_DEFAULT_PROVIDER=virtualbox
export GOPATH=$HOME/.gopath
export PATH=$PATH:$GOPATH/bin:$HOME/bin
toolshed() {
docker run --name toolshed -v `pwd`:/x -ti --rm motiejus/toolshed "$@"
}
alias l='echo -n ł | pbcopy'
alias cerberus='cerberus --no-status-page'
alias n='mpc next'
alias p='mpc prev'
alias t='mpc toggle'
#
# Change to the directory of the specified Go package name.
#
gg() {
paths=($(g "$@"))
path_index=0
if [ ${#paths[@]} -gt 1 ]; then
c=1
for path in "${paths[@]}"; do
echo [$c]: cd ${GOPATH}/${path}
c=$((c+1))
done
echo -n "Go to which path: "
read path_index
path_index=$(($path_index-1))
fi
path=${paths[$path_index]}
cd $GOPATH/src/$path
}
#
# Print the directories of the specified Go package name.
#
g() {
local pkg_candidates="$((cd $GOPATH/src && find . -mindepth 1 -maxdepth 4 -type d \( -path "*/$1" -or -path "*/$1.git" \) -print) | sed 's/^\.\///g')"
echo "$pkg_candidates"
}
#
# Bash autocomplete for g and gg functions.
#
_g_complete()
{
COMPREPLY=()
local cur
local prev
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
COMPREPLY=( $(compgen -W "$(for f in $(find "$GOPATH/src" -mindepth 1 -maxdepth 4 -type d -name "${cur}*" ! -name '.*' ! -path '*/.git/*' ! -path '*/test/*' ! -path '*/Godeps/*' ! -path '*/examples/*'); do echo "${f##*/}"; done)" -- "$cur") )
return 0
}
complete -F _g_complete g
complete -F _g_complete gg
motiejus ~ $ for d in ~/.vim/bundle/*; do echo -n "${d##*/} "; git -C $d remote -v | awk '/(fetch)/ { print $2 }'; done | column -t
gotests-vim https://github.com/buoto/gotests-vim.git
vim-fugitive https://github.com/tpope/vim-fugitive.git
vim-go https://github.com/fatih/vim-go.git
vim-sensible https://github.com/tpope/vim-sensible.git
execute pathogen#infect()
Helptags
syntax on
filetype plugin indent on
set et ts=4 sw=4 nu hlsearch ruler ignorecase smartcase modeline bg=dark
set grepprg=rg\ --vimgrep
set grepformat^=%f:%l:%c:%m
set path=**/*
" html
au FileType html set ts=2 sw=2
" puppet
au BufRead,BufNewFile Vagrantfile,*.pp setfiletype ruby
au FileType ruby set ts=2 sw=2 sws=2
" go
au FileType go set noet
au FileType go nnoremap <C-]> :GoDef<CR>
au FileType go nnoremap <C-t> <C-o>
au FileType go set path+=~/.gopath/src/**/*
let g:go_fmt_command = "goimports"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment