Merge branch 'main' of github.com:jim-fx/.dotfiles
This commit is contained in:
commit
771be92741
@ -1,6 +1,6 @@
|
||||
FROM debian:latest
|
||||
|
||||
ADD . ~/.dotfiles
|
||||
ADD . /root/.dotfiles
|
||||
|
||||
RUN apt-get update && apt-get upgrade -y
|
||||
RUN apt-get install curl git zsh -y
|
||||
|
@ -78,9 +78,10 @@ source $HOME/.dotfiles/configs/zsh/update-repo.zsh
|
||||
# The next line enables shell command completion for gcloud.
|
||||
#if [ -f '/home/coder/downloads/google-cloud-sdk/completion.zsh.inc' ]; then . '/home/coder/downloads/google-cloud-sdk/completion.zsh.inc'; fi
|
||||
|
||||
. $HOME/.asdf/asdf.sh
|
||||
. $HOME/.asdf/completions/asdf.bash
|
||||
|
||||
if [ -s "$HOME/.asdf" ]; then
|
||||
. $HOME/.asdf/asdf.sh
|
||||
. $HOME/.asdf/completions/asdf.bash
|
||||
fi
|
||||
|
||||
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
|
||||
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
|
||||
|
@ -9,7 +9,7 @@ alias yoink="curl"
|
||||
|
||||
alias pls='sudo -E env "PATH=$PATH"'
|
||||
|
||||
alias zshc="cd ~/.dotfiles && vim configs/.zshrc"
|
||||
alias zshc="cd ~/.dotfiles && vim configs/.zshrc && cd -"
|
||||
alias zshu="source ~/.zshrc"
|
||||
|
||||
alias nano="nvim"
|
||||
|
@ -2,28 +2,33 @@
|
||||
|
||||
function fp(){
|
||||
|
||||
PORT=$1;
|
||||
for p in "$@"
|
||||
do
|
||||
|
||||
if [ "$(which lsof)" = "lsof not found" ]; then
|
||||
echo "lsof not installed"
|
||||
else
|
||||
PIDS="$(lsof -t -i:$PORT)"
|
||||
|
||||
AMOUNT=$(wc -w<<<$PIDS);
|
||||
|
||||
if [ $AMOUNT = 0 ]; then
|
||||
|
||||
echo "No processes use port $PORT";
|
||||
PORT=$var;
|
||||
|
||||
if [ "$(which lsof)" = "lsof not found" ]; then
|
||||
echo "lsof not installed"
|
||||
else
|
||||
PIDS="$(lsof -t -i:$PORT)"
|
||||
|
||||
echo "Killing $AMOUNT process(es) using port $PORT";
|
||||
AMOUNT=$(wc -w<<<$PIDS);
|
||||
|
||||
echo "$PIDS" | while IFS= read -r pid ; do
|
||||
kill -9 $pid;
|
||||
done
|
||||
if [ $AMOUNT = 0 ]; then
|
||||
|
||||
echo "No processes use port $PORT";
|
||||
|
||||
else
|
||||
|
||||
echo "Killing $AMOUNT process(es) using port $PORT";
|
||||
|
||||
echo "$PIDS" | while IFS= read -r pid ; do
|
||||
kill -9 $pid;
|
||||
done
|
||||
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
done
|
||||
|
||||
}
|
16
helpers/asdf-install.sh
Normal file
16
helpers/asdf-install.sh
Normal file
@ -0,0 +1,16 @@
|
||||
asdfInstall(){
|
||||
. "$HOME/.asdf/asdf.sh"
|
||||
if [ "$(which asdf)" = "" ]; then
|
||||
echo "Asdf not installed"
|
||||
else
|
||||
echo "-------------- ASDF install ------------------"
|
||||
echo "-- $1"
|
||||
asdf plugin add $1
|
||||
asdf install $1 latest
|
||||
asdf global $1 latest
|
||||
echo "----------------------------------------------"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
[[ "${1}" != "--source-only" ]] && asdfInstall "${@}"
|
@ -24,11 +24,11 @@ installOptional() {
|
||||
install() {
|
||||
# Check if program is already installed
|
||||
if isInstalled $1; then
|
||||
echo " - $1 is already installed"
|
||||
echo " ✓ $1 is already installed"
|
||||
else
|
||||
echo " - installing $1 ..."
|
||||
apt-get install $1 -y >/dev/null
|
||||
echo " - finished"
|
||||
echo " ✓ finished"
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -68,9 +68,9 @@ function multiselect() {
|
||||
# print options by overwriting the last lines
|
||||
local idx=0
|
||||
for option in "${options[@]}"; do
|
||||
local prefix=" [ ]"
|
||||
local prefix=" [ ]"
|
||||
if [[ ${selected[idx]} == true ]]; then
|
||||
prefix=" [x]"
|
||||
prefix=" [x]"
|
||||
fi
|
||||
|
||||
cursor_to $(($startrow + $idx))
|
||||
|
@ -1,8 +1,8 @@
|
||||
#!/bin/bash
|
||||
|
||||
# - Prerequesits -
|
||||
echo "-- Installing git --"
|
||||
if [ "$(which git)" = "" ]; then
|
||||
echo "-- Installing git --"
|
||||
apt-get install git -y >/dev/null
|
||||
fi
|
||||
|
||||
|
12
install/install-asdf.sh
Executable file
12
install/install-asdf.sh
Executable file
@ -0,0 +1,12 @@
|
||||
if [ -d ~/.asdf ] ; then
|
||||
|
||||
echo " ✓ asdf already installed"
|
||||
|
||||
else
|
||||
|
||||
git clone --quiet https://github.com/asdf-vm/asdf.git ~/.asdf > /dev/null
|
||||
cd ~/.asdf
|
||||
git checkout --quiet "$(git describe --abbrev=0 --tags)" > /dev/null
|
||||
. asdf.sh
|
||||
|
||||
fi
|
@ -1,46 +0,0 @@
|
||||
#!/bin/bash -e
|
||||
cd "$(dirname "$0")"
|
||||
|
||||
# Make config directory for Neovim's init.vim
|
||||
echo '[*] Preparing Neovim config directory ...'
|
||||
mkdir -p ~/.config/nvim
|
||||
|
||||
# Install nvim (and its dependencies: pip3, git), Python 3 and ctags (for tagbar)
|
||||
echo '[*] App installing Neovim and its dependencies (Python 3 and git), and dependencies for tagbar (exuberant-ctags) ...'
|
||||
sudo apt update
|
||||
sudo apt install neovim python3 python3-pip python3-venv git curl exuberant-ctags -y
|
||||
|
||||
# Install virtualenv to containerize dependencies
|
||||
echo '[*] Pip installing venv to containerize Neovim dependencies (instead of installing them onto your system) ...'
|
||||
python3 -m venv ~/.config/nvim/env
|
||||
|
||||
# Install pip modules for Neovim within the virtual environment created
|
||||
echo '[*] Activating virtualenv and pip installing Neovim (for Python plugin support), libraries for async autocompletion support (jedi, psutil, setproctitle), and library for pep8-style formatting (yapf) ...'
|
||||
source ~/.config/nvim/env/bin/activate
|
||||
pip install pynvim jedi psutil setproctitle yapf doq # run `pip uninstall neovim pynvim` if still using old neovim module
|
||||
deactivate
|
||||
|
||||
# Install vim-plug plugin manager
|
||||
echo '[*] Downloading vim-plug, the best minimalistic vim plugin manager ...'
|
||||
curl -fLo ~/.local/share/nvim/site/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
|
||||
|
||||
# (Optional but recommended) Install a nerd font for icons and a beautiful airline bar (https://github.com/ryanoasis/nerd-fonts/tree/master/patched-fonts) (I'll be using Iosevka for Powerline)
|
||||
echo "[*] Downloading patch font into ~/.local/share/fonts ..."
|
||||
curl -fLo ~/.fonts/Iosevka\ Term\ Nerd\ Font\ Complete.ttf --create-dirs https://github.com/ryanoasis/nerd-fonts/raw/master/patched-fonts/Iosevka/Regular/complete/Iosevka%20Term%20Nerd%20Font%20Complete.ttf
|
||||
|
||||
# (Optional) Alias vim -> nvim
|
||||
echo '[*] Aliasing vim -> nvim, remember to source ~/.bashrc ...'
|
||||
echo "alias vim='nvim'" >>~/.bashrc
|
||||
|
||||
# Enter Neovim and install plugins using a temporary init.vim, which avoids warnings about missing colorschemes, functions, etc
|
||||
echo -e '[*] Running :PlugInstall within nvim ...'
|
||||
sed '/call plug#end/q' ../configs/init.vim >~/.config/nvim/init.vim
|
||||
nvim -c ':PlugInstall' -c ':UpdateRemotePlugins' -c ':qall'
|
||||
rm ~/.config/nvim/init.vim
|
||||
|
||||
# Copy init.vim in current working directory to nvim's config location ...
|
||||
echo '[*] Linking init.vim -> ~/.config/nvim/init.vim'
|
||||
cd ..
|
||||
ln -s $(pwd)/configs/init.vim ~/.config/nvim/init.vim
|
||||
|
||||
echo -e "[+] Done, welcome to \033[1m\033[92mNeoVim\033[0m! Try it by running: nvim/vim. Want to customize it? Modify ~/.config/nvim/init.vim"
|
15
install/install-nvim.sh
Executable file
15
install/install-nvim.sh
Executable file
@ -0,0 +1,15 @@
|
||||
if [ -f "$HOME/.config/nvim/init.vim" ]; then
|
||||
echo " - moving old file to init.vim.BAK"
|
||||
mv "$HOME/.config/nvim/init.vim" "$HOME/.config/nvim/init.vim.BAK"
|
||||
fi
|
||||
|
||||
echo " - linking init.vim --> init.vim"
|
||||
mkdir -p $HOME/.config/nvim
|
||||
ln -s "$HOME/.dotfiles/configs/init.vim" "$HOME/.config/nvim/init.vim"
|
||||
|
||||
echo " - installing vim-plug"
|
||||
sh -c 'curl -fLo "${XDG_DATA_HOME:-$HOME/.local/share}"/nvim/site/autoload/plug.vim --create-dirs \
|
||||
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
|
||||
|
||||
echo " - installing vim plugins"
|
||||
nvim --headless +PlugInstall +qa
|
0
install/oh-my-zsh.sh
Normal file → Executable file
0
install/oh-my-zsh.sh
Normal file → Executable file
2
install/p10k.sh
Normal file → Executable file
2
install/p10k.sh
Normal file → Executable file
@ -1,3 +1,3 @@
|
||||
echo " - cloning github.com/zsh-users/zsh-autosuggestions into ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k"
|
||||
echo " - cloning github.com/romkatv/powerlevel10k into ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k"
|
||||
git clone --quiet --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k > /dev/null
|
||||
echo " - finished"
|
0
install/zsh-autosuggestions.sh
Normal file → Executable file
0
install/zsh-autosuggestions.sh
Normal file → Executable file
66
setup.sh
66
setup.sh
@ -1,10 +1,12 @@
|
||||
#!/bin/bash
|
||||
cd "$(dirname "$0")"
|
||||
|
||||
#Loading all the helper scripts
|
||||
. ./helpers/installer.sh --source-only
|
||||
. ./helpers/prompt.sh --source-only
|
||||
. ./helpers/linker.sh --source-only
|
||||
. ./helpers/multiselect.sh --source-only
|
||||
. ./helpers/asdf-install.sh --source-only
|
||||
|
||||
echo "-- welcome to my setup script --"
|
||||
echo "-- installing prerequesits (git, curl) --"
|
||||
@ -31,35 +33,66 @@ echo "-----------------------------------"
|
||||
#Make the selection
|
||||
echo "-- what do you want to install? --"
|
||||
|
||||
OPTIONS_VALUES=("ZSH" "NVIM" "DRNV" "GVM" "NVM" "SDKM")
|
||||
OPTIONS_LABELS=("zsh + oh-my-zsh" "Neovim" "Direnv" "Go Version Manager" "Node Version Manager" "Java Version Manager")
|
||||
|
||||
# 0 - ZSH
|
||||
# 1 - NVIM
|
||||
# 2 - DRNV
|
||||
# 3 - NODE
|
||||
# 4 - GO
|
||||
# 5 - ZSH
|
||||
# 6 - ZSH
|
||||
# 7 - ZSH
|
||||
|
||||
OPTIONS_VALUES=("ZSH" "NVIM" "ASDF" "DRNV" "NODE" "GO" "PYTH" "DENO" "HUGO" "RUST")
|
||||
OPTIONS_LABELS=("zsh + oh-my-zsh" "Neovim" "Asdf" "Direnv" "NodeJS" "Golang" "Python" "Deno" "Hugo" "Rust")
|
||||
for i in "${!OPTIONS_VALUES[@]}"; do
|
||||
OPTIONS_STRING+="${OPTIONS_VALUES[$i]} (${OPTIONS_LABELS[$i]});"
|
||||
done
|
||||
|
||||
if [ $INTERACTIVE = "true" ]; then
|
||||
multiselect SELECTED "$OPTIONS_STRING"
|
||||
multiselect SELECTED "$OPTIONS_STRING":
|
||||
fi
|
||||
|
||||
# Variables
|
||||
INST_ZSH=${SELECTED[0]}
|
||||
INST_NVIM=${SELECTED[1]}
|
||||
INST_DRNV=${SELECTED[2]}
|
||||
INST_GVM=${SELECTED[3]}
|
||||
INST_NVM=${SELECTED[4]}
|
||||
INST_SDKM=${SELECTED[5]}
|
||||
INST_ASDF=${SELECTED[2]}
|
||||
INST_DRNV=${SELECTED[3]}
|
||||
INST_NODE=${SELECTED[4]}
|
||||
INST_GO=${SELECTED[5]}
|
||||
INST_PYTH=${SELECTED[6]}
|
||||
INST_DENO=${SELECTED[7]}
|
||||
INST_HUGO=${SELECTED[8]}
|
||||
INST_RUST=${SELECTED[9]}
|
||||
|
||||
if [ $INTERACTIVE = "false" ]; then
|
||||
INST_ZSH=true
|
||||
INST_NVIM=true
|
||||
fi
|
||||
|
||||
echo "-----------------------------------"
|
||||
|
||||
echo -e "-- installing programs --"
|
||||
[[ "$INST_DRNV" = true ]] && install direnv
|
||||
[[ "$INST_GVM" = true ]] && echo " - installing GVM"
|
||||
[[ "$INST_NVM" = true ]] && echo " - installing NVM"
|
||||
[[ "$INST_SDKM" = true ]] && echo " - installing SDKM"
|
||||
if [ "$INST_ASDF" = true ]; then
|
||||
|
||||
# Requirements for ASDF
|
||||
install gnupg2
|
||||
install unzip
|
||||
./install/install-asdf.sh
|
||||
|
||||
if [ "$INST_NVIM" = true ]; then
|
||||
asdfInstall neovim
|
||||
./install/install-nvim.sh
|
||||
fi
|
||||
|
||||
[[ "$INST_NODE" = true ]] && asdfInstall nodejs
|
||||
[[ "$INST_GO" = true ]] && asdfInstall golang
|
||||
[[ "$INST_PYTH" = true ]] && asdfInstall python
|
||||
[[ "$INST_DENO" = true ]] && asdfInstall deno
|
||||
[[ "$INST_HUGO" = true ]] && asdfInstall hugo
|
||||
[[ "$INST_RUST" = true ]] && asdfInstall rust
|
||||
fi
|
||||
|
||||
echo "-- linking .dotfiles --"
|
||||
|
||||
@ -81,15 +114,6 @@ if [ "$INST_ZSH" = true ]; then
|
||||
echo "-----------------------------------"
|
||||
fi
|
||||
|
||||
if [ "$INST_NVIM" = true ]; then
|
||||
install neovim
|
||||
|
||||
echo "-- Configuring Optixal's Neovim (https://github.com/Optixal/neovim-init.vim) --"
|
||||
|
||||
sh $(pwd)/install/install-config.sh
|
||||
echo "-----------------------------------"
|
||||
fi
|
||||
|
||||
if [ "$INST_ZSH" = true ]; then
|
||||
|
||||
# Change default shell
|
||||
@ -106,4 +130,6 @@ cd ~
|
||||
|
||||
echo "-- ALL DONE --"
|
||||
|
||||
zsh
|
||||
if [ "$INST_ZSH" = true ]; then
|
||||
zsh
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user