Compare commits
6 Commits
75d59e3326
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
2ab3ea5482
|
|||
|
42225e6793
|
|||
|
6165841dd9
|
|||
|
37177b0091
|
|||
|
24b072c539
|
|||
|
83bddaa74e
|
1
.gitignore
vendored
1
.gitignore
vendored
@@ -10,3 +10,4 @@ package-lock.json
|
|||||||
/CLAUDE.md
|
/CLAUDE.md
|
||||||
/tmp
|
/tmp
|
||||||
*.swp
|
*.swp
|
||||||
|
.local/bin/claude
|
||||||
|
|||||||
@@ -4,4 +4,4 @@ git add -A
|
|||||||
git commit -m "init"
|
git commit -m "init"
|
||||||
git branch -D main
|
git branch -D main
|
||||||
git branch -m temp main
|
git branch -m temp main
|
||||||
git push -f origin main
|
# git push -f origin main
|
||||||
|
|||||||
@@ -34,9 +34,8 @@ if [ "$old_count" -ne "$new_count" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# diff
|
# diff
|
||||||
changes=0
|
|
||||||
paste "$old" "$new" | while IFS=$'\t' read -r o n; do
|
paste "$old" "$new" | while IFS=$'\t' read -r o n; do
|
||||||
[ "$o" != "$n" ] && echo " $o -> $n" && changes=$((changes+1))
|
[ "$o" != "$n" ] && echo " $o -> $n"
|
||||||
done
|
done
|
||||||
|
|
||||||
if ! diff -q "$old" "$new" >/dev/null 2>&1; then
|
if ! diff -q "$old" "$new" >/dev/null 2>&1; then
|
||||||
@@ -49,7 +48,6 @@ if ! diff -q "$old" "$new" >/dev/null 2>&1; then
|
|||||||
[ "$o" != "$n" ] && mv -- "$o" "$n"
|
[ "$o" != "$n" ] && mv -- "$o" "$n"
|
||||||
done
|
done
|
||||||
echo "done"
|
echo "done"
|
||||||
# restore point
|
|
||||||
if [ "$has_git" -eq 0 ]; then
|
if [ "$has_git" -eq 0 ]; then
|
||||||
git add -A
|
git add -A
|
||||||
git commit -q -m "after rename"
|
git commit -q -m "after rename"
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ get_cfg() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
has_aifont() {
|
has_aifont() {
|
||||||
[ -f "$HOME/Library/Fonts/aifont.ttf" ] || [ -f "$HOME/.local/share/fonts/aifont.ttf" ]
|
[ -f "$HOME/Library/Fonts/aifont.ttf" ] || [ -f "/usr/share/fonts/TTF/aifont.ttf" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
can_run() {
|
can_run() {
|
||||||
|
|||||||
4
.vimrc
4
.vimrc
@@ -33,10 +33,6 @@ inoremap <C-j> <Esc>
|
|||||||
nnoremap Q :q!<CR>
|
nnoremap Q :q!<CR>
|
||||||
vnoremap v V
|
vnoremap v V
|
||||||
|
|
||||||
call plug#begin('~/.vim/plugged')
|
|
||||||
Plug 'github/copilot.vim'
|
|
||||||
call plug#end()
|
|
||||||
|
|
||||||
syntax on
|
syntax on
|
||||||
filetype plugin indent on
|
filetype plugin indent on
|
||||||
au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") | exe "normal! g`\"" | endif
|
au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") | exe "normal! g`\"" | endif
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
# requires: aifont (MesloLGS NF + ai/syui icons)
|
# requires: aifont (MesloLGS NF + ai/syui icons)
|
||||||
|
|
||||||
_has_aifont() {
|
_has_aifont() {
|
||||||
[[ -f "$HOME/Library/Fonts/aifont.ttf" ]] || [[ -f "$HOME/.local/share/fonts/aifont.ttf" ]]
|
[[ -f "$HOME/Library/Fonts/aifont.ttf" ]] || [[ -f "/usr/share/fonts/TTF/aifont.ttf" ]]
|
||||||
}
|
}
|
||||||
|
|
||||||
_powerline_git() {
|
_powerline_git() {
|
||||||
|
|||||||
55
install.zsh
55
install.zsh
@@ -4,8 +4,8 @@
|
|||||||
|
|
||||||
dotdir="${1:-$HOME/dotfiles}"
|
dotdir="${1:-$HOME/dotfiles}"
|
||||||
|
|
||||||
files=(.zshrc .vimrc .tmux.conf .gitconfig .config/karabiner/karabiner.json)
|
files=(.zshrc .vimrc .tmux.conf .config/karabiner/karabiner.json)
|
||||||
dirs=(.zsh .vim/plugin .tmux .local/bin)
|
dirs=(.zsh .vim/plugin .tmux)
|
||||||
|
|
||||||
# backup and symlink files
|
# backup and symlink files
|
||||||
for f in "${files[@]}"; do
|
for f in "${files[@]}"; do
|
||||||
@@ -35,36 +35,53 @@ for d in "${dirs[@]}"; do
|
|||||||
dst="$HOME/$d"
|
dst="$HOME/$d"
|
||||||
fi
|
fi
|
||||||
[ ! -d "$src" ] && continue
|
[ ! -d "$src" ] && continue
|
||||||
if [ -d "$dst" ] && [ ! -L "$dst" ]; then
|
if [ -L "$dst" ]; then
|
||||||
|
rm "$dst"
|
||||||
|
elif [ -d "$dst" ]; then
|
||||||
mv "$dst" "${dst}.bak"
|
mv "$dst" "${dst}.bak"
|
||||||
echo "backup: $dst -> ${dst}.bak"
|
echo "backup: $dst -> ${dst}.bak"
|
||||||
fi
|
fi
|
||||||
ln -sf "$src" "$dst"
|
ln -s "$src" "$dst"
|
||||||
echo "link: $dst -> $src"
|
echo "link: $dst -> $src"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# symlink individual files in .local/bin
|
||||||
|
mkdir -p "$HOME/.local/bin"
|
||||||
|
for f in "$dotdir/.local/bin/"*; do
|
||||||
|
[ ! -f "$f" ] && continue
|
||||||
|
ln -sf "$f" "$HOME/.local/bin/$(basename "$f")"
|
||||||
|
echo "link: ~/.local/bin/$(basename "$f")"
|
||||||
|
done
|
||||||
|
|
||||||
# create vim undo dir
|
# create vim undo dir
|
||||||
mkdir -p "$HOME/.vim/undo"
|
mkdir -p "$HOME/.vim/undo"
|
||||||
|
|
||||||
# install vim-plug
|
# install copilot.vim
|
||||||
if [ ! -f "$HOME/.vim/autoload/plug.vim" ]; then
|
copilot_dir="$HOME/.vim/pack/github/start/copilot.vim"
|
||||||
curl -fLo "$HOME/.vim/autoload/plug.vim" --create-dirs \
|
if [ ! -d "$copilot_dir" ]; then
|
||||||
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
|
git clone https://github.com/github/copilot.vim.git "$copilot_dir" 2>/dev/null
|
||||||
echo "vim-plug: installed"
|
echo "copilot.vim: installed"
|
||||||
vim +PlugInstall +qall 2>/dev/null
|
|
||||||
echo "vim plugins: installed"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# install font
|
# install font
|
||||||
fontpath="$HOME/.local/share/fonts/aifont.ttf"
|
fonturl="https://git.syui.ai/ai/font/raw/branch/main/aifont.ttf"
|
||||||
|
case "$(uname)" in
|
||||||
|
Darwin)
|
||||||
|
fontpath="$HOME/Library/Fonts/aifont.ttf"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
fontpath="/usr/share/fonts/TTF/aifont.ttf"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
if [ ! -f "$fontpath" ]; then
|
if [ ! -f "$fontpath" ]; then
|
||||||
mkdir -p "$HOME/.local/share/fonts"
|
mkdir -p "$(dirname "$fontpath")"
|
||||||
curl -sL -o "$fontpath" https://git.syui.ai/ai/font/raw/branch/main/aifont.ttf
|
if [ "$(uname)" = "Darwin" ]; then
|
||||||
echo "font: downloaded aifont.ttf"
|
curl -sL -o "$fontpath" "$fonturl"
|
||||||
fi
|
else
|
||||||
if [ "$(uname)" = "Darwin" ] && [ -f "$fontpath" ]; then
|
sudo curl -sL -o "$fontpath" "$fonturl"
|
||||||
cp -f "$fontpath" ~/Library/Fonts/aifont.ttf
|
fc-cache -f 2>/dev/null
|
||||||
echo "font: aifont.ttf -> ~/Library/Fonts/"
|
fi
|
||||||
|
echo "font: $fontpath"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "done"
|
echo "done"
|
||||||
|
|||||||
Reference in New Issue
Block a user