From 26841aacc49365a331dc06c688d97e52a9bea7de Mon Sep 17 00:00:00 2001 From: aranair Date: Fri, 8 Nov 2019 10:11:01 -0500 Subject: [PATCH] Dotfiles update --- .zshrc | 115 ++++++++++++++++++++++++++++++++++++++++++ fresh-setup.sh | 5 +- tmux.conf | 21 +++++--- tmuxinator.yml | 51 +++++++++++++++++++ tmuxinator.yml.sample | 22 ++++---- vimrc | 75 +++++++++++++++------------ 6 files changed, 238 insertions(+), 51 deletions(-) create mode 100644 .zshrc create mode 100644 tmuxinator.yml diff --git a/.zshrc b/.zshrc new file mode 100644 index 0000000..ecb54fd --- /dev/null +++ b/.zshrc @@ -0,0 +1,115 @@ +ZSH=$HOME/.oh-my-zsh +ZSH_THEME="robbyrussell" +source $ZSH/oh-my-zsh.sh +source ~/.bin/tmuxinator.zsh +# autoload -U promptinit; promptinit +# prompt pure + +# eval $(docker-machine env) +source /usr/local/share/zsh/site-functions/_aws +# source /Users/homan/Projects/tulip/scripts/setPaths.source.sh +prompt_context () { } + +# Azure +alias kz="KUBECONFIG=~/.kube/config-azure kubectl" +alias kzs="KUBECONFIG=~/.kube/config-azure kubectl -n kube-system" +alias k3="KUBECONFIG=~/Projects/k3s/kubeconfig.yaml kubectl" + +# Python +if command -v pyenv 1>/dev/null 2>&1; then + eval "$(pyenv init -)" +fi + +alias k="kubectl" +alias ks="kubectl -n kube-system" +alias gl="git pull" +alias gs="git status" +alias gb="git branch" +alias gc="git checkout" +alias gcb="git checkout -b" +alias gcm="git commit -m" +alias gpo="git push origin" +alias gpof="git push origin --force-with-lease" +alias gph="git push heroku" +alias grh="git reset HEAD" +alias stree='open -a SourceTree .' +alias be="bundle exec" +alias syn='git branch --merged | grep -v "\*" | grep -v master | grep -v development | xargs -n 1 git branch -d' +alias tl="cd ~/Projects/tulip" +alias tlf="cd ~/Projects/tulip/environments/cloud/Central/factory" +alias tlt="cd ~/Projects/tulip/environments/cloud/telekube" +alias tlm="cd ~/Projects/tulip/environments/cloud/services/src/tulip/migrations" +alias tlh="cd ~/Projects/tulip/environments/cloud/kubernetes/helm" +alias tlw="cd ~/Projects/tulip/environments/cloud/services/src/tulip/tulipweb/" +alias send-onprem="scp *.tar tulip@172.16.55.3:" + +# Bat / Fzf +alias b="bat" +alias ff="fzf --preview 'bat --color \"always\" {}'" +export FZF_DEFAULT_OPTS="--bind='ctrl-o:execute(vim {})+abort'" +function fh() { + print -z $( ([ -n "$ZSH_NAME" ] && fc -l 1 || history) | fzf +s --tac | sed 's/ *[0-9]* *//') +} + +# tmux alias +alias tmux="TERM=screen-256color-bce tmux" +alias ta="tmux a -t" +alias tn="tmux new -s" + +export EDITOR='vim' +export LANG=en_US.UTF-8 +export LC_ALL=en_US.UTF-8 + +# GO +export GOPATH="$HOME/go" +export GOBIN="$GOPATH/bin" +export PATH="$PATH:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:$GOBIN" + +# Elixir +export PATH="$PATH:/path/to/elixir/bin" + +# Ruby +export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting + +export NOTES_DIRECTORY="/Users/homan/Dropbox/notes" + +# Opens the github page for the current git repository in your browser +function gh() { + giturl=$(git config --get remote.origin.url) + giturl=${giturl/git\@github\.com\:/https://github.com/} + giturl=${giturl/\.git/\/tree/} + # branch="$(git symbolic-ref HEAD 2>/dev/null)" || + branch="$(git rev-parse --abbrev-ref HEAD)" || + branch="(unnamed branch)" # detached HEAD + branch=${branch##refs/heads/} + giturl=$giturl$branch + open $giturl +} + +# Opens the github page for current git repo and compares it -> for a new PR. +function newpr() { + giturl=$(git config --get remote.origin.url) + giturl=${giturl/git\@github\.com\:/https://github.com/} + giturl=${giturl/\.git/\/compare/} + branch="$(git rev-parse --abbrev-ref HEAD)" || + branch="(unnamed branch)" # detached HEAD + branch=${branch##refs/heads/} + giturl=$giturl$branch + open $giturl +} +# ssh +# export SSH_KEY_PATH="~/.ssh/dsa_id" +export PATH="/usr/local/opt/openssl/bin:$PATH" +. "/Users/homan/.acme.sh/acme.sh.env" + +ssh-add -K ~/.ssh/id_rsa +export PATH="/usr/local/opt/mongodb@3.6/bin:$PATH" + +# FZF +export FZF_DEFAULT_COMMAND=' + (git ls-tree -r --name-only HEAD || + find . -path "*/\.*" -prune -o -type f -print -o -type l -print | + sed s/^..//) 2> /dev/null' + +autoload -U +X bashcompinit && bashcompinit +complete -o nospace -C /usr/local/bin/mc mc diff --git a/fresh-setup.sh b/fresh-setup.sh index 5c879c1..8448b27 100644 --- a/fresh-setup.sh +++ b/fresh-setup.sh @@ -19,6 +19,9 @@ brew install zsh brew install tmux brew install tmuxinator brew install reattach-to-user-namespace +brew install bat + +# npm install -g tldr # Oh-my-zsh sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" @@ -48,7 +51,7 @@ cp ~/dotfiles/Monokai.vim ~/.vim/colors/ # GIT echo -e "\n\n\n" ssh-keygen -t rsa -b 4096 -C "boa.homan@gmail.com" -# ssh-keygen -t rsa -b 4096 -C "comment" -P "examplePassphrase" -f "desired pathAndName" -q +# ssh-keygen -t rsa -b 4096 -C "comment" -P "examplePassphrase" -f "desired pathAndName" -q eval "$(ssh-agent -s)" ssh-add ~/.ssh/id_rsa diff --git a/tmux.conf b/tmux.conf index 0b17e4e..b3aabe3 100644 --- a/tmux.conf +++ b/tmux.conf @@ -18,6 +18,9 @@ set -g prefix C-Space bind Space send-prefix # set -g prefix C-a +# Use m to toggle mouse mode +# unbind m +# bind m setw mouse # a mouse # set -g mode-mouse on # setw -g mouse-select-window on @@ -65,12 +68,15 @@ bind y run "tmux save-buffer - | reattach-to-user-namespace pbcopy" # set some pretty colors # ---------------------- # set pane colors - highlight the active pane -set-option -g pane-border-fg colour15 #base02 -set-option -g pane-active-border-fg colour12 #base01 +# set-option -g pane-border-fg colour15 #base02 +# set-option -g pane-active-border-fg colour12 #base01 +set -g pane-border-style fg=colour15 +set -g pane-active-border-style fg=colour12 # colorize messages in the command line -set-option -g message-bg black #base02 -set-option -g message-fg brightred #orange +# set-option -g message-bg black +# set-option -g message-fg brightred +set -g message-style fg=brightred,bg=black # ---------------------- # Status Bar @@ -84,15 +90,16 @@ setw -g monitor-activity off set -g visual-activity off # set color for status bar -set-option -g status-bg default #base02 +set-option -g status-bg default set-option -g status-fg colour5 -set-option -g status-attr dim +# set-option -g status-attr dim +set -g status-style default # show session name, window & pane number, # date and time on right side of status bar set -g status-right-length 50 set -g status-left "#[fg=colour39]#S" -set -g status-right "#[fg=colour39]%d %b %Y :: %l:%M %p " +set -g status-right "#[fg=colour39]%a, %d %b %Y, #(date -u '+%%H:%%M') (%H:%M %Z)" set -g window-status-format "#[fg=white,bg=default] #I #W " set -g window-status-current-format "#[fg=colour17,bg=colour39,noreverse] #I #W " diff --git a/tmuxinator.yml b/tmuxinator.yml new file mode 100644 index 0000000..2d4e03e --- /dev/null +++ b/tmuxinator.yml @@ -0,0 +1,51 @@ +# ~/.tmuxinator/backend.yml + +name: factory +root: ~/Projects/tulip + +# Optional tmux socket +# socket_name: foo + +# Runs before everything. Use it to start daemons etc. +# pre: sudo /etc/rc.d/mysqld start + +# Runs in each window and pane before window/pane specific commands. Useful for setting up interpreter versions. +# pre_window: rbenv shell 2.0.0-p247 + +# Pass command line options to tmux. Useful for specifying a different tmux.conf. +# tmux_options: -f ~/.tmux.mac.conf + +# Change the command to call tmux. This can be used by derivatives/wrappers like byobu. +# tmux_command: byobu + +# Specifies (by name or index) which window will be selected on project startup. If not set, the first window is used. +# startup_window: logs + +# Controls whether the tmux session should be attached to automatically. Defaults to true. +# attach: false + +# Runs after everything. Use it to attach to tmux with custom options etc. +# post: tmux -CC attach -t backend + +windows: + - vim: + layout: even-horizontal + panes: + - vim + - cd ~/Projects/tulip + - server: + layout: main-vertical + panes: + - cd ~/Projects/tulip + - prod: + layout: main-vertical + panes: + - mulch t + - staging: + layout: main-vertical + panes: + - mulch --staging t + - proxy: + layout: main-vertical + panes: + - mulch prom-ui diff --git a/tmuxinator.yml.sample b/tmuxinator.yml.sample index 0394dc7..2d4e03e 100644 --- a/tmuxinator.yml.sample +++ b/tmuxinator.yml.sample @@ -1,7 +1,7 @@ # ~/.tmuxinator/backend.yml -name: backend -root: ~/Projects/HB-Backend +name: factory +root: ~/Projects/tulip # Optional tmux socket # socket_name: foo @@ -32,20 +32,20 @@ windows: layout: even-horizontal panes: - vim - - bundle exec rails s - - dev: + - cd ~/Projects/tulip + - server: layout: main-vertical panes: - - bundle exec rails console - - staging: + - cd ~/Projects/tulip + - prod: layout: main-vertical panes: - - cd ~/Projects/HB-Backend - - prod: + - mulch t + - staging: layout: main-vertical panes: - - cd ~/Projects/HB-Backend - - zeus: + - mulch --staging t + - proxy: layout: main-vertical panes: - - zeus start + - mulch prom-ui diff --git a/vimrc b/vimrc index b8c0a99..3b56ff5 100644 --- a/vimrc +++ b/vimrc @@ -8,7 +8,6 @@ Plugin 'tpope/vim-rhubarb' Plugin 'tpope/vim-commentary' Plugin 'tpope/vim-surround' Plugin 'tpope/vim-repeat' -" Plugin 'tpope/vim-rails' Plugin 'tpope/vim-endwise' " Plugin 'tpope/vim-dispatch' Plugin 'skywind3000/asyncrun.vim' @@ -17,21 +16,19 @@ Plugin 'Raimondi/delimitMate' " Plugin 'docunext/closetag.vim' Plugin 'ervandew/supertab' Plugin 'scrooloose/nerdtree' -" Plugin 'mileszs/ack.vim' Plugin 'altercation/vim-colors-solarized' Plugin 'L9' Plugin 'rking/ag.vim' Bundle 'flazz/vim-colorschemes' Bundle 'bling/vim-airline' -" Bundle 'derekwyatt/vim-scala' " Plugin 'tpope/vim-rsi' " Plugin 'editorconfig/editorconfig-vim' Plugin 'fatih/vim-go' -Plugin 'junegunn/goyo.vim' +" Plugin 'junegunn/goyo.vim' " Plugin 'vim-syntastic/syntastic' " Plugin 'easymotion/vim-easymotion' Plugin 'vim-scripts/SearchComplete' -Plugin 'SirVer/ultisnips' +" Plugin 'SirVer/ultisnips' " Plugin 'garbas/vim-snipmate' " Plugin 'honza/vim-snippets' " Plugin 'kchmck/vim-coffee-script' @@ -39,15 +36,16 @@ Plugin 'SirVer/ultisnips' " Plugin 'janko-m/vim-test' " Plugin 'terryma/vim-smooth-scroll' " Plugin 'tpope/vim-markdown' -Plugin 'flowtype/vim-flow' +" Plugin 'flowtype/vim-flow' Plugin 'Xuyuanp/nerdtree-git-plugin' -Plugin 'pangloss/vim-javascript' -Plugin 'mxw/vim-jsx' Plugin 'junegunn/fzf.vim' -Plugin 'wakatime/vim-wakatime' -Plugin 'w0rp/ale' +" Plugin 'wakatime/vim-wakatime' +" Plugin 'w0rp/ale' +" Plugin 'pangloss/vim-javascript' +" Plugin 'mxw/vim-jsx' Plugin 'airblade/vim-gitgutter' -Plugin 'majutsushi/tagbar' +Plugin 'HerringtonDarkholme/yats' +" Plugin 'majutsushi/tagbar' " Plugin 'vim-scripts/indentpython.vim' " Plugin 'nvie/vim-flake8' -- python " Plugin 'tpope/vim-fireplace' @@ -57,9 +55,12 @@ Plugin 'majutsushi/tagbar' call vundle#end() " required filetype plugin indent on " required syntax enable -" Put your non-Plugin stuff after this line -" + +colorscheme northland +" colorscheme Monokai + let mapleader = "\" + set autoindent set background=dark set number @@ -76,7 +77,7 @@ set ruler " Always show info along bottom." set laststatus=2 " last window always has a statusline" set smarttab " use tabs at the start of a line, spaces elsewhere" set smartindent -set colorcolumn=100 +" set colorcolumn=100 set statusline+=%F set statusline+=%#warningmsg# set statusline+=%{SyntasticStatuslineFlag()} @@ -119,7 +120,7 @@ let g:javascript_conceal_super = "Ω" let g:javascript_conceal_arrow_function = "⇒" " Eslint -" let g:syntastic_javascript_jslint_args = "--white --nomen --regexp --browser --devel --windows --sloppy --vars" +let g:syntastic_javascript_jslint_args = "--white --nomen --regexp --browser --devel --windows --sloppy --vars" let g:syntastic_javascript_jslint_args = "--rulesdir /Users/homan/Projects/tulip/tools/eslint-rules/lib/rules/" let g:syntastic_always_populate_loc_list = 1 let g:syntastic_auto_loc_list = 1 @@ -129,20 +130,24 @@ let g:syntastic_javascript_checkers = ['eslint', 'flow'] let g:syntastic_javascript_flow_exe = 'flow' let g:syntastic_javascript_eslint_exe = '$(npm bin)/eslint --rulesdir /Users/homan/Projects/tulip/tools/eslint-rules/lib/rules' - let g:flow#showquickfix = 1 let g:flow#timeout = 4 -let g:flow#enable = 0 +let g:flow#enable = 1 + +let g:go_autodetect_gopath = 1 let g:ale_echo_msg_error_str = 'E' let g:ale_echo_msg_warning_str = 'W' let g:ale_echo_msg_format = '[%linter%] %s [%severity%]' +highlight clear ALEErrorSign +highlight clear ALEWarningSign let g:ale_javascript_flow_executable = "$(npm bin)/flow" let g:ale_javascript_eslint_executable = "$(npm bin)/eslint" -let g:ale_javascript_eslint_options = "--rulesdir /Users/homan/Projects/tulip/tools/eslint-rules/lib/rules" -let g:ale_sign_column_always = 0 -let g:ale_lint_on_enter = 0 -let g:ale_linters = { 'javascript': ['eslint', 'flow'] } +let g:ale_javascript_eslint_options = "--rulesdir /Users/homan/Projects/tulip/tools/eslint-rules/lib/rules --ignore-path /Users/homan/Projects/tulip/environments/.eslintignore" +let g:ale_sign_column_always = 1 +let g:ale_lint_on_enter = 1 +let g:ale_set_quickfix = 0 +let g:ale_linters = { 'javascript': ['eslint', 'flow'], 'go': ['gometalinter'] } "Use locally installed flow let local_flow = finddir('node_modules', '.;') . '/.bin/flow' @@ -160,6 +165,9 @@ let g:solarized_bold = "1" let g:airline_powerline_fonts = 1 let g:markdown_fenced_languages = ['html', 'python', 'bash=sh', 'ruby'] +" vim-go +let g:go_metalinter_enabled = ['vet', 'golint', 'deadcode', 'errcheck'] + " Tagbar nmap :TagbarToggle @@ -211,7 +219,8 @@ map t :tabnew let NERDTreeShowHidden=1 let NERDTreeMinimalUI = 1 let NERDTreeDirArrows = 1 -let g:NERDTreeWinSize=60 +let g:NERDTreeWinSize=40 +:let g:NERDTreeIgnore=['\~$', 'vendor', '.bundle'] " Writes nnoremap w :w @@ -257,9 +266,8 @@ set backupdir=~/.vim/backup/ " Where backups will go. set directory=~/.vim/swp/ " Where temporary files will go. " vim-gitgutter -set updatetime=100 - -colorscheme Monokai +set updatetime=300 +set signcolumn=yes " Custom Prompt function MyTabLine() @@ -295,17 +303,17 @@ endif " Cursor Column nnoremap W :%s/\s\+$//:let @/='' -" set cursorline +set cursorline nnoremap c :set cursorcolumn! hi TabLineFill term=NONE cterm=NONE ctermbg=233 hi TabLineSel term=NONE cterm=NONE ctermbg=240 hi TabLine term=NONE cterm=NONE ctermbg=233 -hi CursorLine cterm=NONE ctermbg=NONE -" hi CursorLine cterm=NONE ctermbg=237 +" hi CursorLine cterm=NONE ctermbg=NONE +hi CursorLine cterm=NONE ctermbg=234 hi CursorColumn cterm=NONE ctermbg=237 -" GOYO" +" GOYO function! s:goyo_enter() set number endfunction @@ -329,7 +337,7 @@ nnoremap z :Goyo let g:goyo_width = 200 let g:goyo_height = 100 -" ------------------- Strip White space --------------------- " +" Strip White space function! StripTrailingWhitespaces() " Don't strip on these filetypes if &ft =~ 'vim\|perl' @@ -343,6 +351,7 @@ endfun autocmd BufWritePre * :call StripTrailingWhitespaces() autocmd BufNewFile,BufReadPost *.markdown set filetype=markdown +" Folding function! NeatFoldText() let line = ' ' . substitute(getline(v:foldstart), '^\s*"\?\s*\|\s*"\?\s*{{' . '{\d*\s*', '', 'g') . ' ' let lines_count = v:foldend - v:foldstart + 1 @@ -353,10 +362,12 @@ function! NeatFoldText() let foldtextlength = strlen(substitute(foldtextstart . foldtextend, '.', 'x', 'g')) + &foldcolumn return foldtextstart . repeat(foldchar, winwidth(0)-foldtextlength) . foldtextend endfunction - set foldtext=NeatFoldText() +set foldcolumn=2 +" Colorscheme overrides +hi Normal ctermfg=231 ctermbg=233 cterm=NONE guifg=#f8f8f2 guibg=#272822 gui=NONE hi LineNr ctermbg=bg -set foldcolumn=2 hi foldcolumn ctermbg=bg hi VertSplit ctermbg=bg ctermfg=bg +hi SignColumn ctermbg=bg