diff --git a/alacritty/.config/alacritty/alacritty.yml b/alacritty/.config/alacritty/alacritty.yml index b155208..56a08a4 100644 --- a/alacritty/.config/alacritty/alacritty.yml +++ b/alacritty/.config/alacritty/alacritty.yml @@ -53,7 +53,7 @@ colors: visual_bell: duration: 0 -background_opacity: 1.0 + background_opacity: 1.0 mouse: hide_when_typing: true selection: diff --git a/bash/.bash_profile b/bash/.bash_profile index 07578f8..63e2307 100644 --- a/bash/.bash_profile +++ b/bash/.bash_profile @@ -6,3 +6,6 @@ eval "$(rbenv init -)" export PATH="/usr/local/sbin:$PATH" export PATH="$HOME/.cargo/bin:$PATH" + +export NVM_DIR="$HOME/.nvm" +# [ -s "/usr/local/opt/nvm/nvm.sh" ] && . "/usr/local/opt/nvm/nvm.sh" diff --git a/bash/.bashrc b/bash/.bashrc index 05e3b8e..dcbeafa 100644 --- a/bash/.bashrc +++ b/bash/.bashrc @@ -30,9 +30,9 @@ alias ~='cd ~' alias l='ls' alias ls='ls -G' alias ll='ls -l' -alias v='vim' -alias vi='vim' alias vim='nvim' +alias vi='nvim' +alias v='nvim' alias cat='bat --style plain' alias grep='rg' alias be='bundle exec' @@ -45,16 +45,25 @@ alias gd='git diff' alias gdc='git diff --cached' alias gc='git commit' alias gca='git commit --amend' +alias gcw='git commit -m "wip"' alias gs='git status -sb' alias ga='git add' +alias grm='git rm' alias gup='git up' alias gp='git push' alias gpf='git push -f' +alias gpt='git push origin --tags' alias gb='git branch' +alias gg='git go' alias gl='git lg' alias gr='git reset' +alias gr1='git reset HEAD~1' alias gh='git lg -1' +function gcm () { + git commit -m "$*" +} +alias fs='foreman start' alias ss='spring stop' alias rdc='bin/rails db:create' @@ -63,6 +72,8 @@ alias rdm='bin/rails db:migrate' alias rdr='bin/rails db:rollback' alias rds='bin/rails db:seed' +alias k='kubectl' + alias br='bin/rails' alias rc='bin/rails c' alias rs='bin/rails s -p3001' @@ -82,6 +93,12 @@ fzf_kill() { fi } +unalias z 2> /dev/null +z() { + [ $# -gt 0 ] && _z "$*" && return + cd "$(_z -l 2>&1 | fzf --height 40% --nth 2.. --reverse --inline-info +s --tac --query "${*##-* }" | sed 's/^[0-9,.]* *//')" +} + alias fkill='fzf_kill' # Homebrew stuff @@ -100,3 +117,36 @@ if [ -e ~/.git-prompt.sh ]; then source ~/.git-prompt.sh fi PS1='\W$(__git_ps1 ":%s") ' + +function q() { if [ -z "$1" ]; then return 1; fi; kubectl exec -n $1 -it $(kubectl get pods -n $1 -l product=quoting,app=quoting-rails-webserver -o=custom-columns=NAME:.metadata.name | tail -1) ${@:2}; } +function olb() { if [ -z "$1" ]; then return 1; fi; kubectl exec -n $1 -it $(kubectl get pods -n $1 -l product=online-bind,app=online-bind-rails-webserver -o=custom-columns=NAME:.metadata.name | tail -1) ${@:2}; } +function qstag() { kubectl exec -n staging -it $(kubectl get pods -n staging -l product=quoting,app=quoting-rails-webserver -o=custom-columns=NAME:.metadata.name | tail -1) ${@:2}; } + +function _calcram() { + local sum + sum=0 + for i in `ps aux | grep -i "$1" | grep -v "grep" | awk '{print $6}'`; do + sum=$(($i + $sum)) + done + sum=$(echo "scale=2; $sum / 1024.0" | bc) + echo $sum +} + +# Show how much RAM application uses. +# $ ram safari +# # => safari uses 154.69 MBs of RAM +function ram() { + local sum + local app="$1" + if [ -z "$app" ]; then + echo "First argument - pattern to grep from processes" + return 0 + fi + + sum=$(_calcram $app) + if [[ $sum != "0" ]]; then + echo "${fg[blue]}${app}${reset_color} uses ${fg[green]}${sum}${reset_color} MBs of RAM" + else + echo "No active processes matching pattern '${fg[blue]}${app}${reset_color}'" + fi +} diff --git a/git/.gitconfig b/git/.gitconfig index 5762720..6977114 100644 --- a/git/.gitconfig +++ b/git/.gitconfig @@ -2,11 +2,10 @@ email = madundead@gmail.com name = Konstantin Bukley -[includeIf "gitdir:~/work/"] - path = ~/Development/work/.gitconfig +[includeIf "gitdir:~/Development/work/"] + path = ~/Development/work/.gitconfig [alias] - # View abbreviated SHA, description, and history graph of the latest 20 commits lg = log --pretty=oneline -n 20 --graph --abbrev-commit @@ -25,12 +24,6 @@ # Show the diff of staging area dc = !"git diff --cached" - # git di $number shows the diff between the state $number revisions ago and the current state - di = !"d() { git diff --patch-with-stat HEAD~$1; }; git diff-index --quiet HEAD -- || clear; d" - - # Pull in remote changes for the current repository and all its submodules - p = !"git pull; git submodule foreach git pull origin master" - # Clone a repository including all submodules c = clone --recursive @@ -79,30 +72,13 @@ # List contributors with number of commits contributors = shortlog --summary --numbered - # Merge GitHub pull request on top of the current branch or, - # if a branch name is specified, on top of the specified branch - mpr = "!f() { \ - declare currentBranch=\"$(git symbolic-ref --short HEAD)\"; \ - declare branch=\"${2:-$currentBranch}\"; \ - if [ $(printf \"%s\" \"$1\" | grep '^[0-9]\\+$' > /dev/null; printf $?) -eq 0 ]; then \ - git fetch origin refs/pull/$1/head:pr/$1 && \ - git checkout -B $branch && \ - git rebase $branch pr/$1 && \ - git checkout -B $branch && \ - git merge pr/$1 && \ - git branch -D pr/$1 && \ - git commit --amend -m \"$(git log -1 --pretty=%B)\n\nCloses #$1.\"; \ - fi \ - }; f" up = pull --rebase --autostash [apply] - # Detect whitespace errors when applying a patch whitespace = fix [core] - # Use custom .gitignore and .gitattributes excludesfile = ~/.gitignore_global attributesfile = ~/.gitattributes @@ -126,56 +102,54 @@ pager = diff-so-fancy | less --tabs=4 -RFX [color] - # Use colors in Git commands that are capable of colored output when # outputting to the terminal. (This is the default setting in Git ≥ 1.8.4.) ui = auto [color "branch"] - current = yellow reverse local = yellow remote = green [color "diff"] - - meta = yellow bold - frag = magenta bold # line info - old = red # deletions - new = green # additions + meta = yellow + frag = magenta bold + old = red bold + commit = yellow bold + whitespace = red reverse [color "status"] - added = yellow changed = green untracked = cyan [commit] - # https://help.github.com/articles/signing-commits-using-gpg/ # TODO: setup this gpgsign = false [diff] - # Detect copies as well as renames renames = copies [diff "bin"] - # Use hexdump to diff binary files textconv = hexdump -v -C [merge] - # Include summaries of merged commits in newly created merge commit messages log = true [push] - # https://git-scm.com/docs/git-config#git-config-pushdefault default = current +[branch] + autosetuprebase = always + +[github] + user = "madundead" + [url "git@github.com:"] insteadOf = "gh:" @@ -183,7 +157,6 @@ pushInsteadOf = "git://github.com/" [url "git://github.com/"] - insteadOf = "github:" [url "git@gist.github.com:"] @@ -193,7 +166,6 @@ pushInsteadOf = "git://gist.github.com/" [url "git://gist.github.com/"] - insteadOf = "gist:" [diff-so-fancy] diff --git a/tmux/.tmux.conf b/tmux/.tmux.conf index 8f07719..6eaf320 100644 --- a/tmux/.tmux.conf +++ b/tmux/.tmux.conf @@ -44,13 +44,11 @@ bind Escape copy-mode setw -g mode-keys vi -bind-key Space run-shell "tmux list-sessions -F \"##S\" | fzf-tmux | xargs tmux switch -t" - unbind-key -T copy-mode-vi v bind-key -T copy-mode-vi 'v' send -X begin-selection # Begin selection in copy mode. bind-key -T copy-mode-vi 'C-v' send -X rectangle-toggle # Begin selection in copy mode. -bind-key -T copy-mode-vi 'y' send -X copy-selection # Yank selection in copy mode. +bind-key -T copy-mode-vi 'y' send -X copy-pipe-and-cancel "pbcopy" # Yank selection in copy mode. bind-key -T copy-mode-vi 'K' send -X halfpage-up bind-key -T copy-mode-vi 'J' send -X halfpage-down diff --git a/vim/.vimrc b/vim/.vimrc index 6d17d85..fa05069 100644 --- a/vim/.vimrc +++ b/vim/.vimrc @@ -48,7 +48,7 @@ Plug 'bootleq/vim-textobj-rubysymbol' " ======== Utility ====================================== Plug 'mattn/emmet-vim', -Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' } +Plug 'scrooloose/nerdtree', { 'on': ['NERDTreeToggle', 'NERDTreeFind'] } Plug 'junegunn/vim-easy-align', { 'on': ['(EasyAlign)', 'EasyAlign'] } Plug 'gregsexton/MatchTag', { 'for': 'html' } Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' } @@ -68,7 +68,7 @@ Plug 'w0rp/ale' " ======== Snippets & Autocomplete ====================== -Plug 'SirVer/ultisnips' | Plug 'honza/vim-snippets' +" Plug 'SirVer/ultisnips' | Plug 'honza/vim-snippets' " ======== Appearence =================================== @@ -92,7 +92,9 @@ Plug 'tpope/vim-vinegar' Plug 'iamcco/markdown-preview.nvim', \ { 'do': ':call mkdp#util#install()', 'for': 'markdown', 'on': 'MarkdownPreview' } -Plug 'AndrewRadev/switch.vim' +" Plug 'AndrewRadev/switch.vim' +" Plug 'zxqfl/tabnine-vim' +" Plug 'pechorin/any-jump.vim' call plug#end() @@ -280,12 +282,28 @@ let g:ale_lint_on_text_changed = 'never' let g:ale_lint_on_insert_leave = 0 let g:ale_lint_delay = 0 +let g:ale_linters = { +\ 'typescriptreact': ['tslint'], +\ 'javascript': ['tslint'], +\ 'typescript': ['tslint'], +\} + let g:ale_fixers = { \ 'ruby': ['rubocop'], \} " --- fzf +if has('nvim') || has('gui_running') + let $FZF_DEFAULT_OPTS .= ' --inline-info' +endif + +command! -nargs=? -complete=dir AF + \ call fzf#run(fzf#wrap(fzf#vim#with_preview({ + \ 'source': 'fd --type f --hidden --follow --exclude .git --no-ignore . '.expand() + \ }))) + +let g:fzf_layout = { 'window': { 'width': 0.3, 'height': 0.6, 'border': 'sharp' } } let g:fzf_colors = \ { 'fg': ['fg', 'Normal'], \ 'bg': ['bg', 'Normal'], @@ -598,6 +616,7 @@ nnoremap ,, nnoremap f (expand('%') =~ 'NERD_tree' ? "\\" : '').":Files\" nnoremap b (expand('%') =~ 'NERD_tree' ? "\\" : '').":Buffers\" +nnoremap a :A nnoremap s :Switch nnoremap x :ALEFix nnoremap n :NERDTreeToggle @@ -610,6 +629,7 @@ nnoremap r :TestFile nnoremap R :TestSuite nnoremap J :%!python -m json.tool nnoremap w :w +nnoremap q :q! nnoremap e :e! nnoremap = = nnoremap :nohlsearch