From 16e496df5ecdb062003d04adba65fa25b4be03f0 Mon Sep 17 00:00:00 2001 From: viktorbarzin Date: Thu, 12 Mar 2020 14:21:14 +0000 Subject: [PATCH] Update to rawhide and fix broken configs --- .bash_aliases | 30 +++++++++++++++++++++++++++++- .tmux.conf | 7 ++++--- .tmux.conf.local | 18 +++++++++++++++++- .vimrc | 12 +++++++----- 4 files changed, 57 insertions(+), 10 deletions(-) diff --git a/.bash_aliases b/.bash_aliases index 40e8a35..e5e8607 100644 --- a/.bash_aliases +++ b/.bash_aliases @@ -14,6 +14,7 @@ alias pmmm='python manage.py makemigrations' # Start vim with system clipboard alias vim="vimx" # don't alias this - make symlink instead alias vi="vim" +alias vimdiff="vim -d" # git aliases alias g='git' @@ -26,6 +27,8 @@ alias gl="git log --graph --abbrev-commit --decorate --format=format:'%C(bold bl alias gd="git diff" alias gb="git branch" alias gpp='git push production master' # push to production for personal website +# pull all remote branches +alias git-pull-branches='git branch -r | grep -v "\->" | while read remote; do git branch --track "${remote#origin/}" "$remote"; done' # useful for daily stand-up git-standup() { AUTHOR=${AUTHOR:="`git config user.name`"} @@ -412,13 +415,15 @@ users={ "44:03:2C:6B:04:5E": "nasko-laptop", "48:01:C5:39:A6:3D": "ioana-phone", "F4:0F:24:2B:FE:14": "ioana-laptop", + "50:EB:71:23:BC:11": "gabi-laptop", + "FE:43:0A:04:03:BA": "gabi-phone", } # print("Connected device: ") for line in sys.argv[1].split("\n"): ip = line.split()[1].replace("(", "").replace(")", "") mac = line.split()[3].upper() if mac in users: - print(f"{users[mac]}") + print(f"{users[mac]}:{ip}") ' "$(arp -a | grep -v incomplete)" } @@ -431,3 +436,26 @@ bindkey '^[0' autosuggest-accept; bindkey '^[9' autosuggest-fetch; # bindkey '^[9' autosuggest-clear; #bindkey '^ ' autosuggest-fetch +alias sp="snapper -c home" + +function snp(){ + # Runs a command wrapped in btrfs snapper pre-post snapshots. + # Usage: $ snp + # e.g.: $ snp dnf install htop + + cmd="$@" + + snapshot_nbr=$(snapper -c home create --type=pre --cleanup-algorithm=number --print-number --description="${cmd}") + # snapshot_nbr=$(sudo snapper create --type=pre --cleanup-algorithm=number --print-number --description="${cmd}") + + eval "$cmd" + + snapshot_nbr=$(snapper -c home create --type=post --cleanup-algorithm=number --print-number --pre-number="$snapshot_nbr") + # snapshot_nbr=$(sudo snapper create --type=post --cleanup-algorithm=number --print-number --pre-number="$snapshot_nbr") +} + +function waitfor() { + while pidof $1 > /dev/null; do sleep 2; done; +} +alias toclip="xclip -selection clipboard" +alias clearsessions="rm -rf ~/.vim/tmp/sessions/*" diff --git a/.tmux.conf b/.tmux.conf index 028024f..98f145a 100644 --- a/.tmux.conf +++ b/.tmux.conf @@ -162,13 +162,14 @@ bind P choose-buffer # choose which buffer to paste from # -- user defined overrides ---------------------------------------------------- -if '[ -f ~/.tmux.conf.local ]' 'source ~/.tmux.conf.local' +# if '[ -f ~/.tmux.conf.local ]' +source ~/.tmux.conf.local # -- 8< ------------------------------------------------------------------------ -run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' -run -b '[ -z "#{session_id}" ] && [ -z "#{version}" ] && tmux set display-time 3000 \; display "This configuration will soon require tmux >= 2.4" \; set -u display-time || true' +# run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' +# run -b '[ -z "#{session_id}" ] && [ -z "#{version}" ] && tmux set display-time 3000 \; display "This configuration will soon require tmux >= 2.4" \; set -u display-time || true' # EOF diff --git a/.tmux.conf.local b/.tmux.conf.local index 92850ca..a90ff6b 100644 --- a/.tmux.conf.local +++ b/.tmux.conf.local @@ -301,7 +301,7 @@ bind M-x send-prefix # move status line to top #set -g status-position top -bind \ split-window -h -c "#{pane_current_path}" # Split panes horizontal +bind \\ split-window -h -c "#{pane_current_path}" # Split panes horizontal # Use Alt-vim keys without prefix key to switch panes bind -n M-h select-pane -L @@ -328,3 +328,19 @@ bind -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel 'xclip -in -selecti bind-key s set-window-option synchronize-panes\; display-message "synchronize-panes is now #{?pane_synchronized,on,off}" set-option -g default-shell /bin/zsh + + +# Custom added - MUST be in the end +# List of plugins +set -g @plugin 'tmux-plugins/tpm' +set -g @plugin 'tmux-plugins/tmux-sensible' + +set -g @plugin 'tmux-plugins/tmux-resurrect' +set -g @resurrect-processes 'vi vim nvim man less more tail top htop' + +set -g @plugin 'tmux-plugins/tmux-continuum' + +set -g @continuum-restore 'on' + +# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf) +run -b '~/.tmux/plugins/tpm/tpm' diff --git a/.vimrc b/.vimrc index badd7bb..ca82f8b 100644 --- a/.vimrc +++ b/.vimrc @@ -1,7 +1,3 @@ -" Source vimrc on vim startup -" autocmd! VimEnter * source ~/.vimrc - -" Load rename plugin " so ~/.vim/Rename.vim " let g:EclimCompletionMethod = 'omnifunc' @@ -332,7 +328,7 @@ noremap - :sp "autocmd VimEnter * wincmd p " Toggle NEDRTree plugin noremap :NERDTreeToggle -let NERDTreeIgnore = ['\.pyc$', '__pycache__'] +let NERDTreeIgnore = ['\.pyc$', '__pycache__', '.mypy_cache', '.pytest_cache'] let NERDTreeShowHidden=1 " Better navigating through omnicomplete option list @@ -467,3 +463,9 @@ endfunction autocmd VimLeave,BufWritePost * call SaveSess() autocmd VimEnter * nested call RestoreSess() + +set updatetime=100 + +" highlight GitGutterDelete guifg=#990000 ctermfg=1 +" highlight GitGutterAdd guifg=#009900 ctermfg=2 +" highlight GitGutterChange guifg=#997c00 ctermfg=3