-
Notifications
You must be signed in to change notification settings - Fork 0
/
shell.sh
73 lines (57 loc) · 1.88 KB
/
shell.sh
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
#!/bin/bash
source ./utils.sh
function add_fish_to_shells() {
# This is needed since fish isn't a standard shell
if ! grep "$(which fish)" /etc/shells > /dev/null 2>&1; then
fancy_echo "Adding fish to the legacy shells!"
sudo bash -c "echo $(which fish) >> /etc/shells"
fi
}
function update_shell() {
# Check if the used shell is already set to fish
if [[ $SHELL != *"fish"* ]]; then
# Check if fish is installed
if which fish > /dev/null 2>&1; then
fancy_echo "Changing your shell to fish!"
chsh -s $(which fish) $USER
fi
fi
}
function install_omf() {
if [ ! -d "$HOME/.local/share/omf" ]; then
fancy_echo "Installing Oh my Fish!"
curl -L https://get.oh-my.fish | fish
fi
}
function install_asdf_plugins() {
fancy_echo "Installing asdf version manager plugins (Ruby, NodeJS and Python)"
asdf plugin-add ruby https://github.com/asdf-vm/asdf-ruby.git
asdf plugin add nodejs https://github.com/asdf-vm/asdf-nodejs.git
asdf plugin-add python
}
function install_asdf_language() {
local name="$1"
local version="$2"
if ! asdf list "$name" | grep -Fq "$version"; then
fancy_echo "Installing $name $version globally using asdf!"
asdf install "$name" "$version"
asdf global "$name" "$version"
fi
}
function install_fzf() {
bash -c "$(brew --prefix)/opt/fzf/install --no-bash --no-zsh --key-bindings --completion --update-rc"
fish -c fzf_key_bindings
}
function configure_gitignore_globally() {
fancy_echo "Configuring git to ignore files globally!"
git config --global core.excludesFile '~/.gitignore_global'
}
add_fish_to_shells
update_shell
install_omf
install_asdf_plugins
install_asdf_language "ruby" "3.1.1"
install_asdf_language "nodejs" "lts"
install_asdf_language "python" "3.10.3"
install_fzf
configure_gitignore_globally