-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
51 lines (41 loc) · 2.08 KB
/
Makefile
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
# Run this using 'make' to install all dotfiles at once.
#
# This script is idempotent, meaning you can execute it even if you have already
# run it before - it will update some things, but not break.
#
# Use 'stow' directly if you only want to use some specific dotfiles.
STOWS = $(shell ls */ | sed -e 's/\/\://')
PURE_DIR = $(HOME)/.zsh/pure
.PHONY: default nvim stow zsh-plugins allow-remote-clip-locally
default: nvim zsh-plugins
stow:
stow -v -S $(STOWS)
chmod 0600 ../.config/nvim/remote-clip.key
nvim: stow
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
# auto-install and upgrade vim-plug plugins (this sometimes fails, just
# try again if it does...)
nvim -Es -u $(HOME)/.config/nvim/init.vim -c PlugInstall -c PlugUpgrade -c PlugUpdate -c qa
zsh-plugins: stow
zsh ./install-zsh-plugins.zsh
zsh ./upgrade-zsh-plugins.zsh
# install pure theme
mkdir -p $(HOME)/.zsh
[ -d "$(PURE_DIR)" ] || \
git clone https://github.com/sindresorhus/pure.git \
$(PURE_DIR)
cd $(PURE_DIR) && (git status || (git checkout -b $(shell date +"%d-%m-%Y_%H-%M-%S") && \
git commit -a -m "backup-commit")) && \
git checkout main && git reset --hard HEAD && \
git pull --rebase
chmod -R a+rx $(PURE_DIR)
chmod a+rx $(PURE_DIR)
allow-remote-clip-locally:
bash -c '[[ $$(whoami) == "remote-clip-access" ]] || (echo "ERROR: This has to be run as dedicated user remote-clip-access for security reasons!" && exit 1)'
mkdir -p ~/.ssh && umask 0077 && touch ~/.ssh/authorized_keys
grep "remote-clip-access" ~/.ssh/authorized_keys >/dev/null || ( \
echo -n 'command="DISPLAY=:0 /usr/bin/xclip -selection clipboard; echo success",no-port-forwarding,no-x11-forwarding,no-agent-forwarding ' >> ~/.ssh/authorized_keys && \
cat neovim/.config/nvim/remote-clip.key.pub >> ~/.ssh/authorized_keys )
@echo "IMPORTANT: Don't forget to allow this user ($$(whoami)) to access your X session!"
@echo "IMPORTANT: I.e. run 'xhost +SI:localuser:remote-clip-access' as the owner of your session at X startup!"