Skip to content

Instantly share code, notes, and snippets.

@mattparrilla
Last active May 1, 2023 23:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattparrilla/bb9c3a67205e1790246d58236fa83441 to your computer and use it in GitHub Desktop.
Save mattparrilla/bb9c3a67205e1790246d58236fa83441 to your computer and use it in GitHub Desktop.
My local setup
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
# don't put duplicate lines or lines starting with space in the history.
# See bash(1) for more options
HISTCONTROL=ignoreboth
# append to the history file, don't overwrite it
shopt -s histappend
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
HISTSIZE=1000000
HISTFILESIZE=1000000
# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize
# If set, the pattern "**" used in a pathname expansion context will
# match all files and zero or more directories and subdirectories.
#shopt -s globstar
# make less more friendly for non-text input files, see lesspipe(1)
#[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
debian_chroot=$(cat /etc/debian_chroot)
fi
# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
xterm-color|*-256color) color_prompt=yes;;
esac
# uncomment for a colored prompt, if the terminal has the capability; turned
# off by default to not distract the user: the focus in a terminal window
# should be on the output of commands, not on the prompt
#force_color_prompt=yes
if [ -n "$force_color_prompt" ]; then
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
# We have color support; assume it's compliant with Ecma-48
# (ISO/IEC-6429). (Lack of such support is extremely rare, and such
# a case would tend to support setf rather than setaf.)
color_prompt=yes
else
color_prompt=
fi
fi
if [ "$color_prompt" = yes ]; then
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
else
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi
unset color_prompt force_color_prompt
# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
;;
*)
;;
esac
# enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
alias ls='ls --color=auto'
#alias dir='dir --color=auto'
#alias vdir='vdir --color=auto'
#alias grep='grep --color=auto'
#alias fgrep='fgrep --color=auto'
#alias egrep='egrep --color=auto'
fi
# colored GCC warnings and errors
#export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'
# some more ls aliases
#alias ll='ls -l'
#alias la='ls -A'
#alias l='ls -CF'
# Alias definitions.
# You may want to put all your additions into a separate file like
# ~/.bash_aliases, instead of adding them here directly.
# See /usr/share/doc/bash-doc/examples in the bash-doc package.
if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
fi
# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
if ! shopt -oq posix; then
if [ -f /usr/share/bash-completion/bash_completion ]; then
. /usr/share/bash-completion/bash_completion
elif [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
fi
# Changed by Matt
export SVN_REPO=file:///mnt/gssrepos/repos
export REPO=git@github.com:GreenseaSystems
export SVN_EDITOR=vim
export SVN_VPN_REPO=svn+ssh://mparrilla@vpn.greensealive.com/mnt/gssrepos/repos/
export SVN_MATLAB_REPO=file:///mnt/gssrepos/matlab_repos
export LCM_DEFAULT_URL=udpm://239.255.76.67:4182?ttl=1
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ \[\1\]/'
}
find_svn_revision() {
git log --grep="git-svn-id.*@$1" --pretty=format:"%H"
}
# git branch on command prompt
PS1='\[\033[01;32m\]\u@\h \[\033[01;34m\]\w\[\033[0;37m\]$(parse_git_branch)\[\033[00m\]\$ '
# Yavide alias
# alias yavide="gvim --servername yavide -f -N -u /opt/yavide/.vimrc"
alias gss_ins_validation="~/Downloads/gss_ins_validation/application/run_gss_ins_validaton.sh ~/Downloads/gss_ins_validation/MATLAB_Runtime/v94/"
alias fix_mouse="sudo rmmod psmouse && sudo modprobe psmouse"
alias ramble_freeze="npm run webpack && npm run sass && npm run flask"
alias git_prune_dry_run="git branch -r | awk '{print $1}' | egrep -v -f /dev/fd/0 <(git branch -vv | grep origin) | awk '{print $1}'"
alias git_prune="git branch -r | awk '{print $1}' | egrep -v -f /dev/fd/0 <(git branch -vv | grep origin) | awk '{print $1}' | xargs git branch -d"
# set title of terminal window to current directory
PROMPT_COMMAND='echo -ne "\033]0;${PWD}\007"'
export PATH="$PATH:$HOME/.npm-packages/bin"
alias python=python3
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
PYTHON_INCLUDE_DIR=/usr/bin/python3
. /home/matt/torch/install/bin/torch-activate
export PNPM_HOME="/home/matt/.local/share/pnpm"
export PATH="$PNPM_HOME:$PATH"
export GEM_HOME="/home/matt/.gem/ruby/2.7.0/bin"
export PATH="$GEM_HOME:$PATH"
# The next line updates PATH for the Google Cloud SDK.
if [ -f '/home/matt/google-cloud-sdk/path.bash.inc' ]; then . '/home/matt/google-cloud-sdk/path.bash.inc'; fi
# The next line enables shell command completion for gcloud.
if [ -f '/home/matt/google-cloud-sdk/completion.bash.inc' ]; then . '/home/matt/google-cloud-sdk/completion.bash.inc'; fi
alias update_node_config="npx install-peerdeps --pnpm -D @animavirtuality/config@latest"
alias deploy_sandbox="git push origin staging -f"
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/home/matt/anaconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
eval "$__conda_setup"
else
if [ -f "/home/matt/anaconda3/etc/profile.d/conda.sh" ]; then
. "/home/matt/anaconda3/etc/profile.d/conda.sh"
else
export PATH="/home/matt/anaconda3/bin:$PATH"
fi
fi
unset __conda_setup
# <<< conda initialize <<<
export FLASHBOTS_PK='0x45cecb3df382294bd213f58339fe9538c04236db6d030d5ddea115a868c394f6'
execute pathogen#infect()
" turn off bell
set belloff=all
" turn on filetype plugin for csv-vim to work
:filetype plugin on
" enable helptags for command-t
call pathogen#helptags()
" Enable syntax highlighting.
syntax on
" Auto Indent to same level as previos line
set ai
" Change terminal title to name of open file
set title
set titleold=
" Automatically indent when adding a curly bracket, etc. (extended via autocmd below)
set smartindent
set diffopt+=vertical
" Indent 1 tab after any line that starts with 1 of the cinwords if in .py file
autocmd BufRead *.py set smartindent cinwords=if,elif,else,for,while,try,except,finally,def,class
" Use UTF-8.
set encoding=utf-8
" Tabs should be converted to a group of 2 spaces.
set shiftwidth=2
set tabstop=2
set softtabstop=2
set shiftround
set expandtab
set smarttab
" Spacing for C makefiles
autocmd FileType make setlocal noexpandtab
" Disable automatic comment insertion
autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o
" Search as you type.
set incsearch
" highlight matches
set hlsearch
" turn off search highlight
nnoremap <leader><space> :nohlsearch<CR>
set guitablabel=%N:%M%t " Show tab numbers
" Ignore case when searching.
set ignorecase
" Show autocomplete menus.
set wildmenu
" Sets F5 to toggle NerdTree
map <F5> :NERDTreeToggle<CR>
" Sets F8 to toggle Tagbar
nmap <F8> :TagbarToggle<CR>
" Set font and fontsize for MacVim
" open Ack with Leader-a
map <leader>a :Ack! --ignore-dir=build<Space>
" allows you to copy and paste to outside programs easily
set clipboard=unnamed
" get clipboard working between vim and windows
" https://stackoverflow.com/a/61864749/723998
autocmd TextYankPost * call system('win32yank.exe -i --crlf', @")
function! Paste(mode)
let @" = system('win32yank.exe -o --lf')
return a:mode
endfunction
map <expr> p Paste('p')
map <expr> P Paste('P')
" debounce the copy
autocmd TextYankPost * call YankDebounced()
function! Yank(timer)
call system('win32yank.exe -i --crlf', @")
redraw!
endfunction
let g:yank_debounce_time_ms = 500
let g:yank_debounce_timer_id = -1
function! YankDebounced()
let l:now = localtime()
call timer_stop(g:yank_debounce_timer_id)
let g:yank_debounce_timer_id = timer_start(g:yank_debounce_time_ms, 'Yank')
endfunction
" sort function to a key
map <Leader>s :sort i<CR>
" delete buffer shortcut
map <Leader>d :bdelete<Space>
" sort data_indices.h (greensea specific)
map <Leader>x :'<,'>!sort -u -t= -k1,1
" easier horizontal movement of code blocks
map < <gv
map > >gv
" Show line numbers and length
set number
" show colored column at character 80
set colorcolumn=80
highlight ColorColumn guibg=#073642
" disable backup and swap files
set nobackup
set nowritebackup
set noswapfile
" prevent minibufexplorer from losing undo history
set hid
" enable control + [hjkl] to window movement commands
let g:miniBufExplMapWindowNavVim = 1
" Enter values if ever want to turn off filetypes in syntastic
let g:syntastic_mode_map={'mode': 'active', 'passive_filetypes': ['html']}
" Enable shellcheck for .sh files
let g:syntastic_sh_checkers = ['shellcheck', 'sh']
" Enable yamllint for js files
let g:syntastic_javascript_checkers = ['eslint']
" Enable yamllint for yaml files
let g:syntastic_yaml_checkers = ['yamllint']
""ignore line too long and bad visual indent for too long lines in syntastic
let g:syntastic_python_checkers = ['flake8']
let g:syntastic_python_flake8_args='--ignore=E501,E128,E127,E403,E131,E122,E123'
"tell command-t to search current directory down
let g:CommandTTraverseSCM='pwd'
" tell command-t to ignore certain directories
let g:CommandTWildIgnore=&wildignore . ",bower_components,node_modules,venv,build,*.pyc"
" tell jedi-vim to not show call signatures window. I find it slow and distracting
let g:jedi#show_call_signatures=0
" Per-directory .vimrc files
set exrc
set secure
" Set color scheme
if has("gui_running")
colorscheme solarized
set background=dark
set lines=60
set columns=100
set guioptions-=m "remove menu bar
set guioptions-=T "remove toolbar
set guioptions-=r "remove right hand scroll bar
set guioptions-=L "remove right hand scroll bar
endi
execute pathogen#infect()
" enable helptags for command-t
call pathogen#helptags()
" Enable syntax highlighting.
syntax on
" Auto Indent to same level as previos line
set ai
" Change terminal title to name of open file
set title
" Automatically indent when adding a curly bracket, etc. (extended via autocmd below)
set smartindent
set diffopt+=vertical
" Disable MiniBufExpl in /cvs/nexus/ directory
let g:pathogen_disabled = []
call add(g:pathogen_disabled, 'vim-plugin-minibifexpl')
" Indent 1 tab after any line that starts with 1 of the cinwords if in .py file
autocmd BufRead *.py set smartindent cinwords=if,elif,else,for,while,try,except,finally,def,class
" Open markdown files in Chrome using `/cr`
nnoremap <leader>cr :exec 'silent !open -a "Google Chrome" % &'
" Use UTF-8.
set encoding=utf-8
" Tabs should be converted to a group of 4 spaces.
set shiftwidth=4
set tabstop=4
set softtabstop=4
set shiftround
set expandtab
set smarttab
" Spacing for C makefiles
autocmd FileType make setlocal noexpandtab
" Show whitespace
" Must be inserted before colorscheme command
if has("gui_running")
autocmd ColorScheme * highlight ExtraWhitespace ctermbg=red guibg=#073642
au InsertLeave * match ExtraWhitespace /\s\+$/
endif
" Set color scheme
if has("gui_running")
set background=dark
colorscheme solarized
endif
" Search as you type.
set incsearch
" highlight matches
set hlsearch
" turn off search highlight
nnoremap <leader><space> :nohlsearch<CR>
set guitablabel=%N:%M%t " Show tab numbers
" Ignore case when searching.
set ignorecase
" Show autocomplete menus.
set wildmenu
" Sets F5 to toggle NerdTree
map <F5> :NERDTreeToggle<CR>
" Set default size of window for MacVim
if has("gui_running")
set lines=60
set columns=100
endif
" Set font and fontsize for MacVim
set guifont=Menlo:h14
" Sets ctrl + l, h to switch between tabs
noremap <C-l> gt
noremap <C-h> gT
inoremap # X<BS>#
" jump between syntastic errors
map <F7> :lprev<CR>
map <F9> :lnext<CR>
" open Ack with Leader-a
map <leader>a :Ack!<Space>
" allows you to copy and paste to outside programs easily
set clipboard=unnamed
" sort function to a key
map <Leader>s :sort i<CR>
" delete buffer shortcut
map <Leader>d :bdelete<Space>
" easier horizontal movement of code blocks
map < <gv
map > >gv
" Show line numbers and length
set number
" show colored column at character 80 for pep8 help
if has("gui_running")
set colorcolumn=80
highlight ColorColumn guibg=#073642
endif
" disable backup and swap files
set nobackup
set nowritebackup
set noswapfile
" prevent minibufexplorer from losing undo history
set hid
" enable control + [hjkl] to window movement commands
let g:miniBufExplMapWindowNavVim = 1
" Enter values if ever want to turn off filetypes in syntastic
let g:syntastic_mode_map={'mode': 'active', 'active_filetypes': ['py', 'js', 'scss'],
\ 'passive_filetypes': ['html']}
""ignore line too long and bad visual indent for too long lines in syntastic
let g:syntastic_python_checkers = ['flake8']
let g:syntastic_python_flake8_args='--ignore=E501,E128,E127,E403'
" Use jshint for javascript linting
let g:syntastic_javascript_checkers = ['eslint']
" Use scss-lint for sass linting
let g:syntastic_scss_checkers = ['scss_lint']
"tell command-t to search current directory down
let g:CommandTTraverseSCM='pwd'
" tell command-t to ignore certain directories
let g:CommandTWildIgnore=&wildignore . "**/bower_components/*,**/node_modules/*,**/venv/*,**/build/*"
" Enable SpaceHi highlighting
autocmd BufNewFile,BufReadPost,FilterReadPost,FileReadPost,Syntax * SpaceHi
autocmd Filetype javascript setlocal ts=2 sts=2 sw=2
"SpaceHi highlighting
let g:spacehi_tabcolor="ctermfg=White ctermbg=Red guifg=White guibg=#174652"
let g:spacehi_spacecolor="ctermfg=Black ctermbg=Yellow guifg=Blue guibg=#174652"
let g:spacehi_nbspcolor="ctermfg=White ctermbg=Red guifg=White guibg=#073642"
"Project specific indentation
augroup ProjectSetup
au BufRead,BufEnter ~/git/mansfield-stake/app/* set et sts=2
augroup END
" Per-directory .vimrc files
set exrc
set secure
" Allow JSX in normal JS files
let g:jsx_ext_required = 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment