From 4e5e48c64a9924a9843561b8f145aa9819dbd8e4 Mon Sep 17 00:00:00 2001 From: Andrew Tomaka Date: Thu, 13 May 2021 09:35:10 -0400 Subject: [PATCH] Use GNU stow to manage symlinks --- .gitignore | 2 -- .gitmodules | 0 Makefile | 26 +++---------------- README.md | 6 ++--- bin/{ => bin}/, | 0 .../.gitattributes_global | 0 gitconfig => git/.gitconfig | 0 gitignore_global => git/.gitignore_global | 0 nvim/{ => .config}/init.vim | 0 gemrc => ruby/.gemrc | 0 tmux.conf => tmux/.tmux.conf | 0 vimrc => vim/.vimrc | 0 aliases => zsh/.aliases | 0 aliases-mac => zsh/.aliases-mac | 0 functions => zsh/.functions | 0 .../.zsh-completions}/_comma | 0 zsh/{ => .zsh}/prompt | 0 zshenv => zsh/.zshenv | 0 zshrc => zsh/.zshrc | 9 +++++-- 19 files changed, 13 insertions(+), 30 deletions(-) delete mode 100644 .gitignore delete mode 100644 .gitmodules rename bin/{ => bin}/, (100%) rename gitattributes_global => git/.gitattributes_global (100%) rename gitconfig => git/.gitconfig (100%) rename gitignore_global => git/.gitignore_global (100%) rename nvim/{ => .config}/init.vim (100%) rename gemrc => ruby/.gemrc (100%) rename tmux.conf => tmux/.tmux.conf (100%) rename vimrc => vim/.vimrc (100%) rename aliases => zsh/.aliases (100%) rename aliases-mac => zsh/.aliases-mac (100%) rename functions => zsh/.functions (100%) rename {zsh-completions => zsh/.zsh-completions}/_comma (100%) rename zsh/{ => .zsh}/prompt (100%) rename zshenv => zsh/.zshenv (100%) rename zshrc => zsh/.zshrc (90%) diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 15de6fb..0000000 --- a/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -oh-my-zsh/ -vim/ diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index e69de29..0000000 diff --git a/Makefile b/Makefile index 7809810..7e5e4b6 100644 --- a/Makefile +++ b/Makefile @@ -1,19 +1,7 @@ -excludes = -I Makefile -I README.md -symlinks = $(shell find . -maxdepth 1 \( ! -iname "Makefile" ! -iname "README.md" ! -iname ".*" ! -name "bin" ! -iname "nvim" \) | sed 's|./||') - -.PHONY: $(symlinks) nvim - all: install -install: install-bin plug-vim $(symlinks) - -install-bin: - mkdir -p $$HOME/bin - cp bin/* $$HOME/bin - -nvim: - mkdir -p ~/.config/nvim - cp nvim/init.vim ~/.config/nvim/ +install: plug-vim + stow bin git nvim ruby tmux vim zsh plug-vim: if test ! -f ~/.vim/autoload/plug.vim ; then \ @@ -33,15 +21,7 @@ rbenv-build: git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build ; \ fi -$(symlinks): - test -e `pwd`/$@ \ - && ln -sfn `pwd`/$@ ~/.$@ - -update: update-repo $(symlinks) +update: update-repo update-repo: git pull --rebase - git submodule update - -clean: - for file in $(symlinks); do rm ~/.$$file; done diff --git a/README.md b/README.md index ee13f28..c44b6aa 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,7 @@ ## Dependencies +* [stow](https://www.gnu.org/software/stow/) * [tmux](https://github.com/tmux/tmux) * [zsh](https://github.com/zsh-users/zsh) * [neovim](https://github.com/neovim/neovim) @@ -14,12 +15,11 @@ * Install dependencies * Clone this repository * Run `make` - * Will symlink files into parent - * Will overwrite existing files + * Uses GNU stow to generate symlinks + * Config files must already exist * Install vim plugins ``` -make nvim nvim ,pi ``` diff --git a/bin/, b/bin/bin/, similarity index 100% rename from bin/, rename to bin/bin/, diff --git a/gitattributes_global b/git/.gitattributes_global similarity index 100% rename from gitattributes_global rename to git/.gitattributes_global diff --git a/gitconfig b/git/.gitconfig similarity index 100% rename from gitconfig rename to git/.gitconfig diff --git a/gitignore_global b/git/.gitignore_global similarity index 100% rename from gitignore_global rename to git/.gitignore_global diff --git a/nvim/init.vim b/nvim/.config/init.vim similarity index 100% rename from nvim/init.vim rename to nvim/.config/init.vim diff --git a/gemrc b/ruby/.gemrc similarity index 100% rename from gemrc rename to ruby/.gemrc diff --git a/tmux.conf b/tmux/.tmux.conf similarity index 100% rename from tmux.conf rename to tmux/.tmux.conf diff --git a/vimrc b/vim/.vimrc similarity index 100% rename from vimrc rename to vim/.vimrc diff --git a/aliases b/zsh/.aliases similarity index 100% rename from aliases rename to zsh/.aliases diff --git a/aliases-mac b/zsh/.aliases-mac similarity index 100% rename from aliases-mac rename to zsh/.aliases-mac diff --git a/functions b/zsh/.functions similarity index 100% rename from functions rename to zsh/.functions diff --git a/zsh-completions/_comma b/zsh/.zsh-completions/_comma similarity index 100% rename from zsh-completions/_comma rename to zsh/.zsh-completions/_comma diff --git a/zsh/prompt b/zsh/.zsh/prompt similarity index 100% rename from zsh/prompt rename to zsh/.zsh/prompt diff --git a/zshenv b/zsh/.zshenv similarity index 100% rename from zshenv rename to zsh/.zshenv diff --git a/zshrc b/zsh/.zshrc similarity index 90% rename from zshrc rename to zsh/.zshrc index a4402e0..5124a1b 100644 --- a/zshrc +++ b/zsh/.zshrc @@ -36,13 +36,18 @@ if which rbenv > /dev/null; then (rbenv rehash &) 2> /dev/null fi -# init nodenv +# # init nodenv if which nodenv > /dev/null; then eval "$(nodenv init --no-rehash -)" (nodenv rehash &) 2> /dev/null fi -# init direnv +if [ -d $HOME/.asdf ]; then + source $HOME/.asdf/asdf.sh +fi +. ~/.asdf/plugins/java/set-java-home.zsh + +# init direnv if which direnv > /dev/null; then eval "$(direnv hook zsh)" fi