From ec6bec1983a8ecd2dc9f3fa075964be64cad3981 Mon Sep 17 00:00:00 2001 From: Robin Krahl Date: Tue, 27 Feb 2018 22:55:46 +0100 Subject: Modularize environment variables --- bash/.config/env/90-bash.sh | 1 + cargo/.config/env/90-cargo.sh | 1 + elinks/.config/env/90-elinks.sh | 1 + gimp/.config/env/90-gimp.sh | 1 + less/.config/env/90-less.sh | 2 ++ notmuch/.config/env/90-notmuch.sh | 1 + npm/.config/env/90-npm.sh | 1 + pass/.config/env/90-pass.sh | 1 + sh/.config/env/00-xdg.sh | 3 +++ sh/.config/env/10-path.sh | 4 ++++ sh/.config/sh/environment.sh | 20 ----------------- sh/.profile | 8 +++++-- vim/.config/env/90-vim.sh | 1 + vim/.config/vim/vimrc | 45 +++++++++++++++++++++++++++++++++++++++ vim/.vimrc | 45 --------------------------------------- x/.config/env/90-x.sh | 2 ++ 16 files changed, 70 insertions(+), 67 deletions(-) create mode 100644 bash/.config/env/90-bash.sh create mode 100644 cargo/.config/env/90-cargo.sh create mode 100644 elinks/.config/env/90-elinks.sh create mode 100644 gimp/.config/env/90-gimp.sh create mode 100644 less/.config/env/90-less.sh create mode 100644 notmuch/.config/env/90-notmuch.sh create mode 100644 npm/.config/env/90-npm.sh create mode 100644 pass/.config/env/90-pass.sh create mode 100644 sh/.config/env/00-xdg.sh create mode 100644 sh/.config/env/10-path.sh delete mode 100644 sh/.config/sh/environment.sh create mode 100644 vim/.config/env/90-vim.sh create mode 100644 vim/.config/vim/vimrc delete mode 100644 vim/.vimrc create mode 100644 x/.config/env/90-x.sh diff --git a/bash/.config/env/90-bash.sh b/bash/.config/env/90-bash.sh new file mode 100644 index 0000000..11887fa --- /dev/null +++ b/bash/.config/env/90-bash.sh @@ -0,0 +1 @@ +export HISTFILE="${XDG_CACHE_HOME}/sh/history" diff --git a/cargo/.config/env/90-cargo.sh b/cargo/.config/env/90-cargo.sh new file mode 100644 index 0000000..d37dba5 --- /dev/null +++ b/cargo/.config/env/90-cargo.sh @@ -0,0 +1 @@ +export CARGO_HOME="${XDG_DATA_HOME}/cargo" diff --git a/elinks/.config/env/90-elinks.sh b/elinks/.config/env/90-elinks.sh new file mode 100644 index 0000000..b40468a --- /dev/null +++ b/elinks/.config/env/90-elinks.sh @@ -0,0 +1 @@ +export ELINKS_CONFDIR="${XDG_CONFIG_HOME}/elinks" diff --git a/gimp/.config/env/90-gimp.sh b/gimp/.config/env/90-gimp.sh new file mode 100644 index 0000000..8c11b8c --- /dev/null +++ b/gimp/.config/env/90-gimp.sh @@ -0,0 +1 @@ +export GIMP2_DIRECTORY="${XDG_CONFIG_HOME}/gimp" diff --git a/less/.config/env/90-less.sh b/less/.config/env/90-less.sh new file mode 100644 index 0000000..e9db4d9 --- /dev/null +++ b/less/.config/env/90-less.sh @@ -0,0 +1,2 @@ +export LESSHISTFILE="${XDG_CACHE_HOME}/less/history" +export LESSKEY="${XDG_CONFIG_HOME}/less/lesskey" diff --git a/notmuch/.config/env/90-notmuch.sh b/notmuch/.config/env/90-notmuch.sh new file mode 100644 index 0000000..1a31463 --- /dev/null +++ b/notmuch/.config/env/90-notmuch.sh @@ -0,0 +1 @@ +export NOTMUCH_CONFIG="${XDG_CONFIG_HOME}/notmuch/config" diff --git a/npm/.config/env/90-npm.sh b/npm/.config/env/90-npm.sh new file mode 100644 index 0000000..1606093 --- /dev/null +++ b/npm/.config/env/90-npm.sh @@ -0,0 +1 @@ +export NPM_CONFIG_USERCONFIG="${XDG_CONFIG_HOME}/npm/config" diff --git a/pass/.config/env/90-pass.sh b/pass/.config/env/90-pass.sh new file mode 100644 index 0000000..ed0b68c --- /dev/null +++ b/pass/.config/env/90-pass.sh @@ -0,0 +1 @@ +export PASSWORD_STORE_DIR="${XDG_DATA_HOME}/pass" diff --git a/sh/.config/env/00-xdg.sh b/sh/.config/env/00-xdg.sh new file mode 100644 index 0000000..51404c7 --- /dev/null +++ b/sh/.config/env/00-xdg.sh @@ -0,0 +1,3 @@ +export XDG_CONFIG_HOME="${HOME}/.config" +export XDG_CACHE_HOME="${HOME}/.cache" +export XDG_DATA_HOME="${HOME}/.local/share" diff --git a/sh/.config/env/10-path.sh b/sh/.config/env/10-path.sh new file mode 100644 index 0000000..67cb738 --- /dev/null +++ b/sh/.config/env/10-path.sh @@ -0,0 +1,4 @@ +if [ -d "${HOME}/bin" ] +then + export PATH="${PATH}:${HOME}/bin" +fi diff --git a/sh/.config/sh/environment.sh b/sh/.config/sh/environment.sh deleted file mode 100644 index f02296d..0000000 --- a/sh/.config/sh/environment.sh +++ /dev/null @@ -1,20 +0,0 @@ -export XDG_CONFIG_HOME="${HOME}/.config" -export XDG_CACHE_HOME="${HOME}/.cache" -export XDG_DATA_HOME="${HOME}/.local/share" - -if [ -d "${HOME}/bin" ] -then - export PATH="${PATH}:${HOME}/bin" -fi - -export CARGO_HOME="${XDG_DATA_HOME}/cargo" -export ELINKS_CONFDIR="${XDG_CONFIG_HOME}/elinks" -export GIMP2_DIRECTORY="${XDG_CONFIG_HOME}/gimp" -export HISTFILE="${XDG_CACHE_HOME}/sh/history" -export LESSHISTFILE="${XDG_CACHE_HOME}/less/history" -export LESSKEY="${XDG_CONFIG_HOME}/less/lesskey" -export NOTMUCH_CONFIG="${XDG_CONFIG_HOME}/notmuch/config" -export NPM_CONFIG_USERCONFIG="${XDG_CONFIG_HOME}/npm/config" -export PASSWORD_STORE_DIR="${XDG_DATA_HOME}/pass" -export XAUTHORITY="${XDG_RUNTIME_DIR}/Xauthority" -export XINITRC="${XDG_CONFIG_HOME}/X11/xinitrc" diff --git a/sh/.profile b/sh/.profile index 399a6ba..36852bc 100644 --- a/sh/.profile +++ b/sh/.profile @@ -1,6 +1,10 @@ -if [ -f "${HOME}/.config/sh/environment.sh" ] +if [ -d "${HOME}/.config/env" ] then - . "${HOME}/.config/sh/environment.sh" + ENV_FILES=`find "${HOME}/.config/env" -type f,l -name "*.sh" | sort` + for ENV_FILE in ${ENV_FILES} + do + . ${ENV_FILE} + done fi if [ -z "$DISPLAY" ] && [ -n "$XDG_VTNR" ] && [ "$XDG_VTNR" -eq 1 ] diff --git a/vim/.config/env/90-vim.sh b/vim/.config/env/90-vim.sh new file mode 100644 index 0000000..c1f3a31 --- /dev/null +++ b/vim/.config/env/90-vim.sh @@ -0,0 +1 @@ +export VIMINIT='source ${XDG_CONFIG_HOME}/vim/vimrc' diff --git a/vim/.config/vim/vimrc b/vim/.config/vim/vimrc new file mode 100644 index 0000000..c760f86 --- /dev/null +++ b/vim/.config/vim/vimrc @@ -0,0 +1,45 @@ +" Disable Vi-compatibility +set nocompatible + +" Set paths according to XDG Base Directory specification +set viminfo+=n${XDG_CACHE_HOME}/vim/viminfo +set runtimepath=${XDG_CONFIG_HOME}/vim,$VIM,$VIMRUNTIME,${XDG_CONFIG_HOME}/vim/after +let g:netrw_home = "${XDG_CACHE_HOME}/vim" + +" Syntax highlighting +syntax on + +" Enable the filetype plugin +filetype plugin indent on +" LaTeX instead of Plain TeX +let g:tex_flavor = "latex" + +" Status line and numbers +set laststatus=2 +set number +set relativenumber +set ruler + +" Splits +set splitbelow +set splitright + +" Colors +set background=dark + +" Ignore some additional patterns when opening files +set wildignore+=*.o,*.so,*.swp,*/__pycache__/* + +" Search subdirectories with :find & co +set path+=** + +" Better completion +set wildmenu +set wildmode=longest:full,full + +" netrw +let g:netrw_banner=0 +" let g:netrw_browse_split=4 +let g:netrw_altv=1 +let g:netrw_liststyle=3 +let g:netrw_list_hide=netrw_gitignore#Hide() diff --git a/vim/.vimrc b/vim/.vimrc deleted file mode 100644 index c760f86..0000000 --- a/vim/.vimrc +++ /dev/null @@ -1,45 +0,0 @@ -" Disable Vi-compatibility -set nocompatible - -" Set paths according to XDG Base Directory specification -set viminfo+=n${XDG_CACHE_HOME}/vim/viminfo -set runtimepath=${XDG_CONFIG_HOME}/vim,$VIM,$VIMRUNTIME,${XDG_CONFIG_HOME}/vim/after -let g:netrw_home = "${XDG_CACHE_HOME}/vim" - -" Syntax highlighting -syntax on - -" Enable the filetype plugin -filetype plugin indent on -" LaTeX instead of Plain TeX -let g:tex_flavor = "latex" - -" Status line and numbers -set laststatus=2 -set number -set relativenumber -set ruler - -" Splits -set splitbelow -set splitright - -" Colors -set background=dark - -" Ignore some additional patterns when opening files -set wildignore+=*.o,*.so,*.swp,*/__pycache__/* - -" Search subdirectories with :find & co -set path+=** - -" Better completion -set wildmenu -set wildmode=longest:full,full - -" netrw -let g:netrw_banner=0 -" let g:netrw_browse_split=4 -let g:netrw_altv=1 -let g:netrw_liststyle=3 -let g:netrw_list_hide=netrw_gitignore#Hide() diff --git a/x/.config/env/90-x.sh b/x/.config/env/90-x.sh new file mode 100644 index 0000000..076ab5e --- /dev/null +++ b/x/.config/env/90-x.sh @@ -0,0 +1,2 @@ +export XAUTHORITY="${XDG_RUNTIME_DIR}/Xauthority" +export XINITRC="${XDG_CONFIG_HOME}/X11/xinitrc" -- cgit v1.2.3