From 183979f2530371ecee0a75af612524b60d969fc0 Mon Sep 17 00:00:00 2001 From: k1574 Date: Sat, 4 Dec 2021 23:57:51 +0500 Subject: [PATCH] Simplified rc files. --- dot/file/bashrc | 8 ++++++-- dot/file/profile | 53 +++++++++++++++--------------------------------- dot/file/shrc | 7 ++++++- dot/file/zshrc | 9 ++++---- fish/config.fish | 30 ++++++++++----------------- profile | 24 +++++++++------------- 6 files changed, 54 insertions(+), 77 deletions(-) diff --git a/dot/file/bashrc b/dot/file/bashrc index e0d84be..ceba9d1 100644 --- a/dot/file/bashrc +++ b/dot/file/bashrc @@ -1,4 +1,8 @@ -test -r "$LOGIN" && . "$LOGIN" -test -r "$SETENV" && . "$SETENV" && setenv bash +q(){ + echo $SHLVL - 1 | bc + exit +} export PS1="$SHPROMPT" +test -r "$LOGIN" && . "$LOGIN" +test -r "$SETENV" && . "$SETENV" && setenv bash diff --git a/dot/file/profile b/dot/file/profile index 681aa0a..3b7dbde 100755 --- a/dot/file/profile +++ b/dot/file/profile @@ -22,51 +22,30 @@ q(){ # Standard variables. export_loop \ ENV '$HOME/.shrc' \ - DEV '$HOME/dev' \ - LIB '$HOME/lib' \ - IMG '$HOME/img' \ - SND '$HOME/snd' \ - DOC '$HOME/doc' \ - VID '$HOME/vid' \ - LOAD '$HOME/load' \ - TXT '$HOME/txt' \ - SHR '$HOME/shr' \ - MNT '$HOME/mnt' \ - PUB '$HOME/pub' \ - TMP '$HOME/tmp' \ - EXE '$HOME/exe' \ - SHPROMPT '"% "' \ - PS1 '"$SHPROMPT"' \ + PS1 '"% "' \ SUDO_PROMPT '"#"' \ - EDITOR 'ed' \ - INDENT ' ' \ + EDITOR 'vi' \ VISUAL 'vi' \ GIT_EDITOR '$VISUAL' \ PAGER 'less' \ MANPAGER '$PAGER' \ - MAN '$SHR/man' \ + \ PROFILE '$HOME/.profile' \ - TMPL '$HOME/tmpl' \ - APP '$HOME/app' \ ENVDIR '$HOME/env' \ - SETENV '$LIB/setenv/sh' \ - GOPATH '$APP/go' \ - GOBIN '$EXE'\ - COMPOSEREXE '$LIB/composer/vendor/bin' \ - VPATH '$APP/v'\ - VEXE '$VPATH'\ - PLAN9BASE '/usr/local/plan9' \ - PLAN9PORT '$APP/plan9' \ - PLAN9 '$PLAN9PORT' \ - INFERNO '$APP/inferno' \ - XDG_CONFIG_HOME '$LIB' \ - XDG_RUNTIME_DIR '$TMP' \ - XDG_DATA_HOME '$APP' \ - XCOMPOSEFILE '$LIB/xcompose' \ - ANDROID_NDK_HOME '$APP/android/ndk' \ - LOGIN '$LIB/login/sh' \ + SETENV '$HOME/lib/setenv/sh' \ + LOGIN '$HOME/lib/login/sh' \ + INDENT '" "'\ + \ + GOPATH '$HOME/app/go' \ + GOBIN '$HOME/exe'\ + COMPOSEREXE '$HOME/lib/composer/vendor/bin' \ + XDG_CONFIG_HOME '$HOME/lib' \ + XDG_RUNTIME_DIR '$HOME/tmp' \ + XDG_DATA_HOME '$HOME/app' \ + XCOMPOSEFILE '$HOME/lib/xcompose' \ + ANDROID_NDK_HOME '$HOME/app/android/ndk' \ GIT 'https://github.com/$USER' \ - PATH '$EXE:$PATH:$GOEXE:$PLAN9BASE/bin:$PLAN9PORT/bin:$VEXE:$COMPOSEREXE' \ + PATH '$HOME/exe:$PATH' \ test -r $SETENV && . "$SETENV" && setenv profile diff --git a/dot/file/shrc b/dot/file/shrc index 972e262..6bf7353 100644 --- a/dot/file/shrc +++ b/dot/file/shrc @@ -1,5 +1,10 @@ #!/bin/sh + +q(){ + echo $SHLVL - 1 | bc + exit +} + test -r "$LOGIN" && . "$LOGIN" PS1="$SHPROMPT" test -r "$SETENV" && . "$SETENV" && setenv sh - diff --git a/dot/file/zshrc b/dot/file/zshrc index fe12b3f..aa87e7c 100644 --- a/dot/file/zshrc +++ b/dot/file/zshrc @@ -1,7 +1,7 @@ #!/bin/sh -autoload -Uz compinit promptinit -compinit -promptinit +#autoload -Uz compinit promptinit +#compinit +#promptinit zstyle ':completion:*' menu select zstyle ':completion:*:manuals' separate-sections true zstyle ':completion:*:manuals.*' insert-sections true @@ -29,6 +29,7 @@ setopt nobeep setopt noglobdots setopt noshwordsplit test -r "$LOGIN" && . "$LOGIN" -PROMPT="$SHPROMPT" +export PROMPT="%# " +q(){echo $SHLVL - 1 | bc ; exit} test -r "$SETENV" && . "$SETENV" && setenv zsh diff --git a/fish/config.fish b/fish/config.fish index df7789b..f5e4b3e 100644 --- a/fish/config.fish +++ b/fish/config.fish @@ -9,6 +9,12 @@ function fish_prompt --description "Write out the prompt" echo -n $SHPROMPT end +# Easy quit. +function q + echo $SHLVL - 1 | bc + exit +end + # Right prompt. function fish_right_prompt # Fuck this. @@ -18,23 +24,9 @@ set -l color_cwd set -l suffix # Colors - - # Less colors - export LESS_TERMCAP_md=(perl -e "print \"\033[1;31m\"") - export LESS_TERMCAP_me=(perl -e "print \"\033[0m\"") - # Underlined - export LESS_TERMCAP_us=(perl -e "print \"\033[1;32m\";") - export LESS_TERMCAP_ue=(perl -e "print \"\033[0m\"; ") - # Service info - export LESS_TERMCAP_so=(perl -e "print \"\033[1;33m\";") - export LESS_TERMCAP_se=(perl -e "print \"\033[0m\";") - # Blinking color - export LESS_TERMCAP_mb=(perl -e "print \"\033[1;32m\";") - export LESS_TERMCAP_me=(perl -e "print \"\033[0m\";") - # Fish colors - set fish_color_comment yellow - set fish_color_error grey - set fish_color_operator $color_cwd - set fish_color_autosuggestion "brgrey" - set fish_color_command "--bold" +set fish_color_comment yellow +set fish_color_error grey +set fish_color_operator $color_cwd +set fish_color_autosuggestion "brgrey" +set fish_color_command "--bold" diff --git a/profile b/profile index 84275ca..f1d7846 100644 --- a/profile +++ b/profile @@ -1,5 +1,7 @@ # k1574's rc configuration file. +SHLVL = `{echo $SHLVL + 1 | bc} + oldifs = $ifs prompt = '% ' # The simplest possible prompt. fn % { @@ -32,6 +34,7 @@ git = https://github.com/$USER pager = less # Pager deleting all ESC-sequences. For 9term mostly. manpager = $pager # Pager for man pages. profile = $0 # Profile file. +indent = ' ' # Indent for programming. inferno = $app/inferno # Inferno. infernoexe = `{ # Inferno executables files. @@ -44,19 +47,17 @@ infernoexe = `{ # Inferno executables files. } plan9 = $app/plan9 # Plan9. -plan9exe= $plan9/bin # Plan9 bnaries. +plan9exe= $plan9/bin # Plan9 exe files. gopath = $app/go # Golang path. -goexe = $gopath/bin # Golang binaries. vpath = $app/v # VLang binaries and scripts. -vexe = $vpath +vexe = $vpath # VLang executives. setenv = $lib/setenv/rc # Setting environment script. -composerexe = $lib/composer/vendor/bin -font = $plan9/font/fixed/unicode.9x15.font # The standard font for Plan9 program. -editor = ed +composerexe = $lib/composer/vendor/bin # PHP executive shit. +editor = vi shell = rc -path = ( $exe $path $goexe $plan9exe $infernoexe $vexe $composerexe ) -# Pretend path from growing because of running many "rc"s. +path = ( $home/exe $path $home $plan9exe $infernoexe $vexe $composerexe ) +# Prevent path from growing because of running many "rc"s. if(which goblin >/dev/null >[2=1]){ path = `{ { for( i in $path) echo $i } | goblin uniq -U @@ -93,12 +94,6 @@ case ( Linux NetBSD DragonFly OpenBSD FreeBSD ) # On Unix-like systems. LESS_TERMCAP_mb = `{ perl -e 'print "\033[1;32m" ;' } LESS_TERMCAP_me = `{ perl -e 'print "\033[0m" ;' } } - # Pager. - PAGER = $pager - MANPAGER = $manpager - # Editor. - EDITOR = $editor - user = $USER case * # Nothing in non-Unix systems. } @@ -173,6 +168,7 @@ fn e { } fn q { + echo $SHLVL - 1 | bc exit }