Compare commits
3 Commits
main
...
7c7ed33aff
| Author | SHA1 | Date | |
|---|---|---|---|
|
7c7ed33aff
|
|||
|
2f1af598cc
|
|||
|
83e013310e
|
@@ -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,8 +34,9 @@ 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"
|
[ "$o" != "$n" ] && echo " $o -> $n" && changes=$((changes+1))
|
||||||
done
|
done
|
||||||
|
|
||||||
if ! diff -q "$old" "$new" >/dev/null 2>&1; then
|
if ! diff -q "$old" "$new" >/dev/null 2>&1; then
|
||||||
@@ -48,6 +49,7 @@ 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"
|
||||||
|
|||||||
1
.tmux/.tmux
Symbolic link
1
.tmux/.tmux
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
/Users/syui/dotfiles/.tmux
|
||||||
@@ -23,7 +23,7 @@ get_cfg() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
has_aifont() {
|
has_aifont() {
|
||||||
[ -f "$HOME/Library/Fonts/aifont.ttf" ] || [ -f "/usr/share/fonts/TTF/aifont.ttf" ]
|
[ -f "$HOME/Library/Fonts/aifont.ttf" ] || [ -f "$HOME/.local/share/fonts/aifont.ttf" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
can_run() {
|
can_run() {
|
||||||
|
|||||||
1
.vim/plugin/plugin
Symbolic link
1
.vim/plugin/plugin
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
/Users/syui/dotfiles/.vim/plugin
|
||||||
4
.vimrc
4
.vimrc
@@ -33,6 +33,10 @@ 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 "/usr/share/fonts/TTF/aifont.ttf" ]]
|
[[ -f "$HOME/Library/Fonts/aifont.ttf" ]] || [[ -f "$HOME/.local/share/fonts/aifont.ttf" ]]
|
||||||
}
|
}
|
||||||
|
|
||||||
_powerline_git() {
|
_powerline_git() {
|
||||||
|
|||||||
53
install.zsh
53
install.zsh
@@ -4,8 +4,8 @@
|
|||||||
|
|
||||||
dotdir="${1:-$HOME/dotfiles}"
|
dotdir="${1:-$HOME/dotfiles}"
|
||||||
|
|
||||||
files=(.zshrc .vimrc .tmux.conf .config/karabiner/karabiner.json)
|
files=(.zshrc .vimrc .tmux.conf .gitconfig .config/karabiner/karabiner.json)
|
||||||
dirs=(.zsh .vim/plugin .tmux)
|
dirs=(.zsh .vim/plugin .tmux .local/bin)
|
||||||
|
|
||||||
# backup and symlink files
|
# backup and symlink files
|
||||||
for f in "${files[@]}"; do
|
for f in "${files[@]}"; do
|
||||||
@@ -35,53 +35,36 @@ for d in "${dirs[@]}"; do
|
|||||||
dst="$HOME/$d"
|
dst="$HOME/$d"
|
||||||
fi
|
fi
|
||||||
[ ! -d "$src" ] && continue
|
[ ! -d "$src" ] && continue
|
||||||
if [ -L "$dst" ]; then
|
if [ -d "$dst" ] && [ ! -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 -s "$src" "$dst"
|
ln -sf "$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 copilot.vim
|
# install vim-plug
|
||||||
copilot_dir="$HOME/.vim/pack/github/start/copilot.vim"
|
if [ ! -f "$HOME/.vim/autoload/plug.vim" ]; then
|
||||||
if [ ! -d "$copilot_dir" ]; then
|
curl -fLo "$HOME/.vim/autoload/plug.vim" --create-dirs \
|
||||||
git clone https://github.com/github/copilot.vim.git "$copilot_dir" 2>/dev/null
|
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
|
||||||
echo "copilot.vim: installed"
|
echo "vim-plug: installed"
|
||||||
|
vim +PlugInstall +qall 2>/dev/null
|
||||||
|
echo "vim plugins: installed"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# install font
|
# install font
|
||||||
fonturl="https://git.syui.ai/ai/font/raw/branch/main/aifont.ttf"
|
fontpath="$HOME/.local/share/fonts/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 "$(dirname "$fontpath")"
|
mkdir -p "$HOME/.local/share/fonts"
|
||||||
if [ "$(uname)" = "Darwin" ]; then
|
curl -sL -o "$fontpath" https://git.syui.ai/ai/font/raw/branch/main/aifont.ttf
|
||||||
curl -sL -o "$fontpath" "$fonturl"
|
echo "font: downloaded aifont.ttf"
|
||||||
else
|
|
||||||
sudo curl -sL -o "$fontpath" "$fonturl"
|
|
||||||
fc-cache -f 2>/dev/null
|
|
||||||
fi
|
fi
|
||||||
echo "font: $fontpath"
|
if [ "$(uname)" = "Darwin" ] && [ -f "$fontpath" ]; then
|
||||||
|
cp -f "$fontpath" ~/Library/Fonts/aifont.ttf
|
||||||
|
echo "font: aifont.ttf -> ~/Library/Fonts/"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "done"
|
echo "done"
|
||||||
|
|||||||
Reference in New Issue
Block a user