diff options
author | clarkzjw <[email protected]> | 2022-11-17 10:56:25 -0800 |
---|---|---|
committer | clarkzjw <[email protected]> | 2022-11-17 10:56:25 -0800 |
commit | d2d735742ca61b211c9b48a2209d36395daebcf4 (patch) | |
tree | bda27729a1bbac3ab354a1f10d4885899cdbf967 /dot_bashrc | |
parent | a6d2e5e6fb9adc84c32e86630b4846b1765c7d77 (diff) | |
download | dotfiles-d2d735742ca61b211c9b48a2209d36395daebcf4.tar.gz |
+ add existing config
Diffstat (limited to 'dot_bashrc')
-rw-r--r-- | dot_bashrc | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/dot_bashrc b/dot_bashrc new file mode 100644 index 0000000..8f8e639 --- /dev/null +++ b/dot_bashrc | |||
@@ -0,0 +1,87 @@ | |||
1 | # | ||
2 | # ~/.bashrc | ||
3 | # | ||
4 | |||
5 | # If not running interactively, don't do anything | ||
6 | [[ $- != *i* ]] && return | ||
7 | |||
8 | [[ -f ~/.welcome_screen ]] && . ~/.welcome_screen | ||
9 | |||
10 | _set_liveuser_PS1() { | ||
11 | PS1='[\u@\h \W]\$ ' | ||
12 | if [ "$(whoami)" = "liveuser" ] ; then | ||
13 | local iso_version="$(grep ^VERSION= /usr/lib/endeavouros-release 2>/dev/null | cut -d '=' -f 2)" | ||
14 | if [ -n "$iso_version" ] ; then | ||
15 | local prefix="eos-" | ||
16 | local iso_info="$prefix$iso_version" | ||
17 | PS1="[\u@$iso_info \W]\$ " | ||
18 | fi | ||
19 | fi | ||
20 | } | ||
21 | _set_liveuser_PS1 | ||
22 | unset -f _set_liveuser_PS1 | ||
23 | |||
24 | ShowInstallerIsoInfo() { | ||
25 | local file=/usr/lib/endeavouros-release | ||
26 | if [ -r $file ] ; then | ||
27 | cat $file | ||
28 | else | ||
29 | echo "Sorry, installer ISO info is not available." >&2 | ||
30 | fi | ||
31 | } | ||
32 | |||
33 | |||
34 | alias ls='ls --color=auto' | ||
35 | alias ll='ls -lav --ignore=..' # show long listing of all except ".." | ||
36 | alias l='ls -lav --ignore=.?*' # show long listing but no hidden dotfiles except "." | ||
37 | |||
38 | [[ "$(whoami)" = "root" ]] && return | ||
39 | |||
40 | [[ -z "$FUNCNEST" ]] && export FUNCNEST=100 # limits recursive functions, see 'man bash' | ||
41 | |||
42 | ## Use the up and down arrow keys for finding a command in history | ||
43 | ## (you can write some initial letters of the command first). | ||
44 | bind '"\e[A":history-search-backward' | ||
45 | bind '"\e[B":history-search-forward' | ||
46 | |||
47 | ################################################################################ | ||
48 | ## Some generally useful functions. | ||
49 | ## Consider uncommenting aliases below to start using these functions. | ||
50 | ## | ||
51 | ## October 2021: removed many obsolete functions. If you still need them, please look at | ||
52 | ## https://github.com/EndeavourOS-archive/EndeavourOS-archiso/raw/master/airootfs/etc/skel/.bashrc | ||
53 | |||
54 | _open_files_for_editing() { | ||
55 | # Open any given document file(s) for editing (or just viewing). | ||
56 | # Note1: | ||
57 | # - Do not use for executable files! | ||
58 | # Note2: | ||
59 | # - Uses 'mime' bindings, so you may need to use | ||
60 | # e.g. a file manager to make proper file bindings. | ||
61 | |||
62 | if [ -x /usr/bin/exo-open ] ; then | ||
63 | echo "exo-open $@" >&2 | ||
64 | setsid exo-open "$@" >& /dev/null | ||
65 | return | ||
66 | fi | ||
67 | if [ -x /usr/bin/xdg-open ] ; then | ||
68 | for file in "$@" ; do | ||
69 | echo "xdg-open $file" >&2 | ||
70 | setsid xdg-open "$file" >& /dev/null | ||
71 | done | ||
72 | return | ||
73 | fi | ||
74 | |||
75 | echo "$FUNCNAME: package 'xdg-utils' or 'exo' is required." >&2 | ||
76 | } | ||
77 | |||
78 | #------------------------------------------------------------ | ||
79 | |||
80 | ## Aliases for the functions above. | ||
81 | ## Uncomment an alias if you want to use it. | ||
82 | ## | ||
83 | |||
84 | # alias ef='_open_files_for_editing' # 'ef' opens given file(s) for editing | ||
85 | # alias pacdiff=eos-pacdiff | ||
86 | ################################################################################ | ||
87 | |||