diff options
author | Karel Kočí <cynerd@email.cz> | 2017-10-05 23:37:03 +0200 |
---|---|---|
committer | Karel Kočí <cynerd@email.cz> | 2017-10-05 23:38:36 +0200 |
commit | e79776c14c86e37f89087504f765638f2c20eb96 (patch) | |
tree | 3f8ff371c7ecf8b3f3a0eb509ce269c180476b77 | |
parent | 3bf384e3ee04e3a82cfb65a73b11cce9f0320519 (diff) | |
parent | 2fc8d93ef509f583f6977588c7b3fb2cf8ebd332 (diff) | |
download | myconfigs-e79776c14c86e37f89087504f765638f2c20eb96.tar.gz myconfigs-e79776c14c86e37f89087504f765638f2c20eb96.tar.bz2 myconfigs-e79776c14c86e37f89087504f765638f2c20eb96.zip |
Merge branch 'master' into server
-rw-r--r-- | bashrc | 36 | ||||
-rw-r--r-- | config/htop/htoprc | 26 | ||||
-rwxr-xr-x | install | 1 | ||||
-rwxr-xr-x | local/bin/project-test | 43 | ||||
-rw-r--r-- | shellrc | 2 | ||||
-rw-r--r-- | zshrc | 26 |
6 files changed, 84 insertions, 50 deletions
@@ -10,14 +10,19 @@ if [ -f /etc/bashrc ]; then . /etc/bashrc fi +# Source all completions +if [ -d ~/.bash_completions ]; then + for F in $(find ~/.bash_completions -type f); do + . "$F" + done +fi + +# PROMPT ####################################################### PS1='$( if [ `id -u` -eq "0" ]; then echo -n "\[\e[1;31m\]\u@\h:\[\e[1;34m\]\W\[\e[1;31m\]\$\[\e[0m\] " else - if ls ~/.annoyme/*.pid 2>/dev/null >/dev/null; then - ANNOYME_PS="\[\e[1;31m\]!\[\e[0m\]" - fi - echo -n "$ANNOYME_PS\[\e[1;32m\]\u@\h:\[\e[1;34m\]\W\[\e[1;32m\]\$\[\e[0m\] " + echo -n "\[\e[1;32m\]\u@\h:\[\e[1;34m\]\W\[\e[1;32m\]\$\[\e[0m\] " fi)' PROMPT_COMMAND=' @@ -37,3 +42,26 @@ case "$TERM" in ;; esac +# Completions ################################################## + +_gitbmerge() { + local cur prev + _init_completion || return + [ $COMP_CWORD -gt 1 ] && return # Complete only single dependency + COMPREPLY=() + local GDIR="$(pwd)" + while [ ! -d "$GDIR/.git" ]; do + [ -z "$GDIR" ] && return + GDIR="${GDIR%/*}" + done + GDIR="$GDIR/.git" + [ -f "$GDIR" ] && GDIR="$(cat "$GDIR")" # This just points to some other directory + [ -d "$GDIR/refs/heads" ] || return # No completion if there is no local branch + local ops="" + for B in "$GDIR"/refs/heads/*; do + # TODO skip branch on HEAD + ops="$ops ${B#$GDIR/refs/heads/}" + done + COMPREPLY+=($(compgen -W "${ops}" -- ${cur})) +} +complete -F _gitbmerge gitbmerge diff --git a/config/htop/htoprc b/config/htop/htoprc new file mode 100644 index 0000000..0492e91 --- /dev/null +++ b/config/htop/htoprc @@ -0,0 +1,26 @@ +# Beware! This file is rewritten by htop when settings are changed in the interface. +# The parser is also very primitive, and not human-friendly. +fields=0 48 17 18 38 39 40 2 46 47 49 1 +sort_key=46 +sort_direction=1 +hide_threads=1 +hide_kernel_threads=1 +hide_userland_threads=1 +shadow_other_users=0 +show_thread_names=0 +show_program_path=1 +highlight_base_name=0 +highlight_megabytes=1 +highlight_threads=1 +tree_view=1 +header_margin=1 +detailed_cpu_time=0 +cpu_count_from_zero=0 +update_process_names=0 +account_guest_in_cpu_meter=0 +color_scheme=0 +delay=15 +left_meters=LeftCPUs Memory Swap +left_meter_modes=1 1 1 +right_meters=RightCPUs Tasks LoadAverage Uptime +right_meter_modes=1 2 2 2 @@ -33,6 +33,7 @@ fi if ask "Install configurations for various utility tools"; then inst screenrc ~/.screenrc + inst config/htop/htoprc ~/.config/htop/htoprc fi if ask "Install vim scripts"; then diff --git a/local/bin/project-test b/local/bin/project-test deleted file mode 100755 index a0591d8..0000000 --- a/local/bin/project-test +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/bash -# Executes given command on all commits from current one to given one. -set -e - -print_help() { - echo "Executes given command for each commit. In default it executes" - echo "for 10 previous commands." - echo - echo "Usage: project-test [OPTION...] [--] COMMAND" - echo " -r,--ref [REF]" - echo " Git reference to go to" - echo " -c,--count [COUNT]" - echo " Tests given count of references back from current one." -} - -while [ -n "$1" ]; do - case $1 in - -r|--ref) - shift - REF=$1 - ;; - -c|--count) - shift - REF=HEAD~$1 - ;; - --) - shift - break - ;; - *) - break - ;; - esac - shift -done - -[ -n "$REF" ] || REF=HEAD~10 - -while read -r rev; do - git checkout "$rev" - git submodule update - eval $@ -done < <(git rev-list "$REF"..HEAD) @@ -14,7 +14,7 @@ else eval $(dircolors -b) alias make="make -j$(nproc)" fi -alias ll='ls -l' +alias ll='ls -lh' alias grep='grep --color=auto' alias git='LANG=en_GB git' alias gdb='gdb -q' @@ -10,6 +10,7 @@ zstyle ':completion:*' cache-path ~/.cache/zsh zstyle :compinstall filename '/home/kkoci/.zshrc' zstyle -e ':completion:*:default' list-colors 'reply=("${PREFIX:+=(#bi)($PREFIX:t)(?)*==32=33}:${(s.:.)LS_COLORS}")' zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS} +fpath=(~/.zsh_completions $fpath) autoload -Uz compinit && compinit autoload -Uz colors && colors @@ -65,9 +66,9 @@ lrbell_active_window_id() { lrbell_begin() { lrbell_timestamp=$EPOCHSECONDS - lrbell_message="`pwd`: $1" if [ -n "$DISPLAY" ]; then - lrbell_window_id=$(lrbell_active_window_id) + lrbell_message="`pwd`: $1" + lrbell_window_id="$(lrbell_active_window_id)" fi } lrbell_end() { @@ -85,6 +86,27 @@ lrbell_end() { add-zsh-hook preexec lrbell_begin add-zsh-hook precmd lrbell_end +# Completions ################################################## + +_gitbmerge() { + (( CURRENT > 2)) && return # Complete only single dependency + local GDIR="$(pwd)" + while [ ! -d "$GDIR/.git" ]; do + [ -z "$GDIR" ] && return + GDIR="${GDIR%/*}" + done + GDIR="$GDIR/.git" + [ -f "$GDIR" ] && GDIR="$(cat "$GDIR")" # This just points to some other directory + [ -d "$GDIR/refs/heads" ] || return # No completion if there is no local branch + local branches=() + for B in "$GDIR"/refs/heads/*; do + # TODO skip branch on HEAD + branches+=("${B#$GDIR/refs/heads/}") + done + _describe -t branches 'gitbmerge' branches +} +compdef _gitbmerge gitbmerge + ################################################################ case "$TERM" in xterm*|*rxvt*) |