dotfiles: yet another update

This commit is contained in:
Konstantin Bukley
2020-03-26 10:54:09 +02:00
parent e8072101a6
commit 96f652a7d5
6 changed files with 93 additions and 50 deletions

View File

@@ -53,7 +53,7 @@ colors:
visual_bell: visual_bell:
duration: 0 duration: 0
background_opacity: 1.0 background_opacity: 1.0
mouse: mouse:
hide_when_typing: true hide_when_typing: true
selection: selection:

View File

@@ -6,3 +6,6 @@ eval "$(rbenv init -)"
export PATH="/usr/local/sbin:$PATH" export PATH="/usr/local/sbin:$PATH"
export PATH="$HOME/.cargo/bin:$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"

View File

@@ -30,9 +30,9 @@ alias ~='cd ~'
alias l='ls' alias l='ls'
alias ls='ls -G' alias ls='ls -G'
alias ll='ls -l' alias ll='ls -l'
alias v='vim'
alias vi='vim'
alias vim='nvim' alias vim='nvim'
alias vi='nvim'
alias v='nvim'
alias cat='bat --style plain' alias cat='bat --style plain'
alias grep='rg' alias grep='rg'
alias be='bundle exec' alias be='bundle exec'
@@ -45,16 +45,25 @@ alias gd='git diff'
alias gdc='git diff --cached' alias gdc='git diff --cached'
alias gc='git commit' alias gc='git commit'
alias gca='git commit --amend' alias gca='git commit --amend'
alias gcw='git commit -m "wip"'
alias gs='git status -sb' alias gs='git status -sb'
alias ga='git add' alias ga='git add'
alias grm='git rm'
alias gup='git up' alias gup='git up'
alias gp='git push' alias gp='git push'
alias gpf='git push -f' alias gpf='git push -f'
alias gpt='git push origin --tags'
alias gb='git branch' alias gb='git branch'
alias gg='git go'
alias gl='git lg' alias gl='git lg'
alias gr='git reset' alias gr='git reset'
alias gr1='git reset HEAD~1'
alias gh='git lg -1' alias gh='git lg -1'
function gcm () {
git commit -m "$*"
}
alias fs='foreman start'
alias ss='spring stop' alias ss='spring stop'
alias rdc='bin/rails db:create' alias rdc='bin/rails db:create'
@@ -63,6 +72,8 @@ alias rdm='bin/rails db:migrate'
alias rdr='bin/rails db:rollback' alias rdr='bin/rails db:rollback'
alias rds='bin/rails db:seed' alias rds='bin/rails db:seed'
alias k='kubectl'
alias br='bin/rails' alias br='bin/rails'
alias rc='bin/rails c' alias rc='bin/rails c'
alias rs='bin/rails s -p3001' alias rs='bin/rails s -p3001'
@@ -82,6 +93,12 @@ fzf_kill() {
fi 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' alias fkill='fzf_kill'
# Homebrew stuff # Homebrew stuff
@@ -100,3 +117,36 @@ if [ -e ~/.git-prompt.sh ]; then
source ~/.git-prompt.sh source ~/.git-prompt.sh
fi fi
PS1='\W$(__git_ps1 ":%s") ' 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
}

View File

@@ -2,11 +2,10 @@
email = madundead@gmail.com email = madundead@gmail.com
name = Konstantin Bukley name = Konstantin Bukley
[includeIf "gitdir:~/work/"] [includeIf "gitdir:~/Development/work/"]
path = ~/Development/work/.gitconfig path = ~/Development/work/.gitconfig
[alias] [alias]
# View abbreviated SHA, description, and history graph of the latest 20 commits # View abbreviated SHA, description, and history graph of the latest 20 commits
lg = log --pretty=oneline -n 20 --graph --abbrev-commit lg = log --pretty=oneline -n 20 --graph --abbrev-commit
@@ -25,12 +24,6 @@
# Show the diff of staging area # Show the diff of staging area
dc = !"git diff --cached" 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 # Clone a repository including all submodules
c = clone --recursive c = clone --recursive
@@ -79,30 +72,13 @@
# List contributors with number of commits # List contributors with number of commits
contributors = shortlog --summary --numbered 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 up = pull --rebase --autostash
[apply] [apply]
# Detect whitespace errors when applying a patch # Detect whitespace errors when applying a patch
whitespace = fix whitespace = fix
[core] [core]
# Use custom .gitignore and .gitattributes # Use custom .gitignore and .gitattributes
excludesfile = ~/.gitignore_global excludesfile = ~/.gitignore_global
attributesfile = ~/.gitattributes attributesfile = ~/.gitattributes
@@ -126,56 +102,54 @@
pager = diff-so-fancy | less --tabs=4 -RFX pager = diff-so-fancy | less --tabs=4 -RFX
[color] [color]
# Use colors in Git commands that are capable of colored output when # 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.) # outputting to the terminal. (This is the default setting in Git ≥ 1.8.4.)
ui = auto ui = auto
[color "branch"] [color "branch"]
current = yellow reverse current = yellow reverse
local = yellow local = yellow
remote = green remote = green
[color "diff"] [color "diff"]
meta = yellow
meta = yellow bold frag = magenta bold
frag = magenta bold # line info old = red bold
old = red # deletions commit = yellow bold
new = green # additions whitespace = red reverse
[color "status"] [color "status"]
added = yellow added = yellow
changed = green changed = green
untracked = cyan untracked = cyan
[commit] [commit]
# https://help.github.com/articles/signing-commits-using-gpg/ # https://help.github.com/articles/signing-commits-using-gpg/
# TODO: setup this # TODO: setup this
gpgsign = false gpgsign = false
[diff] [diff]
# Detect copies as well as renames # Detect copies as well as renames
renames = copies renames = copies
[diff "bin"] [diff "bin"]
# Use hexdump to diff binary files # Use hexdump to diff binary files
textconv = hexdump -v -C textconv = hexdump -v -C
[merge] [merge]
# Include summaries of merged commits in newly created merge commit messages # Include summaries of merged commits in newly created merge commit messages
log = true log = true
[push] [push]
# https://git-scm.com/docs/git-config#git-config-pushdefault # https://git-scm.com/docs/git-config#git-config-pushdefault
default = current default = current
[branch]
autosetuprebase = always
[github]
user = "madundead"
[url "git@github.com:"] [url "git@github.com:"]
insteadOf = "gh:" insteadOf = "gh:"
@@ -183,7 +157,6 @@
pushInsteadOf = "git://github.com/" pushInsteadOf = "git://github.com/"
[url "git://github.com/"] [url "git://github.com/"]
insteadOf = "github:" insteadOf = "github:"
[url "git@gist.github.com:"] [url "git@gist.github.com:"]
@@ -193,7 +166,6 @@
pushInsteadOf = "git://gist.github.com/" pushInsteadOf = "git://gist.github.com/"
[url "git://gist.github.com/"] [url "git://gist.github.com/"]
insteadOf = "gist:" insteadOf = "gist:"
[diff-so-fancy] [diff-so-fancy]

View File

@@ -44,13 +44,11 @@ bind Escape copy-mode
setw -g mode-keys vi 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 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 '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 '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 'K' send -X halfpage-up
bind-key -T copy-mode-vi 'J' send -X halfpage-down bind-key -T copy-mode-vi 'J' send -X halfpage-down

View File

