From d3915d64e3a3c8ad3c3790e3951ff78f4fab2af6 Mon Sep 17 00:00:00 2001 From: Petr Nyc Date: Fri, 8 Nov 2024 14:30:33 +0100 Subject: [PATCH 1/6] bootstrap script take 1 --- .vimrc | 6 ++++- README.org | 7 +++-- bootstrap.sh | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 82 insertions(+), 3 deletions(-) create mode 100755 bootstrap.sh diff --git a/.vimrc b/.vimrc index 79ea257..c2cf436 100644 --- a/.vimrc +++ b/.vimrc @@ -109,7 +109,11 @@ endif set termguicolors set background=dark " or light " colorscheme solarized -colorscheme darcula + +" Check if the color scheme file is available before applying it +if exists("g:plugs['darcula']") && filereadable(expand("~/.vim/plugged/darcula/colors/darcula.vim")) + colorscheme darcula +endif hi Visual term=reverse cterm=reverse guibg=Grey diff --git a/README.org b/README.org index 6c5e214..2fef007 100644 --- a/README.org +++ b/README.org @@ -14,14 +14,17 @@ alias config='/usr/bin/git --git-dir=$HOME/.cfg/ --work-tree=$HOME' config config --local status.showUntrackedFiles no config checkout - zsh source ~/.proxies - sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" + sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh) --unattended --skip-chsh --keep-zshrc" git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim + vim +PlugInstall +qall + + zsh + # run tmux, prefix + I installs all plugins (needs to have proxies set) # run vim, :PlugInstall diff --git a/bootstrap.sh b/bootstrap.sh new file mode 100755 index 0000000..33af070 --- /dev/null +++ b/bootstrap.sh @@ -0,0 +1,72 @@ +#!/usr/bin/env bash + +check_installed() { + packages=("$@") + all_installed=true + for pkg in "${packages[@]}"; do + if ! command -v "$pkg" > /dev/null 2>&1; then + all_installed=false + break + fi + done + $all_installed && return 0 || return 1 +} + + + +install_packages() { + # List of packages to install + packages="zsh git" + + if [ ! check_installed zsh tmux git ]; then + # Determine which package manager is available + if check_installed apt; then + echo "Using apt to install packages..." + sudo apt update + sudo apt install -y $packages + elif check_installed dnf; then + echo "Using dnf to install packages..." + sudo dnf install -y $packages + elif check_installed yum; then + echo "Using yum to install packages..." + sudo yum install -y $packages + elif check_installed brew; then + echo "Using Homebrew to install packages..." + brew install $packages + else + echo "No supported package manager found (apt, dnf, yum, brew)." + return 1 + fi + fi +} + +clone_repos () { + git clone --bare https://git.meinlschmidt.org/jetpac/dotfiles.git ~/.cfg + cd ~/.cfg + git config --local status.showUntrackedFiles no + git checkout + + sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh) --unattended --skip-chsh --keep-zshrc" + git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k + git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm + curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim +} + +configure_vim() { + vim +PlugInstall +qall +} + +configure_tmux() { + echo "run tmux, prefix + I installs all plugins (needs to have proxies set)" +} + + +# Call the function to execute the installation +install_packages +clone_repos +configure_vim +configure_tmux + + + +# vim: foldmethod=marker:foldmarker={,}:expandtab:sw=4:ts=4: From a7111acdc2eaad99d3f872aa8875f6d6ff3a3703 Mon Sep 17 00:00:00 2001 From: Petr Nyc Date: Fri, 8 Nov 2024 14:38:12 +0100 Subject: [PATCH 2/6] path for config --- .zshenv | 2 +- README.org | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.zshenv b/.zshenv index d083de0..5f8043f 100644 --- a/.zshenv +++ b/.zshenv @@ -6,7 +6,7 @@ export PATH=/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/bin:/bin:/u alias oe='open /Applications/Emacs.app' -alias config='/usr/bin/git --git-dir=$HOME/.cfg/.git/ --work-tree=$HOME' +alias config='/usr/bin/git --git-dir=$HOME/.cfg/ --work-tree=$HOME' alias -g N="2>&1 " alias pig='ping' # export PATH=$HOME/.rd/bin diff --git a/README.org b/README.org index 2fef007..0229df6 100644 --- a/README.org +++ b/README.org @@ -1,6 +1,12 @@ * How to set up this configuration -** basic setup +** Automated setup + +#+begin_src sh + sh -c "$(curl -fsSL https://git.meinlschmidt.org/jetpac/dotfiles/raw/branch/main/bootstrap.sh)" +#+end_src + +** manual setup #+begin_src sh # for linux; ignore on other systems From 64b1207b538a83ca742ec18bb58b1a9d3b1a1bb7 Mon Sep 17 00:00:00 2001 From: Petr Nyc Date: Fri, 8 Nov 2024 15:16:55 +0100 Subject: [PATCH 3/6] bootstrap.sh --- bootstrap.sh | 36 ++++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/bootstrap.sh b/bootstrap.sh index 33af070..5cd2df9 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -1,9 +1,11 @@ #!/usr/bin/env bash +set -x + check_installed() { - packages=("$@") + _pkgs=("$@") all_installed=true - for pkg in "${packages[@]}"; do + for pkg in "${_pkgs[@]}"; do if ! command -v "$pkg" > /dev/null 2>&1; then all_installed=false break @@ -12,27 +14,25 @@ check_installed() { $all_installed && return 0 || return 1 } - - install_packages() { # List of packages to install - packages="zsh git" + packages=(zsh git) - if [ ! check_installed zsh tmux git ]; then + if ! check_installed "${packages[@]}"; then # Determine which package manager is available if check_installed apt; then echo "Using apt to install packages..." sudo apt update - sudo apt install -y $packages + sudo apt install -y "${packages[@]}" elif check_installed dnf; then echo "Using dnf to install packages..." - sudo dnf install -y $packages + sudo dnf install -y "${packages[@]}" elif check_installed yum; then echo "Using yum to install packages..." - sudo yum install -y $packages + sudo yum install -y "${packages[@]}" elif check_installed brew; then echo "Using Homebrew to install packages..." - brew install $packages + brew install "${packages[@]}" else echo "No supported package manager found (apt, dnf, yum, brew)." return 1 @@ -43,12 +43,24 @@ install_packages() { clone_repos () { git clone --bare https://git.meinlschmidt.org/jetpac/dotfiles.git ~/.cfg cd ~/.cfg + # alias config='/usr/bin/git --git-dir=$HOME/.cfg/ --work-tree=$HOME' git config --local status.showUntrackedFiles no - git checkout + cd $HOME + rm .zshrc + git checkout --git-dir=$HOME/.cfg --work-tree=$HOME + - sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh) --unattended --skip-chsh --keep-zshrc" + # install oh-my-zsh + curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh > /tmp/install_ohmyzsh.sh + bash /tmp/install_ohmyzsh.sh --unattended --skip-chsh --keep-zshrc + + # powerlevel10k git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k + + # tmux tpm plugin manager git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm + + # plug for installing vim plugins curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim } From 43d96a7a3d930558a6850fc18bbdc2fcf117da0d Mon Sep 17 00:00:00 2001 From: Petr Nyc Date: Fri, 8 Nov 2024 15:59:26 +0100 Subject: [PATCH 4/6] bootstrap take 2 --- bootstrap.sh | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/bootstrap.sh b/bootstrap.sh index 5cd2df9..9606cfe 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -42,12 +42,9 @@ install_packages() { clone_repos () { git clone --bare https://git.meinlschmidt.org/jetpac/dotfiles.git ~/.cfg - cd ~/.cfg # alias config='/usr/bin/git --git-dir=$HOME/.cfg/ --work-tree=$HOME' - git config --local status.showUntrackedFiles no - cd $HOME - rm .zshrc - git checkout --git-dir=$HOME/.cfg --work-tree=$HOME + git --git-dir=$HOME/.cfg config --local status.showUntrackedFiles no + git --git-dir=$HOME/.cfg --work-tree=$HOME checkout # install oh-my-zsh From 48dfbaa8aecd3c3b5404395841b98969e6f989f8 Mon Sep 17 00:00:00 2001 From: Petr Nyc Date: Fri, 8 Nov 2024 16:03:51 +0100 Subject: [PATCH 5/6] next --- README.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.org b/README.org index 0229df6..45eed41 100644 --- a/README.org +++ b/README.org @@ -3,7 +3,7 @@ ** Automated setup #+begin_src sh - sh -c "$(curl -fsSL https://git.meinlschmidt.org/jetpac/dotfiles/raw/branch/main/bootstrap.sh)" + bash -c "$(curl -fsSL https://git.meinlschmidt.org/jetpac/dotfiles/raw/branch/main/bootstrap.sh)" #+end_src ** manual setup From 5f287688d6aa74f0a4e0a3b1ad0a145f3e332896 Mon Sep 17 00:00:00 2001 From: Petr Nyc Date: Tue, 12 Nov 2024 15:32:59 +0100 Subject: [PATCH 6/6] added kubectl and helm plugins for oh-my-zsh --- .zshrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.zshrc b/.zshrc index 166be50..91ac712 100644 --- a/.zshrc +++ b/.zshrc @@ -85,7 +85,7 @@ ZSH_THEME="powerlevel10k/powerlevel10k" # Custom plugins may be added to $ZSH_CUSTOM/plugins/ # Example format: plugins=(rails git textmate ruby lighthouse) # Add wisely, as too many plugins slow down shell startup. -plugins=(git rsync colorize colored-man-pages vi-mode common-aliases macos themes dircycle iterm2 docker docker-compose zsh-navigation-tools urltools history mercurial tmux ) +plugins=(git rsync colorize colored-man-pages vi-mode common-aliases macos themes dircycle iterm2 docker docker-compose zsh-navigation-tools urltools history mercurial tmux kubectl helm) # colorize - adds ccat and cless # common-aliases: https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/common-aliases # themes: https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/themes