diff options
| author | Anton Bobov <abobov@gmail.com> | 2020-09-20 17:37:48 +0500 |
|---|---|---|
| committer | Anton Bobov <abobov@gmail.com> | 2020-09-20 17:37:48 +0500 |
| commit | 7494421ec6281de1ee7d327601223537b325a7a1 (patch) | |
| tree | dd8d0da7152caafad34d00a7a54cc159c1ecc417 | |
| parent | 58200984aa4dff48d7925f48e443a00775c0ba07 (diff) | |
Updates.
| -rw-r--r-- | files/.gitconfig | 10 | ||||
| -rw-r--r-- | files/.tmux.conf | 41 | ||||
| -rw-r--r-- | files/.zsh/rc/S50_aliases | 43 |
3 files changed, 58 insertions, 36 deletions
diff --git a/files/.gitconfig b/files/.gitconfig index c26d10a..b2d308a 100644 --- a/files/.gitconfig +++ b/files/.gitconfig @@ -53,6 +53,11 @@ whoami = config user.email fugitive = mergetool --tool fugitive clean-branches = !sh -c 'git branch --merged | grep -v '^*' | fzf -m | xargs -rp git branch -d' + + # Gitlab merge requests helpers + mr = !sh -c 'git fetch $1 merge-requests/$2/head:mr-$1-$2 && git checkout mr-$1-$2' - + mr-clean = "!git for-each-ref refs/heads/mr/* --format='%(refname)' | while read ref ; do branch=${ref#refs/heads/} ; git branch -D $branch ; done" + [advice] statusHints = false detachedHead = false @@ -99,3 +104,8 @@ cmd = vim -c \"Gdiff\" \"$MERGED\" [fetch] prune = true + +# Allow pushing changes when working with a "read-only" remote from GitHub. +[url "git@github.com:"] + pushInsteadOf = https://github.com/ + pushInsteadOf = git://github.com/ diff --git a/files/.tmux.conf b/files/.tmux.conf index 32efa71..ac108c6 100644 --- a/files/.tmux.conf +++ b/files/.tmux.conf @@ -1,3 +1,5 @@ +# Inspired by https://github.com/willnorris/dotfiles/blob/main/tmux.conf + # bind prefix to ^a unbind C-b set -g prefix ` @@ -6,17 +8,20 @@ bind-key ` send-prefix ## make window/pane index start with 1 set -g base-index 1 setw -g pane-base-index 1 +set -g renumber-windows on set -g set-titles on set -g set-titles-string "#W @ #H[#S]" - # disable auto rename of windows -set-option -g allow-rename off +set -g allow-rename off # enable mouse support setw -g mouse on +# watch background windows for activity and highlight status bar +set -g monitor-activity on + ## set vi mode for copy mode #setw -g mode-keys vi #unbind [ @@ -30,30 +35,20 @@ setw -g mouse on ## Key bindings ## +bind Space copy-mode + +# don't pre-fill with window or session original name when renaming +bind '$' command-prompt -p "(rename-session '#S')" "rename-session '%%'" +bind , command-prompt -p "(rename-window '#W')" "rename-window '%%'" + +# Move windows +bind -n P swap-window -t -1\; select-window -t -1 +bind -n N swap-window -t +1\; select-window -t +1 + #bind \ split-window -h -c '#{pane_current_path}' # toggle last 2 windows -bind-key Tab last-window - -## pane movement -#bind h select-pane -L -#bind j select-pane -D -#bind k select-pane -U -#bind l select-pane -R - -## window movement -#bind -r C-h select-window -t :- -#bind -r C-l select-window -t :+ - -## resize pane -#bind -r H resize-pane -L 10 -#bind -r J resize-pane -D 10 -#bind -r K resize-pane -U 10 -#bind -r L resize-pane -R 10 - -# stay in copy mode on drag end -#unbind-key -t vi-copy MouseDragEnd1Pane -#bind-key -t vi-copy MouseUp1Pane cancel +bind Tab last-window # Status bar set -g status-right "$USER@#h %H:%M" diff --git a/files/.zsh/rc/S50_aliases b/files/.zsh/rc/S50_aliases index 4347a3b..a0afc47 100644 --- a/files/.zsh/rc/S50_aliases +++ b/files/.zsh/rc/S50_aliases @@ -1,26 +1,29 @@ +function is_command() { + command -v $1 > /dev/null +} + # Fix aliases alias sudo='sudo ' alias watch='watch ' -# Remove grml aliasses -unalias ag 2>/dev/null - alias ag="ag --page less" alias wcc="wc -c | numfmt --to=si" alias nf="numfmt --from=auto --to=iec" alias da='\du -sch' -if [ -x "$(command -v ncdu)" ]; then +if is_command ncdu; then alias du='ncdu -rr -x --exclude .git' else alias du='du -h' fi -if [ -x "$(command -v prettyping)" ]; then +if is_command prettyping; then alias ping='prettyping --nolegend' fi alias localip="hostname -I | gawk '{print \$1}'" +alias tcp-listen="netstat --tcp --listen --numeric --program 2>/dev/null || netstat -an | grep LISTEN" +is_command ss && alias ports='ss -tulanp' alias df='df -h' alias free='free -tm' @@ -32,7 +35,6 @@ alias egrep='egrep --color=auto' alias fn='find . -name' alias ip='ip -color' alias dmesg='dmesg --human' -alias ports='ss -tulanp' alias ls='ls --color=auto -h -F --group-directories-first' alias d='dirs -v | head -10' @@ -53,6 +55,7 @@ alias bc='bc -lq' alias calc='noglob bc -l <<<' alias make='make -j$(nproc)' +alias nicer='nice -n 15 ionice -c 2 -n 7' alias display_off='xset dpms force off' @@ -62,7 +65,7 @@ alias xcd='cd "$(xclip -o)"' alias man='LANG=C man' -if [ -x "$(command -v aptitude)" ] ; then +if is_command aptitude; then alias upa='sudo aptitude -u' alias apurge='sudo aptitude purge --purge-unused' else @@ -95,7 +98,7 @@ fi alias sc=systemctl alias jf="journalctl --unit" -if [ -x "$(command -v python3)" ] ; then +if is_command python3; then alias httpserver='python3 -m http.server' else alias httpserver='python -m SimpleHTTPServer' @@ -105,7 +108,9 @@ alias pdoc-pdf='pandoc --latex-engine=xelatex -V geometry:margin=1in -V mainfont alias jkill="jps | grep -v ' Jps$' | grep -v ' org.eclipse.equinox.' | cut -d ' ' -f 1 | xargs -r kill" -[ -x "$(command -v pgcli)" ] && alias pgcli="pgcli --pgclirc ~/.config/pgcli/config --pgclirc ~/.config/pgcli/local.config" +is_command pgcli && alias pgcli="pgcli --pgclirc ~/.config/pgcli/config --pgclirc ~/.config/pgcli/local.config" + +is_command lynx && alias urls="lynx -nonumbers -listonly -dump" # # Calendar & tasks @@ -113,7 +118,8 @@ alias jkill="jps | grep -v ' Jps$' | grep -v ' org.eclipse.equinox.' | cut -d ' alias cal='ncal -Mb' alias ta='task add' -if [ -x "$(command -v remind)" ] ; then +alias task-no-spell='TW_IGNORE_SPELL=1 task' +if is_command remind; then alias remind="noglob remind -@ -m -b1" alias rem="noglob rem -@ -m -b1" alias rem1="rem -cu+1" @@ -184,16 +190,25 @@ alias exim-queue-rm='sudo exim -Mrm' alias portcheck='nc -z -v -w 5' alias jq='jq --color-output' +function mvn-or-mvnw() { + if [ -x ./mvnw ]; then + echo "executing mvnw instead of mvn" + ./mvnw "$@" + else + command mvn "$@" + fi +} +alias mvn="mvn-or-mvnw" -if [ -x "$(command -v colordiff)" ] ; then +if is_command colordiff; then alias diff='colordiff -u' else alias diff='diff -u' fi -if [ -x "$(command -v unoconv)" ] ; then +if is_command unoconv; then alias 2pdf='unoconv --format pdf' -elif [ -x "$(command -v libreoffice)" ] ; then +elif is_command libreoffice; then alias 2pdf='libreoffice --headless --convert-to pdf' fi @@ -203,4 +218,6 @@ alias remove-colors='sed -r "s/\x1B\[([0-9]{1,3}(;[0-9]{1,2})?)?[mGK]//g"' #[[ -s /etc/grc.zsh ]] && source /etc/grc.zsh +unfunction is_command + # vim: et ft=zsh : |
