From 4508ba6353de9df44bc5103059d3d6e26c8c0c30 Mon Sep 17 00:00:00 2001 From: Ivan Bushchik Date: Mon, 4 Jul 2022 16:06:23 +0300 Subject: [PATCH] Clean commit tree --- README.md | 15 +++++++++++++++ init | 9 +++++++++ nvim.vim | 17 +++++++++++++++++ tools/install.sh | 35 +++++++++++++++++++++++++++++++++++ tools/relink.sh | 14 ++++++++++++++ tools/upgrade.sh | 16 ++++++++++++++++ zshrc | 9 +++++++++ 7 files changed, 115 insertions(+) create mode 100644 README.md create mode 100644 init create mode 100644 nvim.vim create mode 100644 tools/install.sh create mode 100644 tools/relink.sh create mode 100644 tools/upgrade.sh create mode 100644 zshrc diff --git a/README.md b/README.md new file mode 100644 index 0000000..749e6d3 --- /dev/null +++ b/README.md @@ -0,0 +1,15 @@ +# ivabus-dotfiles + +## Default dotfiles installation + +- zshrc (oh-my-zsh + autosuggestion + syntax highlighting) ([oh-my-zsh](https://ohmyz.sh) + [zsh-users/zsh-autosuggestions](https://github.com/zsh-users/zsh-autosuggestions/) + [zsh-users/zsh-syntax-highlighting](https://github.com/zsh-users/zsh-syntax-highlighting)) +- [ivabus-zsh-theme](https://github.com/ivabus/ivabus-zsh-theme) +- nvim config + +```sh +sh -c "$(curl -fsSL https://ivabus.dev/dotfiles)" +``` + +### Upgrading dotfiles + +Just run `upgrade_dotfiles` in your shell. Script will `git pull`, then relink old dotfiles, link new if needed and upgrade oh-my-zsh. diff --git a/init b/init new file mode 100644 index 0000000..ba45531 --- /dev/null +++ b/init @@ -0,0 +1,9 @@ +#!/bin/sh + +if ! command -v git &> /dev/null +then + echo "git should be installed" + exit 255 +fi +git clone https://github.com/ivabus/ivabus-dotfiles $HOME/.dotfiles +sh $HOME/.dotfiles/tools/install.sh diff --git a/nvim.vim b/nvim.vim new file mode 100644 index 0000000..054bb49 --- /dev/null +++ b/nvim.vim @@ -0,0 +1,17 @@ +filetype plugin indent on +set showmatch +set hlsearch +set incsearch +set autoindent +set noexpandtab +set tabstop=4 +set shiftwidth=4 +set number +set wildmode=longest, list +set cc=80 +syntax on +set noswapfile +set backupdir=~/.cache/vim +set completeopt=noinsert,menuone,noselect +set cursorline +set relativenumber diff --git a/tools/install.sh b/tools/install.sh new file mode 100644 index 0000000..8f3a6ce --- /dev/null +++ b/tools/install.sh @@ -0,0 +1,35 @@ +#!/bin/sh + +CURRENTDIR="$(pwd)" +GREEN="\033[32m" +RED="\033[31m" +DEFAULTC="\033[0m" + +echo "${GREEN}Welcome to ivabus .dotfiles installer$DEFAULT" +echo "Dotfiles will be installed to $HOME/.dotfiles" +echo "Press enter to continue" +read A + +# check for zsh + +if ! command -v zsh > /dev/null +then + echo "zsh is not installed" + echo "${RED}Aborting.$DEFAULTC" + exit 255 +fi + +# install oh-my-zsh and plugins + +ZSH="$HOME/.dotfiles/oh-my-zsh" sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended > /dev/null +curl -fsSL https://raw.githubusercontent.com/ivabus/ivabus-zsh-theme/master/ivabus.zsh-theme -o $HOME/.dotfiles/oh-my-zsh/custom/themes/ivabus.zsh-theme > /dev/null +git clone https://github.com/zsh-users/zsh-syntax-highlighting.git $HOME/.dotfiles/oh-my-zsh/custom/plugins/zsh-syntax-highlighting > /dev/null +git clone https://github.com/zsh-users/zsh-autosuggestions $HOME/.dotfiles/oh-my-zsh/custom/plugins/zsh-autosuggestions > /dev/null + +# linking dotfiles to their original locations + +sh $HOME/.dotfiles/tools/relink.sh + +cd $CURRENTDIR + +echo "${GREEN}Dotfiles installed and linked.$DEFAULTC" diff --git a/tools/relink.sh b/tools/relink.sh new file mode 100644 index 0000000..26561c1 --- /dev/null +++ b/tools/relink.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +# script that (re)links all dotfiles during the installation or upgrade. +# do not run manually + +GREEN="\033[32m" +DEFAULTC="\033[0m" + +mkdir -p $HOME/.config/nvim >/dev/null 2>&1 +rm $HOME/.zshrc $HOME/.config/nvim/init.vim >/dev/null 2>&1 +ln -s $HOME/.dotfiles/zshrc $HOME/.zshrc +echo "${GREEN}.zshrc linked: $DEFAULTC$HOME/.dotfiles/zshrc $GREEN-> $DEFAULTC$HOME/.zshrc" +ln -s $HOME/.dotfiles/nvim.vim $HOME/.config/nvim/init.vim +echo "${GREEN}neovim config linked: $DEFAULTC$HOME/.dotfiles/nvim.vim $GREEN-> $DEFAULTC$HOME/.config/nvim/init.vim" diff --git a/tools/upgrade.sh b/tools/upgrade.sh new file mode 100644 index 0000000..fdc0fd5 --- /dev/null +++ b/tools/upgrade.sh @@ -0,0 +1,16 @@ +#!/bin/sh + +# Dotfiles upgrade script that just pulls new dotfiles from repo +# oh-my-zsh update included! + +CURRENTDIR="$(pwd)" +GREEN="\033[32m" +DEFAULTC="\033[0m" + +cd $HOME/.dotfiles +echo "${GREEN}Upgrading dotfiles$DEFAULTC" +git pull +sh tools/relink.sh +echo "${GREEN}Upgrading oh-my-zsh$DEFAULTC" +zsh -c "source $ZSH/oh-my-zsh.sh && omz update" > /dev/null +cd $CURRENTDIR \ No newline at end of file diff --git a/zshrc b/zshrc new file mode 100644 index 0000000..fbb1ff2 --- /dev/null +++ b/zshrc @@ -0,0 +1,9 @@ +export ZSH="$HOME/.dotfiles/oh-my-zsh" + +ZSH_THEME="ivabus" + +plugins=(git zsh-syntax-highlighting zsh-autosuggestions) + +alias upgrade_dotfiles="sh $HOME/.dotfiles/tools/upgrade.sh" + +source $ZSH/oh-my-zsh.sh