@@ -48,7 +48,7 @@ Plug 'bootleq/vim-textobj-rubysymbol'
" ======== Utility ====================================== " ======== Utility ======================================
Plug 'mattn/emmet-vim', Plug 'mattn/emmet-vim',
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' } Plug 'scrooloose/nerdtree', { 'on': ['NERDTreeToggle', 'NERDTreeFind'] }
Plug 'junegunn/vim-easy-align', { 'on': ['<Plug>(EasyAlign)', 'EasyAlign'] } Plug 'junegunn/vim-easy-align', { 'on': ['<Plug>(EasyAlign)', 'EasyAlign'] }
Plug 'gregsexton/MatchTag', { 'for': 'html' } Plug 'gregsexton/MatchTag', { 'for': 'html' }
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' } Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
@@ -68,7 +68,7 @@ Plug 'w0rp/ale'
" ======== Snippets & Autocomplete ====================== " ======== Snippets & Autocomplete ======================
Plug 'SirVer/ultisnips' | Plug 'honza/vim-snippets' " Plug 'SirVer/ultisnips' | Plug 'honza/vim-snippets'
" ======== Appearence =================================== " ======== Appearence ===================================
@@ -92,7 +92,9 @@ Plug 'tpope/vim-vinegar'
Plug 'iamcco/markdown-preview.nvim', Plug 'iamcco/markdown-preview.nvim',
\ { 'do': ':call mkdp#util#install()', 'for': 'markdown', 'on': 'MarkdownPreview' } \ { '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() 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_on_insert_leave = 0
let g:ale_lint_delay = 0 let g:ale_lint_delay = 0
let g:ale_linters = {
\ 'typescriptreact': ['tslint'],
\ 'javascript': ['tslint'],
\ 'typescript': ['tslint'],
\}
let g:ale_fixers = { let g:ale_fixers = {
\ 'ruby': ['rubocop'], \ 'ruby': ['rubocop'],
\} \}
" --- fzf " --- 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(<q-args>)
\ })))
let g:fzf_layout = { 'window': { 'width': 0.3, 'height': 0.6, 'border': 'sharp' } }
let g:fzf_colors = let g:fzf_colors =
\ { 'fg': ['fg', 'Normal'], \ { 'fg': ['fg', 'Normal'],
\ 'bg': ['bg', 'Normal'], \ 'bg': ['bg', 'Normal'],
@@ -598,6 +616,7 @@ nnoremap ,, <C-^>
nnoremap <silent> <expr> <leader>f (expand('%') =~ 'NERD_tree' ? "\<C-w>\<C-w>" : '').":Files\<CR>" nnoremap <silent> <expr> <leader>f (expand('%') =~ 'NERD_tree' ? "\<C-w>\<C-w>" : '').":Files\<CR>"
nnoremap <silent> <expr> <leader>b (expand('%') =~ 'NERD_tree' ? "\<C-w>\<C-w>" : '').":Buffers\<CR>" nnoremap <silent> <expr> <leader>b (expand('%') =~ 'NERD_tree' ? "\<C-w>\<C-w>" : '').":Buffers\<CR>"
nnoremap <silent> <leader>a :A<CR>
nnoremap <silent> <leader>s :Switch<CR> nnoremap <silent> <leader>s :Switch<CR>
nnoremap <silent> <leader>x :ALEFix<CR> nnoremap <silent> <leader>x :ALEFix<CR>
nnoremap <silent> <leader>n :NERDTreeToggle<CR> nnoremap <silent> <leader>n :NERDTreeToggle<CR>
@@ -610,6 +629,7 @@ nnoremap <silent> <leader>r :TestFile<CR>
nnoremap <silent> <leader>R :TestSuite<CR> nnoremap <silent> <leader>R :TestSuite<CR>
nnoremap <silent> <leader>J :%!python -m json.tool<CR> nnoremap <silent> <leader>J :%!python -m json.tool<CR>
nnoremap <silent> <leader>w :w<CR> nnoremap <silent> <leader>w :w<CR>
nnoremap <silent> <leader>q :q!<CR>
nnoremap <silent> <leader>e :e!<CR> nnoremap <silent> <leader>e :e!<CR>
nnoremap <silent> <leader>= <C-w>= nnoremap <silent> <leader>= <C-w>=
nnoremap <silent> <leader><space> :nohlsearch<CR> nnoremap <silent> <leader><space> :nohlsearch<CR>