Reduce PS1 to a single line

This commit is contained in:
Observer of Time 2019-06-19 21:43:45 +03:00
parent 071189983e
commit 015a7ec110
Signed by: chronobserver
GPG Key ID: 8A2DEA1DBAEBCA9E
7 changed files with 47 additions and 54 deletions

View File

@ -1,7 +1,7 @@
# shellcheck disable=SC2183,SC2155
# Print date on login
printf '\e[1m\e[91m%(%A, %B%e, %Y)T \e[90m- \e[36m%(%Z %z)T\e[m\n\n'
printf '\e[1m\e[91m%(%A, %B %e, %Y)T \e[90m- \e[36m%(%Z %z)T\e[m\n\n'
# Ctrl + Space to expand command
bind '\C-Space':magic-space
@ -20,6 +20,9 @@ test -f ~/.local/tokens/github && export GITHUB_TOKEN="$(<"$_")"
test -f ~/.local/tokens/gitlab && export GITLAB_TOKEN="$(<"$_")"
# }}}
# Make pipenv use .venv
export PIPENV_VENV_IN_PROJECT=1
# Set the default command used by fzf
export FZF_DEFAULT_COMMAND='rg --files --hidden --follow --no-ignore'

28
.bashrc
View File

@ -7,27 +7,9 @@
# Define where cd looks for targets
[ -d ~/Documents/Code/GitHub ] && CDPATH='.:~/Documents/Code/GitHub'
__exit_code() {
declare -i ECODE=$?
if [[ $ECODE -ne 0 ]]; then
printf '[\033[m\033[38;5;196m%s\033[0m]──' $ECODE
fi
}
__parse_git() {
declare BRANCH
BRANCH="$(git symbolic-ref HEAD 2>/dev/null)"
if [ -n "$BRANCH" ]; then
if git status 2>/dev/null | grep -q 'nothing to commit'; then
printf ' (%s)' "${BRANCH#refs/heads/}"
else
printf ' {%s}' "${BRANCH#refs/heads/}"
fi
fi
}
# Set the primary prompt string # shellcheck disable=SC1117
PS1="┌──[\[\e[m\]\[\033[38;5;12m\]\t\[\e[m\]\[\e[m\]]──\$(__exit_code)[\[\e[m\]\[\033[38;5;166m\]\u\[\e[m\]\[\e[m\]:\[\e[m\]\[\033[38;5;168m\]\w\[\e[m\]\[\e[m\]\[\033[38;5;150m\]\$(__parse_git)\[\e[m\]]\n└─➤ $ \[\e[m\]"
# Set the primary prompt string
# shellcheck disable=SC2154
PS1='┌──[\[\e[m\]\[\033[38;5;12m\]\t\[\e[m\]\[\e[m\]]──$(test 0 -eq $? || printf "[\033[m\033[38;5;196m$_\033[0m]──")[\[\e[m\]\[\033[38;5;166m\]\u\[\e[m\]\[\e[m\]:\[\e[m\]\[\033[38;5;168m\]\w\[\e[m\]\[\e[m\]\[\033[38;5;150m\]$(b="$(git branch --show-current 2>/dev/null)" && (git diff --quiet && printf " ($b)" || printf " {$b}"))\[\e[m\]]\n└─➤ \$ \[\e[m\]'
# Don't record some commands
HISTIGNORE='&:[ ]*:exit:ls:cd:history:clear'
@ -35,14 +17,14 @@ HISTIGNORE='&:[ ]*:exit:ls:cd:history:clear'
# Remove old duplicate commands
HISTCONTROL='erasedups'
# Get the history file away from $HOME
# Move the history file away from $HOME
HISTFILE="$HOME/.cache/.bash_history"
# Print time of command in history
HISTTIMEFORMAT='{%Y-%m-%d %T} '
# Automatically trim long paths in the prompt
PROMPT_DIRTRIM=3
PROMPT_DIRTRIM=2
# Don't complete files with the following extensions
FIGNORE='~:.o:.swp:.pyc'

View File

@ -1,3 +1,5 @@
t cycle video-unscaled
k add sub-scale -0.1
K add sub-scale +0.1
WHEEL_UP add volume 5

View File

@ -84,10 +84,16 @@ screen=1
# Subtitles {{{
# Load all subs in the current and sub-file-paths directories.
sub-auto=all
# Specify extra directories to search for subtitles.
sub-file-paths=Subs
# Specify the position of subtitles on the screen.
sub-pos=95
# }}}
# vim:ft=cfg:fdm=marker:fdl=0:
# vim:ft=cfg:fdm=marker:fdl=1:

View File

@ -8,7 +8,8 @@ c.content.headers.accept_language = 'en_GB,en'
c.content.headers.user_agent = ' '.join([
'Mozilla/5.0',
'(X11; Linux x86_64)',
'QtWebEngine/5.12.3',
'QtWebEngine/5.12.4',
'Chromium/69.0.3497.128',
'qutebrowser/1.6.2'
])

