From eca7e5500a28841e97e5b05ce872a38c4b06f19f Mon Sep 17 00:00:00 2001 From: pztrn Date: Sat, 21 Mar 2015 19:52:26 +0500 Subject: [PATCH] Use find instead of ls. --- README.md | 9 +++++++++ zsh/01-config.zsh | 4 ++-- zsh/10-exports.zsh | 6 ++++-- zsh/50-aliases.zsh | 4 ++-- 4 files changed, 17 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 5976499..60983df 100644 --- a/README.md +++ b/README.md @@ -7,3 +7,12 @@ This is a ZSH configuration, baked by [Stanislav N. aka pztrn](http://en.pztrn.n * Fully modular design. * Ability to write own mini-apps. * Support libraries support. Just write them and place in 'lib'. Don't forget to source them! +* Same keyboard behaviour across OSes (tested on Linux and FreeBSD). + +## Installation + +Change your default shell to zsh and make a symlink: + + ln -s /path/to/zsh-config/zshrc ~/.zshrc + +Re-login (if you changed your shell) or just restart your terminal app. diff --git a/zsh/01-config.zsh b/zsh/01-config.zsh index 79180c4..3a3e7ff 100644 --- a/zsh/01-config.zsh +++ b/zsh/01-config.zsh @@ -5,6 +5,6 @@ if [ ! -d ${HOME}/.zsh-config.d/ ]; then echo "Looks like it's a very first launch. So I've copied default config to '${HOME}/.zsh-config.d/'" fi -for file in `ls ${HOME}/.zsh-config.d/ | sort`; do +for file in `find ${HOME}/.zsh-config.d/ -type f -depth 1 | sort`; do source ${HOME}/.zsh-config.d/${file} -done \ No newline at end of file +done diff --git a/zsh/10-exports.zsh b/zsh/10-exports.zsh index 4ba51f1..153c70c 100644 --- a/zsh/10-exports.zsh +++ b/zsh/10-exports.zsh @@ -1,9 +1,11 @@ -for config_file in `ls ${CONFIG_PATH}/zsh/exports | sort`; do +# Some default exports. They could be based on configuration variables. +for config_file in `find ${CONFIG_PATH}/zsh/exports -type f | sort`; do source ${CONFIG_PATH}/zsh/exports/${config_file} done +# We should import user-specific exports and use them. if [ -d ${HOME}/.zsh-config.d/exports ]; then - for config_file in `ls ${HOME}/.zsh-config.d/exports | sort`; do + for config_file in `find ${HOME}/.zsh-config.d/exports -type f | sort`; do if [ -f ${HOME}/.zsh-config.d/exports/${config_file} ]; then source ${HOME}/.zsh-config.d/exports/${config_file} fi diff --git a/zsh/50-aliases.zsh b/zsh/50-aliases.zsh index 2b27293..d0ed3f3 100644 --- a/zsh/50-aliases.zsh +++ b/zsh/50-aliases.zsh @@ -7,12 +7,12 @@ alias screen="TERM=xterm screen" alias clocksync="sudo ntpdate 0.pool.ntp.org" alias got="git" -for item in `ls ${CONFIG_PATH}/zsh/aliases`; do +for item in `find ${CONFIG_PATH}/zsh/aliases -type f | sort`; do source ${CONFIG_PATH}/zsh/aliases/${item} done if [ -d "${HOME}/.zsh-config.d/aliases" ]; then - for item in `ls ${HOME}/.zsh-config.d/aliases`; do + for item in `find ${HOME}/.zsh-config.d/aliases -type f | sort`; do if [ -f ${HOME}/.zsh-config.d/aliases/${item} ]; then source ${HOME}/.zsh-config.d/aliases/${item} fi