- use zsh_unplugged script
- clean .zshrc file
- credit section in readme
This commit is contained in:
Tri Vo Khac committed 2022-10-11 20:07:29 +07:00
1 parent 3a0a4b6800
commit dbb1bee399
5 files changed
+140 -65

No files matched your search

+26 -15
View File
@@ -1,25 +1,36 @@
# My personal dotfiles # My personal dotfiles
## Requirement ## Requirement
- **GNU** `stow`
- **GNU** `stow`
## Installation ## Installation
1. clone repo to your `$HOME` dir 1. clone repo to your `$HOME` dir
```
cd ```
git clone git@github.com:vokhactri/.dotfiles.git cd
``` git clone git@github.com:vokhactri/.dotfiles.git
```
2. go to repo directory that you've cloned 2. go to repo directory that you've cloned
```
cd .dotfiles
```
3. use `stow` to symlink all configs to `$HOME/.config` dir:
- to symlink for config dirs
``` ```
cd .dotfiles stow */
``` ```
2. use `stow` to symlink all configs to `$HOME/.config` dir: - to symlink only one config dir, for example `zsh`
- to symlink for config dirs ```
``` stow zsh
stow */ ```
```
- to symlink only one config dir, for example `zsh`
```
stow zsh
```
## Credit ## Credit
- [Machfiles](https://github.com/ChristianChiarulli/Machfiles/) - [Machfiles](https://github.com/ChristianChiarulli/Machfiles/)
- [zsh_unplugged](https://github.com/mattmc3/zsh_unplugged)
Binary file not shown.
+51
View File
@@ -150,3 +150,54 @@ micro $ZDOTDIR/zsh-functions
micro $ZDOTDIR/zsh-functions micro $ZDOTDIR/zsh-functions
micro $ZDOTDIR/.zshrc micro $ZDOTDIR/.zshrc
micro ~/.config/kitty/kitty.conf micro ~/.config/kitty/kitty.conf
open .
npm run dev -o
ls
micro $ZDOTDIR/zsh-functions
fastfetch -v
mv -v ~/.config/fastfetch ~/.dotfiles/
ls ~/.config
cd ~/.dotfiles
ls
cd fastfetch
ls
mkdir .config
mv config.conf ./.config
ls
ls -a
.config
ls
../../
ls
stow fastfetch
ls ~/.config
rm ~/.config/config.conf
ls
cd fastfetch
ls
cd .config
ls
mkdir fastfetch
mv config.conf ./fastfetch
ls
cd fastfetch
ls
../../
../
ls
stow fastfetch
fastfetch
git status
git status
git add .
git commit -m "chore: add fastfetch and fzf"
git push origin main
micro $ZDOTDIR/zsh-functions
where zsh
ls
fastfetch
plugin-update
zsh-update-plugins
ls $ZPLUGINDIR
plugin-list
plugin-list
+8 -30
View File
@@ -12,7 +12,6 @@ zle_highlight=('paste:none')
# beeping is annoying # beeping is annoying
unsetopt BEEP unsetopt BEEP
# completions # completions
# for brew # for brew
@@ -45,38 +44,17 @@ zsh_add_file "zsh-aliases"
zsh_add_file "zsh-prompt" zsh_add_file "zsh-prompt"
# Plugins # Plugins
zsh_add_plugin "zsh-users/zsh-autosuggestions" repos=(
zsh_add_plugin "zsh-users/zsh-completions" zsh-users/zsh-autosuggestions
zsh_add_plugin "zdharma-continuum/fast-syntax-highlighting" zsh-users/zsh-completions
zsh_add_plugin "hlissner/zsh-autopair" zdharma-continuum/fast-syntax-highlighting
# zsh_add_completion "esc/conda-zsh-completion" false hlissner/zsh-autopair
# For more plugins: https://github.com/unixorn/awesome-zsh-plugins )
# More completions https://github.com/zsh-users/zsh-completions plugin-load $repos
# Key-bindings
# bindkey -s '^o' 'ranger^M'
# bindkey -s '^f' 'zi^M'
# bindkey -s '^s' 'ncdu^M'
# bindkey -s '^n' 'nvim $(fzf)^M'
# bindkey -s '^v' 'nvim\n'
# bindkey -s '^z' 'zi^M'
# bindkey '^[[P' delete-char
# bindkey "^p" up-line-or-beginning-search # Up
# bindkey "^n" down-line-or-beginning-search # Down
# bindkey "^k" up-line-or-beginning-search # Up
# bindkey "^j" down-line-or-beginning-search # Down
# bindkey -r "^u"
# bindkey -r "^d"
# FZF # FZF
# TODO update for mac
# [ -f /usr/share/fzf/completion.zsh ] && source /usr/share/fzf/completion.zsh
# [ -f /usr/share/fzf/key-bindings.zsh ] && source /usr/share/fzf/key-bindings.zsh
# [ -f /usr/share/doc/fzf/examples/completion.zsh ] && source /usr/share/doc/fzf/examples/completion.zsh
# [ -f /usr/share/doc/fzf/examples/key-bindings.zsh ] && source /usr/share/doc/fzf/examples/key-bindings.zsh
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh [ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
# [ -f $ZDOTDIR/completion/_fnm ] && fpath+="$ZDOTDIR/completion/"
# export FZF_DEFAULT_COMMAND='rg --hidden -l ""'
compinit compinit
# Edit line in vim with ctrl-e: # Edit line in vim with ctrl-e:
+55 -20
View File
@@ -1,31 +1,66 @@
# Function to source files if they exist # Function to source files if they exist
function zsh_add_file() { function zsh_add_file() {
[ -f "$ZDOTDIR/$1" ] && source "$ZDOTDIR/$1" [ -f "$ZDOTDIR/$1" ] && source "$ZDOTDIR/$1"
} }
function zsh_add_plugin() { function zsh_add_plugin() {
PLUGIN_NAME=$(echo $1 | cut -d "/" -f 2) PLUGIN_NAME=$(echo $1 | cut -d "/" -f 2)
if [ -d "$ZDOTDIR/plugins/$PLUGIN_NAME" ]; then if [ -d "$ZDOTDIR/plugins/$PLUGIN_NAME" ]; then
# For plugins # For plugins
zsh_add_file "plugins/$PLUGIN_NAME/$PLUGIN_NAME.plugin.zsh" || \ zsh_add_file "plugins/$PLUGIN_NAME/$PLUGIN_NAME.plugin.zsh" || \
zsh_add_file "plugins/$PLUGIN_NAME/$PLUGIN_NAME.zsh" zsh_add_file "plugins/$PLUGIN_NAME/$PLUGIN_NAME.zsh"
else else
git clone "https://github.com/$1.git" "$ZDOTDIR/plugins/$PLUGIN_NAME" git clone "https://github.com/$1.git" "$ZDOTDIR/plugins/$PLUGIN_NAME"
fi fi
} }
function zsh_add_completion() { function zsh_add_completion() {
PLUGIN_NAME=$(echo $1 | cut -d "/" -f 2) PLUGIN_NAME=$(echo $1 | cut -d "/" -f 2)
if [ -d "$ZDOTDIR/plugins/$PLUGIN_NAME" ]; then if [ -d "$ZDOTDIR/plugins/$PLUGIN_NAME" ]; then
# For completions # For completions
completion_file_path=$(ls $ZDOTDIR/plugins/$PLUGIN_NAME/_*) completion_file_path=$(ls $ZDOTDIR/plugins/$PLUGIN_NAME/_*)
fpath+="$(dirname "${completion_file_path}")" fpath+="$(dirname "${completion_file_path}")"
zsh_add_file "plugins/$PLUGIN_NAME/$PLUGIN_NAME.plugin.zsh" zsh_add_file "plugins/$PLUGIN_NAME/$PLUGIN_NAME.plugin.zsh"
else else
git clone "https://github.com/$1.git" "$ZDOTDIR/plugins/$PLUGIN_NAME" git clone "https://github.com/$1.git" "$ZDOTDIR/plugins/$PLUGIN_NAME"
fpath+=$(ls $ZDOTDIR/plugins/$PLUGIN_NAME/_*) fpath+=$(ls $ZDOTDIR/plugins/$PLUGIN_NAME/_*)
[ -f $ZDOTDIR/.zccompdump ] && $ZDOTDIR/.zccompdump [ -f $ZDOTDIR/.zccompdump ] && $ZDOTDIR/.zccompdump
fi fi
completion_file="$(basename "${completion_file_path}")" completion_file="$(basename "${completion_file_path}")"
if [ "$2" = true ] && compinit "${completion_file:1}" if [ "$2" = true ] && compinit "${completion_file:1}"
} }
# https://github.com/mattmc3/zsh_unplugged
function plugin-load {
local repo plugdir initfile
ZPLUGINDIR=${ZPLUGINDIR:-${ZDOTDIR:-$HOME/.config/zsh}/plugins}
for repo in $@; do
plugdir=$ZPLUGINDIR/${repo:t}
initfile=$plugdir/${repo:t}.plugin.zsh
if [[ ! -d $plugdir ]]; then
echo "Cloning $repo..."
git clone -q --depth 1 --recursive --shallow-submodules https://github.com/$repo $plugdir
fi
if [[ ! -e $initfile ]]; then
local -a initfiles=($plugdir/*.plugin.{z,}sh(N) $plugdir/*.{z,}sh{-theme,}(N))
(( $#initfiles )) || { echo >&2 "No init file found '$repo'." && continue }
ln -sf "${initfiles[1]}" "$initfile"
fi
fpath+=$plugdir
(( $+functions[zsh-defer] )) && zsh-defer . $initfile || . $initfile
done
}
function plugin-update {
ZPLUGINDIR=${ZPLUGINDIR:-$HOME/.config/zsh/plugins}
for d in $ZPLUGINDIR/*/.git(/); do
echo "Updating ${d:h:t}..."
command git -C "${d:h}" pull --ff --recurse-submodules --depth 1 --rebase --autostash
done
}
function plugin-list {
for d in $ZPLUGINDIR/*/.git; do
git -C "${d:h}" remote get-url origin
done
}