Use XDG Base Directory Specification

SSH is an exception because there seems to be no good way of supporting
XDG. Patience, I guess...
This commit is contained in:
Fernando Schauenburg 2019-11-03 01:53:27 +01:00
parent 16cd08905e
commit f7a498dbb7
9 changed files with 23 additions and 10 deletions

View file

@ -1,2 +0,0 @@
[ -f ~/.bashrc ] && . ~/.bashrc

View file

@ -5,14 +5,22 @@
# Customize environment
##############################################################################
export XDG_CACHE_HOME="$HOME/.cache"
export XDG_CONFIG_HOME="$HOME/.config"
export XDG_DATA_HOME="$HOME/.local/share"
export EDITOR="vim"
export INPUTRC="$XDG_CONFIG_HOME/readline/inputrc"
export LANG="en_US.UTF-8"
export LANGUAGE="en_US"
export LC_CTYPE="en_US.UTF-8"
export LC_ALL="en_US.UTF-8"
export LC_CTYPE="en_US.UTF-8"
export LESS="-i -j.49 -M -R -z-2"
export LESSHISTFILE=/dev/null
export LESSHISTFILE="$XDG_CACHE_HOME/less/history"
export LESSHISTSIZE=1000
export PAGER=less
export VIMINIT='let $MYVIMRC="$XDG_CONFIG_HOME/vim/vimrc" | source $MYVIMRC'
# Find out where Homebrew performs installations. If Homebrew is not
# installed (e.g. running on Linux), assume /usr/local for our
@ -74,7 +82,7 @@ HISTCONTROL=erasedups
HISTFILESIZE=
HISTSIZE=
HISTTIMEFORMAT="[%F %T] "
HISTFILE=~/.bash_eternal_history
HISTFILE="$XDG_CACHE_HOME/bash/history"
# shellcheck disable=SC2034 # these variable are meant for use in shell only
{
@ -197,6 +205,8 @@ alias path='echo $PATH | tr -s ":" "\n"'
alias mpath='echo $MANPATH | tr -s ":" "\n"'
alias timer='echo "Timer started. Stop with Ctrl-D." && date && time cat && date'
alias tmux='tmux -f "$XDG_CONFIG_HOME/tmux/tmux.conf"'
# A few options to get public IP address on command line. The dig solution
# below using the OpenDNS resolver doesn't work when connected to
# ExpressVPN because all DNS requests are handled by the ExpressVPN DNS

View file

@ -45,7 +45,7 @@
sub = submodule
[core]
excludesfile = ~/.gitignore
excludesfile = ~/.config/git/ignore
editor = vim
trustctime = false # http://www.git-tower.com/blog/make-git-rebase-safe-on-osx/
pager = less -F -X
@ -80,4 +80,4 @@
required = true
[include]
path = ~/.gitconfig.local
path = ~/.config/git/config.local

View file

@ -1,5 +1,7 @@
set nocompatible
let $MYVIMRC="$XDG_CONFIG_HOME/vim/vimrc"
" Options {{{
set autoindent
set autoread
@ -30,6 +32,7 @@ set nocompatible
set list
set modelines=0
set number
set runtimepath=$XDG_CONFIG_HOME/vim,$VIMRUNTIME
set scrolloff=5
set shiftwidth=4
set shortmess+=I
@ -56,7 +59,7 @@ set nocompatible
" | | | | | |
" v v v v v v
set viminfo=h,'500,<10000,s1000,/1000,:1000
set viminfofile=~/.vim/viminfo
set viminfofile=$XDG_CACHE_HOME/vim/viminfo
set virtualedit=block
set wildignore=*.o,*.obj,*.pyc,*.exe,*.so,*.dll
set wildmenu
@ -75,7 +78,7 @@ set nocompatible
" }}}
" Plugins {{{
call plug#begin('~/.vim/bundle')
call plug#begin('$XDG_CONFIG_HOME/vim/bundle')
Plug 'altercation/vim-colors-solarized'
Plug 'bronson/vim-trailing-whitespace'
Plug 'elzr/vim-json'
@ -229,5 +232,7 @@ augroup vimrc " {{{
autocmd FileType gitcommit setlocal textwidth=72
augroup END " }}}
if filereadable(expand("~/.vimrc.local")) | source ~/.vimrc.local | endif
if filereadable(expand("$XDG_CONFIG_HOME/vimrc.local"))
source $XDG_CONFIG_HOME/vimrc.local
endif