dot

packages and services management
Log | Files | Refs | README

commit 66bb1a1340c8059be463602f80d6be10b05b6705
parent 7bca81a8729bad87a0ab292683f8e8a89ce22108
Author: josuah <mail@josuah.net>
Date:   Tue,  3 Jan 2017 23:49:19 +0100

Much simpler git prompt

Diffstat:
M.config/dvtm/config.h | 56+++++++-------------------------------------------------
M.config/git/config | 7++-----
M.local/bin/git-prompt | 2+-
M.profile | 13++++++-------
4 files changed, 16 insertions(+), 62 deletions(-)

diff --git a/.config/dvtm/config.h b/.config/dvtm/config.h @@ -1,3 +1,7 @@ +/* scroll back buffer size in lines */ +#define SCROLL_HISTORY 500 + + /* colors --------------------------------------------------------------------*/ /* valid curses attributes are listed below they can be ORed @@ -171,8 +175,9 @@ static KeyBinding bindings[] = { { { MOD, 'r', }, { redraw, { NULL } } }, { { MOD, MOD, }, { send, { (const char []){MOD, 0} } } }, - { { MOD, 'e', }, { copymode, { NULL } } }, - { { MOD, '/', }, { copymode, { "/" } } }, + { { MOD, 'e', }, { copymode, { "dvtm-editor" } } }, + { { MOD, 'E', }, { copymode, { "dvtm-pager" } } }, + { { MOD, '/', }, { copymode, { "dvtm-pager", "/" } } }, { { MOD, 'p', }, { paste, { NULL } } }, { { MOD, KEY_PPAGE, }, { scrollback, { "-1" } } }, { { MOD, KEY_NPAGE, }, { scrollback, { "1" } } }, @@ -259,50 +264,3 @@ static Cmd commands[] = { static Action actions[] = { { create, { NULL } }, }; - - -/* copymode ------------------------------------------------------------------*/ - -/* scroll back buffer size in lines */ -#define SCROLL_HISTORY 500 - -/* editor to use for copy mode. If neither of DVTM_EDITOR, EDITOR and PAGER is - * set the first entry is chosen. Otherwise the array is consulted for supported - * options. A %d in argv is replaced by the line number at which the file should - * be opened. If filter is true the editor is expected to work even if stdout is - * redirected (i.e. not a terminal). If color is true then color escape - * sequences are generated in the output. - */ -static Editor editors[] = { - { - .name = "vis", - .argv = { "vis", "+%d", "-", NULL }, - .filter = true, - .color = false - }, { - .name = "sandy", - .argv = { "sandy", "-d", "-", NULL }, - .filter = true, - .color = false - }, { - .name = "dvtm-editor", - .argv = { "dvtm-editor", "-", NULL }, - .filter = true, - .color = false - }, { - .name = "less", - .argv = { "less", "-R", "+%d", NULL }, - .filter = false, - .color = true - }, { - .name = "vim", - .argv = { "vim", "+%d", "-", NULL }, - .filter = false, - .color = false - }, { - .name = "more", - .argv = { "more", "+%d", NULL }, - .filter = false, - .color = false - } -}; diff --git a/.config/git/config b/.config/git/config @@ -1,8 +1,5 @@ -# * | ,-- * -# ,--, , |-- ,--. ,--. ---. |- , ,--, -# | | | | | | | | | | | | | -# `--| ' ' `--' `--' ' ' ' ' `--| 2016-10-08 -#-`--'----------------------------`--'------------------------------------------ +# git configuration file + [user] email = mail@josuah.net diff --git a/.local/bin/git-prompt b/.local/bin/git-prompt @@ -29,7 +29,7 @@ git rev-parse 2> /dev/null && git status --porcelain -b | awk ' /^[^ ]. / { staged++; } END { - printf(" \033[1m%s\033[0m", branch); + printf(" \033[1m%s\033[0m", branch); if (untracked + conflicts + changed + staged + behind + ahead == 0) { printf " \033[32mok\033[0m"; diff --git a/.profile b/.profile @@ -21,7 +21,7 @@ export PAGER='less' MANPAGER="$PAGER" # dvtm export DVTM_TERM='ansi' -export DVTM_EDITOR="$PAGER" +export DVTM_PAGER='less -R' # xdg base directory export XDG_DATA_HOME="$HOME/.local/share" @@ -34,12 +34,11 @@ export PS1='$( [ $? -eq 0 ] && color=2 || color=1 [ -z "${PWD##$HOME*}" ] && pwd="~${PWD#$HOME}" || pwd="$PWD" - printf "\033[?6c" # TTY cursor shape - printf "\a" # bell at the end of the command - printf "\033]0;%s\007" "$pwd" # terminal name - printf "\n \033[30;1m%s\033[m" "$pwd" - git-prompt - printf "\n \033[1;30m>\033[0;3%sm>\033[1m>\033[m " "$color" + printf "\033[?6c" # TTY cursor shape + printf "\a" # bell at the end of the command + printf "\033]0;%s\007\n" "$pwd" # terminal name + git rev-parse 2> /dev/null && git -c color.ui=always status -s -b + printf " \033[1;3%sm───\033[m " "$color" )' export PS2=' > ' export PS3=' > '