-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathshell_utils.fish
87 lines (74 loc) · 2.55 KB
/
shell_utils.fish
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
set shell_utils ~/.shell_utils
set shell_utils_configs ~/.shell_utils_configs
# Path to your shell_utils installation.
if not test -d "$shell_utils"
git clone https://github.com/felipefacundes/shell_utils "$shell_utils"
end
# Path to your shell_utils configs
if not test -d "$shell_utils_configs"
mkdir -p "$shell_utils_configs"
end
# Loops through all .fish files in the source directory and its subdirectories
function sourced
set source_file "$shell_utils/$source_path.fish"
if test -f "$source_file"
rm "$source_file"
end
for file in (find "$shell_utils/$source_path" -name '*.fish' 2>/dev/null)
set file (string replace $HOME "\$HOME" -- $file)
echo ". $file" >> "$shell_utils/$source_path.fish"
end
end
# Priority
# What should be started before
set source_path priority
sourced
if test -f "$shell_utils/$source_path.fish"
. "$shell_utils/$source_path.fish"
end
########################################
############# MY VARIABLES #############
set source_path variables
sourced
if test -f "$shell_utils/$source_path.fish"
. "$shell_utils/$source_path.fish"
end
########################################
############# MY FUNCTIONS #############
set source_path functions
sourced
if test -f "$shell_utils/$source_path.fish"
. "$shell_utils/$source_path.fish"
end
########################################
############### ALIASES ###############
# Example aliases:
# alias bashconfig="vim ~/.bashrc"
# alias zshconfig="vim ~/.zshrc"
set source_path aliases
sourced
if test -f "$shell_utils/$source_path.fish"
. "$shell_utils/$source_path.fish"
end
##### History
if not test -f ~/.local/share/fish/fish_history
touch ~/.local/share/fish/fish_history
end
##### SECURITY
sed -i 's#cmd: rm #cmd: rm_locked #g' ~/.local/share/fish/fish_history
sed -i 's#cmd: sudo rm #cmd: rm_locked #g' ~/.local/share/fish/fish_history
sed -i 's#cmd: doas rm #cmd: rm_locked #g' ~/.local/share/fish/fish_history
sed -i 's#cmd: mv #cmd: mv_locked #g' ~/.local/share/fish/fish_history
sed -i 's#cmd: sudo mv #cmd: mv_locked #g' ~/.local/share/fish/fish_history
sed -i 's#cmd: doas mv #cmd: mv_locked #g' ~/.local/share/fish/fish_history
sed -i 's|/dev/sd[abcdefghij][123456789]|/dev/sdX|g' ~/.local/share/fish/fish_history
sed -i 's|/dev/sd[abcdefghij]|/dev/sdX|g' ~/.local/share/fish/fish_history
# Load ASCII Theme Art
"$shell_utils/scripts/ascii_theme_select.sh"
# SHELL_UTILS AUTO UPDATE
"$shell_utils/scripts/shell_utils_update.sh"
########################################
set -e source_file
set -e shell_utils
set -e source_path
set -e sourced