updated folder organization
This commit is contained in:
parent
5acb272342
commit
15cf525fbf
36 changed files with 121 additions and 35 deletions
6
cfg/dotbot/cfg
Normal file
6
cfg/dotbot/cfg
Normal file
|
@ -0,0 +1,6 @@
|
|||
- clean: ['~']
|
||||
|
||||
- link:
|
||||
~/.gitconfig: cfg/git/cfg
|
||||
~/.zshrc: cfg/zsh/cfg.zsh
|
||||
~/.ssh/config: cfg/ssh/cfg
|
|
@ -4,4 +4,4 @@ alias mv='mv -i'
|
|||
alias la='ls -lAh'
|
||||
clearall () { clear; printf '\033[3J' }
|
||||
|
||||
for file in ${DOTCONFD}/aliases/*.zsh; do source $file; done
|
||||
for file in ${DOTCFGD}/aliases/*.zsh; do source $file; done
|
1
cfg/zsh/cfg.d/02-functions.zsh
Normal file
1
cfg/zsh/cfg.d/02-functions.zsh
Normal file
|
@ -0,0 +1 @@
|
|||
for file in ${DOTCFGD}/functions/*.zsh; do source $file; done
|
3
cfg/zsh/cfg.d/aliases/os.zsh
Normal file
3
cfg/zsh/cfg.d/aliases/os.zsh
Normal file
|
@ -0,0 +1,3 @@
|
|||
# Aliases for OS
|
||||
if type pacman &>/dev/null; then source ${DOTCFGD}/aliases/os/archlinux.zsh; fi
|
||||
if type apt-get &>/dev/null; then source ${DOTCFGD}/aliases/os/debian.zsh; fi
|
19
cfg/zsh/cfg.d/export
Normal file
19
cfg/zsh/cfg.d/export
Normal file
|
@ -0,0 +1,19 @@
|
|||
# For Dotfiles
|
||||
export DOTFLS="${HOME}/dotfiles"
|
||||
export DOTLIB="${DOTFLS}/lib"
|
||||
export DOTBIN="${DOTFLS}/bin"
|
||||
export DOTCFG="${DOTFLS}/cfg"
|
||||
export DOTCFGD="${DOTCFG}/zsh/cfg.d"
|
||||
|
||||
# Path
|
||||
path+=(${DOTBIN})
|
||||
path+=(/opt/android-sdk/build-tools/26.0.1)
|
||||
path+=(${HOME}/.gem/2.4.0/bin)
|
||||
export PATH
|
||||
|
||||
# Editor Setting
|
||||
export EDITOR='vim'
|
||||
|
||||
# Completions Paths
|
||||
fpath+=(${DOTLIB}/completions/src)
|
||||
fpath+=(${DOTLIB}/local)
|
1
cfg/zsh/cfg.d/functions/dircolors.zsh
Normal file
1
cfg/zsh/cfg.d/functions/dircolors.zsh
Normal file
|
@ -0,0 +1 @@
|
|||
eval `dircolors ${DOTCFG}/dir/cfg`
|
|
@ -38,7 +38,7 @@ if which tmux &> /dev/null
|
|||
|
||||
|
||||
# Get the absolute path to the current directory
|
||||
local zsh_tmux_plugin_path=${DOTCONF}/tmux
|
||||
local zsh_tmux_plugin_path=${DOTCFG}/tmux
|
||||
|
||||
# Determine if the terminal supports 256 colors
|
||||
if [[ `tput colors` == "256" ]]
|
81
cfg/zsh/cfg.d/functions/up.zsh
Normal file
81
cfg/zsh/cfg.d/functions/up.zsh
Normal file
|
@ -0,0 +1,81 @@
|
|||
__updir() {
|
||||
if [[ "$1" == "/" || -z "$1" || -z "$2" ]]; then
|
||||
return
|
||||
fi
|
||||
|
||||
local p="$(dirname $1)"
|
||||
local a="$(basename $p)"
|
||||
local b="$(basename $2)"
|
||||
|
||||
if [[ -z "$a" || -z "$b" ]]; then
|
||||
return
|
||||
fi
|
||||
|
||||
if [[ "$a" == "$b"* ]]; then
|
||||
echo "$p"
|
||||
return
|
||||
fi
|
||||
|
||||
__updir "$p" "$2"
|
||||
}
|
||||
|
||||
__upnum() {
|
||||
if [[ -z "$1" || -z "$2" || ! "$2" =~ ^[0-9]+$ ]]; then
|
||||
return
|
||||
fi
|
||||
|
||||
local p="$1"
|
||||
local i="$2"
|
||||
|
||||
while (( i-- )); do
|
||||
p="$(dirname $p)"
|
||||
done
|
||||
|
||||
echo "$p"
|
||||
}
|
||||
|
||||
_up() {
|
||||
local p="$(dirname $PWD)"
|
||||
local w="${COMP_WORDS[COMP_CWORD]}"
|
||||
|
||||
COMPREPLY=( $(IFS=';' compgen -S/ -W "${p//\//;}" -- "$w") )
|
||||
}
|
||||
|
||||
up() {
|
||||
# up one
|
||||
if (( ! $# )); then
|
||||
cd ..
|
||||
return
|
||||
fi
|
||||
|
||||
# up dir
|
||||
local d="$(__updir "$PWD" "$1")"
|
||||
|
||||
if [[ -d "$d" ]]; then
|
||||
cd "$d"
|
||||
return
|
||||
fi
|
||||
|
||||
# up num
|
||||
local n="$(__upnum "$PWD" "$1")"
|
||||
|
||||
if [[ -d "$n" ]]; then
|
||||
cd "$n"
|
||||
return
|
||||
fi
|
||||
|
||||
# fallback
|
||||
if [[ $1 == - || -d $1 ]]; then
|
||||
cd $1
|
||||
return
|
||||
fi
|
||||
|
||||
# usage
|
||||
echo -e "usage: up [dir|num|-]\npwd: $PWD"
|
||||
}
|
||||
|
||||
|
||||
autoload -U +X bashcompinit && bashcompinit
|
||||
|
||||
# tab-completion
|
||||
complete -o nospace -F _up up
|
7
cfg/zsh/cfg.zsh
Normal file
7
cfg/zsh/cfg.zsh
Normal file
|
@ -0,0 +1,7 @@
|
|||
# Source all files
|
||||
source ${HOME}/dotfiles/cfg/zsh/cfg.d/export
|
||||
for file in ${DOTCFGD}/*.zsh; do source $file; done
|
||||
|
||||
# Prompt
|
||||
autoload -U promptinit && promptinit
|
||||
prompt filthy
|
|
@ -1,6 +0,0 @@
|
|||
- clean: ['~']
|
||||
|
||||
- link:
|
||||
~/.gitconfig: config/git/config
|
||||
~/.zshrc: config/zsh/config
|
||||
~/.ssh/config: config/ssh/config
|
|
@ -1,20 +0,0 @@
|
|||
export DOTFILES="${HOME}/dotfiles"
|
||||
export DOTLIB="${DOTFILES}/lib"
|
||||
export DOTBIN="${DOTFILES}/bin"
|
||||
export DOTCONF="${DOTFILES}/config"
|
||||
export DOTCONFD="${DOTCONF}/zsh/config.d"
|
||||
|
||||
# Export Path
|
||||
export PATH="${DOTBIN}:/opt/android-sdk/build-tools/26.0.1:${PATH}"
|
||||
|
||||
# Export Editor
|
||||
export EDITOR='nano'
|
||||
|
||||
# Completions Paths
|
||||
fpath+=(${DOTLIB}/completions/src ${DOTLIB}/local)
|
||||
|
||||
for file in ${DOTCONFD}/*.zsh; do source $file; done
|
||||
|
||||
# Prompt
|
||||
autoload -U promptinit && promptinit
|
||||
prompt filthy
|
|
@ -1 +0,0 @@
|
|||
for file in ${DOTCONFD}/functions/*.zsh; do source $file; done
|
|
@ -1,3 +0,0 @@
|
|||
# Aliases for OS
|
||||
if type pacman &>/dev/null; then source ${DOTCONFD}/aliases/os/archlinux.zsh; fi
|
||||
if type apt-get &>/dev/null; then source ${DOTCONFD}/aliases/os/debian.zsh; fi
|
|
@ -1 +0,0 @@
|
|||
eval `dircolors ${DOTCONF}/dir/config`
|
3
install
3
install
|
@ -5,9 +5,8 @@ BASEDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|||
cd ${BASEDIR}
|
||||
git submodule update --init --recursive
|
||||
|
||||
|
||||
echo "Installing Dotbot and Linking Files"
|
||||
${BASEDIR}/lib/dotbot/bin/dotbot -d ${BASEDIR} -c config/dotbot/config ${@}
|
||||
${BASEDIR}/lib/dotbot/bin/dotbot -d ${BASEDIR} -c cfg/dotbot/cfg ${@}
|
||||
|
||||
echo "Installing ZUnit"
|
||||
cd ${BASEDIR}/lib/zunit
|
||||
|
|
Loading…
Add table
Reference in a new issue