aboutsummaryrefslogtreecommitdiff
path: root/config/zsh/.zshrc
diff options
context:
space:
mode:
authorCharles Cabergs <me@cacharle.xyz>2022-08-13 16:18:31 +0200
committerCharles Cabergs <me@cacharle.xyz>2022-08-13 16:18:31 +0200
commit4bfc180939d86c181da6e258c813344cf0a21f6d (patch)
tree4053192f84d1c4b322bfe398d7dfa3b5ce0a51fd /config/zsh/.zshrc
parenta9199ba1d8ea09aa92e7dbbc1b08c3d06018ad53 (diff)
parent414a32702300e073d221d462599dd92f11ed9411 (diff)
downloaddotfiles-4bfc180939d86c181da6e258c813344cf0a21f6d.tar.gz
dotfiles-4bfc180939d86c181da6e258c813344cf0a21f6d.tar.bz2
dotfiles-4bfc180939d86c181da6e258c813344cf0a21f6d.zip
Merge branch 'master' of github.com:cacharle/dotfiles
Diffstat (limited to 'config/zsh/.zshrc')
-rw-r--r--config/zsh/.zshrc44
1 files changed, 43 insertions, 1 deletions
diff --git a/config/zsh/.zshrc b/config/zsh/.zshrc
index 8ee4622..57b49c5 100644
--- a/config/zsh/.zshrc
+++ b/config/zsh/.zshrc
@@ -59,10 +59,22 @@ export SAVEHIST=5000
# executed when changing directory
chpwd() {
+ # ls on cd if not too much files
content="$(find . -maxdepth 1 | wc -l)"
([ "$content" -lt 20 ] && ls -l) ||
echo "$(pwd) contains $content entries"
[ "$(uname)" = 'Linux' ] && [ "$(stat -c "%U" .)" = "$USER" ] && touch . # to sort by last cd
+
+ # change conda env if name of the directory is the name of an env
+ # [ ! -d "$PWD/.git" ] && return
+ # name="$(basename "$PWD")"
+ # [ "$name" = $CONDA_DEFAULT_ENV ] && return
+ # [ ! -e "$HOME/conda_envs" ] && conda env list > "$HOME/conda_envs"
+ # < "$HOME/conda_envs" \
+ # cut -d ' ' -f 1 |
+ # sed -e '/^#/d' -e '/^$/d' -e '/^base$/d' |
+ # grep -q "$name" &&
+ # conda activate "$name"
}
# https://wiki.archlinux.org/title/Zsh#Shortcut_to_exit_shell_on_partial_command_line
@@ -73,7 +85,7 @@ zle -N exit_zsh
bindkey '^D' exit_zsh
# shellcheck disable=SC2034,SC2039,SC3030
-fignore=(o hi) # ignore extensions in autocomplete
+fignore=(.o .hi) # ignore extensions in autocomplete
# set tab to 4 spaces
tabs 4
@@ -96,3 +108,33 @@ if [ "$(uname)" = 'Linux' ]
then
. /usr/share/doc/pkgfile/command-not-found.zsh
fi
+
+# upload-config() {
+# scp -qr "$HOME/.vim" cce424r@ds-train:
+# scp -q "$HOME/.config/vim/vimrc" cce424r@ds-train:.vimrc
+#
+# scp -qr "$HOME/.vim" cce424r@ds-attic:
+# scp -q "$HOME/.config/vim/vimrc" cce424r@ds-attic:.vimrc
+# }
+
+# >>> conda initialize >>>
+# !! Contents within this block are managed by 'conda init' !!
+__conda_setup="$('/usr/local/anaconda3/bin/conda' 'shell.zsh' 'hook' 2> /dev/null)"
+# shellcheck disable=SC2181
+if [ $? -eq 0 ]; then
+ eval "$__conda_setup"
+else
+ if [ -f "/usr/local/anaconda3/etc/profile.d/conda.sh" ]; then
+ . "/usr/local/anaconda3/etc/profile.d/conda.sh"
+ else
+ export PATH="/usr/local/anaconda3/bin:$PATH"
+ fi
+fi
+unset __conda_setup
+
+if [ -f "/usr/local/anaconda3/etc/profile.d/mamba.sh" ]; then
+ . "/usr/local/anaconda3/etc/profile.d/mamba.sh"
+fi
+# <<< conda initialize <<<
+
+eval "$(opam env)"