From a0d93ac5d9a6e0e9687f50b54e5f8b34b8f38f25 Mon Sep 17 00:00:00 2001 From: Mehdi Sadeghi Date: Sun, 18 Apr 2021 15:05:33 +0200 Subject: Add zshenv and zprofile. --- .gitignore | 1 + .local/bin/xdg-open | 13 +++++++++++++ .profile | 44 -------------------------------------------- .zprofile | 8 ++++++++ .zshenv | 45 +++++++++++++++++++++++++++++++++++++++++++++ .zshrc | 22 ++++++++++++++++++++-- 6 files changed, 87 insertions(+), 46 deletions(-) create mode 100644 .gitignore create mode 100755 .local/bin/xdg-open delete mode 100644 .profile create mode 100644 .zprofile create mode 100644 .zshenv diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..72e8ffc --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +* diff --git a/.local/bin/xdg-open b/.local/bin/xdg-open new file mode 100755 index 0000000..a1d6842 --- /dev/null +++ b/.local/bin/xdg-open @@ -0,0 +1,13 @@ +#!/bin/sh +# Courtesy of https://drewdevault.com/2019/12/30/dotfiles.html +case "${1%%:*}" in + http|https|*.pdf) + exec qutebrowser "$1" + ;; + mailto) + exec aerc "$1" + ;; + *) + exec /usr/bin/xdg-open "$@" + ;; +esa diff --git a/.profile b/.profile deleted file mode 100644 index 38c74f0..0000000 --- a/.profile +++ /dev/null @@ -1,44 +0,0 @@ -# Generic -export LANG=en_US.UTF-8 -export EDITOR=vim -export TIMER_FORMAT='%d' -export TIMER_PRECISION=2 - -# Main shadow bin directory -export PATH=$HOME/.local/bin:$PATH - -# Other bin directories -export PATH=$HOME/.local/bin/`hostname`:$PATH -export PATH=$HOME/.cargo/bin:$PATH -export PATH=$HOME/.yarn/bin:$PATH - -# Go -export GOPATH="$HOME/.go" -export PATH=$GOPATH/bin:$PATH - -export ANDROID_SDK_ROOT=$HOME/Android/Sdk - -# Building -export MAKEFLAGS=-j`lscpu | grep '^CPU(s):' | awk -F' ' '{ print $2 }'` -export CFLAGS="-O2 -pipe -march=native" -export CXXFLAGS="${CFLAGS}" - -# Sway compatiblity -if [ "$XDG_SESSION_DESKTOP" = "sway" ] ; then - # https://github.com/swaywm/sway/issues/595 - export _JAVA_AWT_WM_NONREPARENTING=1 -fi - -# Preferred editor for local and remote sessions -# if [[ -n $SSH_CONNECTION ]]; then -# export EDITOR='vim' -# else -# export EDITOR='mvim' -# fi - -# Compilation flags -# export ARCHFLAGS="-arch x86_64" - -# ssh -# export SSH_KEY_PATH="~/.ssh/rsa_id" - diff --git a/.zprofile b/.zprofile new file mode 100644 index 0000000..8b2ae28 --- /dev/null +++ b/.zprofile @@ -0,0 +1,8 @@ +# .zprofile is loaded on login shells, e.g. when doing ssh. +# or running with --shell flag. + +## Read bash profile if present. +# emulate sh -c '. ~/.profile' + +# Clone oh-my-zsh of not present. +[[ ! -e .oh-my-zsh ]] && git clone https://github.com/ohmyzsh/ohmyzsh .oh-my-zsh diff --git a/.zshenv b/.zshenv new file mode 100644 index 0000000..d9c6ec4 --- /dev/null +++ b/.zshenv @@ -0,0 +1,45 @@ +# Generic +export LANG=en_US.UTF-8 +export EDITOR=vim +export TIMER_FORMAT='%d' +export TIMER_PRECISION=2 + +# Main shadow bin directory +export PATH=$HOME/.local/bin:$PATH + +# Other bin directories +export PATH=$HOME/.local/bin/`hostname`:$PATH +export PATH=$HOME/.local/bin/`uname -m`:$PATH +export PATH=$HOME/.cargo/bin:$PATH +export PATH=$HOME/.yarn/bin:$PATH + +# Go +export GOPATH="$HOME/.go" +export PATH=$GOPATH/bin:$PATH + +export ANDROID_SDK_ROOT=$HOME/Android/Sdk + +# Building +export MAKEFLAGS=-j`lscpu | grep '^CPU(s):' | awk -F' ' '{ print $2 }'` +export CFLAGS="-O2 -pipe -march=native" +export CXXFLAGS="${CFLAGS}" + +# Sway compatiblity +if [ "$XDG_SESSION_DESKTOP" = "sway" ] ; then + # https://github.com/swaywm/sway/issues/595 + export _JAVA_AWT_WM_NONREPARENTING=1 +fi + +# Preferred editor for local and remote sessions +# if [[ -n $SSH_CONNECTION ]]; then +# export EDITOR='vim' +# else +# export EDITOR='mvim' +# fi + +# Compilation flags +# export ARCHFLAGS="-arch x86_64" + +# ssh +# export SSH_KEY_PATH="~/.ssh/rsa_id" + diff --git a/.zshrc b/.zshrc index 8446c99..7624b34 100644 --- a/.zshrc +++ b/.zshrc @@ -5,7 +5,7 @@ else export ZSH="/usr/share/oh-my-zsh" fi -# simple, frisk, mrtazz, lambda, maran, robbyrussel, random +# simple, arrow, edvardm, random ZSH_THEME=simple # Uncomment the following line to use case-sensitive completion. @@ -21,6 +21,7 @@ plugins=(git autojump history-substring-search)# timer gem rust cargo) # Activate oh-my-zsh source $ZSH/oh-my-zsh.sh +# Add direnv hook _direnv_hook() { eval "$("/usr/bin/direnv" export zsh)"; } @@ -33,11 +34,12 @@ fi #export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")" #[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm +# Enable kubectl completion if present if [[ -a `which kubectl` ]]; then source <(kubectl completion zsh 2> /dev/null); fi -# For X.org +# Add X.org keyboard mapping (of no use on Wayland) #setxkbmap \ # -layout de,ir \ # -variant nodeadkeys,pes_keypad \ @@ -47,3 +49,19 @@ fi # -option 'lv3:caps_switch' \ # -option 'terminate:ctrl_alt_bkspc' \ # -option 'eurosign:e' + +# Aliases +# `githome` alias is a trick to avoid having git prompt when working +# in different directories of my home folder. I simply rename `.git` +# folder to `.githome` and use the following alias to interact with it. +# On new systems I only need to do the following: +# cd ~ +# git init +# git remote add origin git@git.sr.ht:~mehdix/dotfiles +# or +# git remote add origin https://git.sr.ht/~mehdix/dotfiles +# git fetch +# git checkout -f master +# mv .git .githome +alias githome='git --git-dir ~/.githome --work-tree ~' + -- cgit v1.2.3