View File

@ -75,6 +75,12 @@
ls = log --date=short --graph --pretty=log-color --decorate
ll = log --date=short --graph --pretty=log-color --decorate --numstat
amend = commit --amend -uno -a
wdiff = diff --word-diff
cdiff = diff --word-diff-regex=. --color-words
conflicts = diff --name-only --diff-filter=U
shallow = clone --single-branch --depth=1
lab = !git clone git@gitlab.com:"$1" "${@:2}" "#"
aur = !git clone aur@aur.archlinux.org:"$1" "${@:2}" "#"
repush = !git commit --amend -a --no-edit && git push --force
fork-sync = "!( \
git fetch --verbose upstream && git checkout --progress master && \
@ -82,43 +88,36 @@
force-pull = "!git fetch -a && git reset --hard ${2:-origin}/${1:-master}"
create-lab = "!( \
if [ -z \"$GITLAB_TOKEN\" ]; then \
if [ -f \"$HOME/.local/tokens/gitlab\" ]; then \
GITHUB_TOKEN=\"$(< \"$HOME/.local/tokens/gitlab\" )\"; \
else \
printf \"%s%s%s\\n\" \"export GITLAB_TOKEN\" \
\"or save it in \\$HOME/.local/tokens/gitlab\" \
\"to use this command\" >2; \
fi; \
if [ -f \"$HOME/.local/tokens/gitlab\" ]; then \
GITHUB_TOKEN=\"$(< \"$HOME/.local/tokens/gitlab\" )\"; \
else \
printf \"%s%s%s\\n\" \"export GITLAB_TOKEN\" \
\"or save it in \\$HOME/.local/tokens/gitlab\" \
\"to use this command\" >2; \
fi; \
fi; \
curl -H \"Content-Type: application/json\" \
-H \"Private-Token: $GITLAB_TOKEN\" \
-sSX POST https://gitlab.com/api/v4/projects \
-d \"{\\\"name\\\": \\\"${1:?}\\\"}\"; \
printf '\n' )"
-H \"Private-Token: $GITLAB_TOKEN\" \
-sSX POST https://gitlab.com/api/v4/projects \
-d \"{\\\"name\\\": \\\"${1:?}\\\"}\"; printf '\n' )"
rename = "!( \
if [ -z \"$GITHUB_TOKEN\" ]; then \
if [ -f \"$HOME/.local/tokens/github\" ]; then \
GITHUB_TOKEN=\"$(< \"$HOME/.local/tokens/github\" )\"; \
else \
printf \"%s%s%s\\n\" \"export GITHUB_TOKEN\" \
\"or save it in \\$HOME/.local/tokens/github\" \
\"to use this command\" >2; \
fi; \
if [ -f \"$HOME/.local/tokens/github\" ]; then \
GITHUB_TOKEN=\"$(< \"$HOME/.local/tokens/github\" )\"; \
else \
printf \"%s%s%s\\n\" \"export GITHUB_TOKEN\" \
\"or save it in \\$HOME/.local/tokens/github\" \
\"to use this command\" >2; \
fi; \
fi; \
user=\"$(git config --get user.name)\"; \
root=\"$(basename \"$(git rev-parse --show-toplevel)\")\"; \
curl -H \"Content-Type: application/json\" \
-H \"Authorization: Token $GITHUB_TOKEN\" \
-sSX PATCH \"https://api.github.com/repos/$user/${2:-$root}\" \
-d \"{\\\"name\\\": \\\"${1:?}\\\"}\"; \
-H \"Authorization: Token $GITHUB_TOKEN\" \
-sSX PATCH \"https://api.github.com/repos/$user/${2:-$root}\" \
-d \"{\\\"name\\\": \\\"${1:?}\\\"}\"; \
git remote set-url \"${3:-origin}\" \"https://github.com/$user/$1\" )"
open-page = "!xdg-open \"$(basename \"$(git root)\")\""
conflicts = diff --name-only --diff-filter=U
wdiff = diff --word-diff
cdiff = diff --word-diff-regex=. --color-words
lab = !git clone git@gitlab.com:"$1" "${@:2}" "#"
aur = !git clone aur@aur.archlinux.org:"$1" "${@:2}" "#"
tmp = !git clone "${@:2}" -- "$1" "/tmp/${1##*/}" "#"
[url "git@github.com:"]
insteadOf = https://github.com/

View File

@ -22,7 +22,7 @@ set dirsize=nitems
set fillchars=vborder:┊
" Use ripgrep instead of grep
set grepprg=rg\ --color=never\ -n\ %i\ %a\ %s
set grepprg=rg\ --color=never\ -Hn\ %i\ %a\ %s
" Use fd instead of find
set findprg=fd\ --color=never\ %a\ %s