-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.kshrc
111 lines (93 loc) · 2.86 KB
/
.kshrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# ~/.kshrc
# mountaineerbr
[[ -e ~/.rc ]] && . ~/.rc
set -o emacs
set -o multiline
PS1='$? ${HOSTNAME}:${PWD##*/} % '
##Set in /etc/environment or /etc/profile
##ENV is .kshrc only when the shell is invoked in an interactive context,
##and empty for a script, thanks to the array indexing based on the value of $-.
#ENVFILE=$HOME/.kshrc
#export ENVFILE
#ENV='${ENVFILE[(_=1)+(_$-=0)-_${-%%*i*}]}'
#export ENV
##https://groups.google.com/g/comp.unix.shell/c/m7mY8fp69Fc
# /etc/skel
# This file contains examples of some of the things you may want to
# include in a user startup file.
# Set the shell options
set -o emacs -o notify -o globstar
[[ -o nobackslashctrl ]] && set -o nobackslashctrl
[[ -o globcasedetect ]] && set -o globcasedetect
#[[ -o noarrowkeysearch ]] && set -o noarrowkeysearch
# Specify search path for autoloadable functions
FPATH=/usr/share/ksh/functions:~/.func
# Optional: Autoload functions installed with ksh
#autoload autocd
#autoload man
#autoload dirs
#autoload pushd
#autoload popd
# Optional: Set the precision of the time keyword to six and use %C
#((.sh.version >= 20220606)) && TIMEFORMAT=$'\nreal\t%6lR\ncpu\t%6lC'
# Optional: Avoid certain file types in completion
#FIGNORE='@(*.o|~*)'
# Save more commands in history
HISTSIZE=2000
#HISTEDIT=$EDITOR
## Remove the problematic default 'r' alias (this is only
## done when it's safe, as old versions of ksh can crash
## after 'unalias r').
##((.sh.version >= 20220806)) && unalias r
# Below is a basic example that provides extra tilde expansions
if ((.sh.version >= 20210318)) && [[ $(id -u) != 0 ]]; then
.sh.tilde.get()
{
case ${.sh.tilde} in
'~docs') .sh.tilde=~/Documents ;;
'~dls') .sh.tilde=~/Downloads ;;
'~share') .sh.tilde=~/.local/share ;;
esac
}
fi
## Associative array containing a set of RGB color codes.
## Terminals emulators with support for wide color ranges
## can take better advantage of this.
#typeset -A color=(
# [bright_lavender]=$'\E[38;2;191;148;228m'
# [red]=$'\E[38;2;255;0;0m'
# [cyan_process]=$'\E[38;2;0;183;235m'
# [ultramarine_blue]=$'\E[38;2;65;102;245m'
# [reset]=$'\E[0m'
# # Some extra examples
# #[start_title]=$'\E]0;'
# #[bell]=$'\a'
# #[underline]=$'\E[4m'
# #[spaced_dots]=$'\E[4:5m'
#)
#
## Get the effective user ID now to avoid running id(1) every time $PS1 is printed
#integer euid=$(id -u)
#
#PS1.get()
#{
# ret=$? # Workaround $? bug in ksh < 2021-03-16 (cf. https://github.com/ksh93/ksh/pull/226)
#
# pwd=$(pwd 2>/dev/null)
# case ${pwd} in
# ~) pwd='~' ;;
# ~docs) pwd='~docs' ;;
# ~dls) pwd='~dls' ;;
# ~share) pwd='~share' ;;
# '') pwd="${color[red]}No pwd found" ;;
# /) ;; # Do nothing
# *) pwd=${pwd##*/} ;;
# esac
# if ((euid == 0)); then
# .sh.value='${color[bright_lavender]}${pwd} ${color[red]}#${color[reset]} '
# else
# .sh.value='${color[ultramarine_blue]}${pwd} ${color[cyan_process]}\$${color[reset]} '
# fi
#
# return $ret
#}