aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles Cabergs <me@cacharle.xyz>2021-02-24 22:17:06 +0100
committerCharles Cabergs <me@cacharle.xyz>2021-02-24 22:17:06 +0100
commit4fe446437f94e999a180692c9ea69c7075c0f42c (patch)
tree80d344ff41536d87b8a0b7ac38c891fff4b1ca5c
parent468a789dbc4b1928c035d8590895efc533520a27 (diff)
downloaddotfiles-4fe446437f94e999a180692c9ea69c7075c0f42c.tar.gz
dotfiles-4fe446437f94e999a180692c9ea69c7075c0f42c.tar.bz2
dotfiles-4fe446437f94e999a180692c9ea69c7075c0f42c.zip
Fixing everything with the new XDG directories
-rw-r--r--config/mutt/muttrc2
-rw-r--r--config/vim/pluggins.vim2
-rw-r--r--config/vim/vimrc13
-rwxr-xr-xconfig/x11/xinitrc (renamed from config/startx/xinitrc)3
-rw-r--r--config/xmonad/xmonad.hs8
-rw-r--r--config/zsh/.zshrc10
-rw-r--r--config/zsh/aliases.zsh20
-rwxr-xr-xconfig/zsh/zprofile (renamed from config/zsh/.zprofile)17
-rwxr-xr-xinstall131
9 files changed, 76 insertions, 130 deletions
diff --git a/config/mutt/muttrc b/config/mutt/muttrc
index b4b02a8..5bb9961 100644
--- a/config/mutt/muttrc
+++ b/config/mutt/muttrc
@@ -51,7 +51,7 @@ set message_cachedir = "~/.mutt/cache/bodies"
set certificate_file = "~/.mutt/certificates"
# solarized color scheme
-source "$DOTDIR/mutt-colors-solarized/mutt-colors-solarized-dark-16.muttrc"
+source "$XDG_DATA_HOME/mutt/solarized/mutt-colors-solarized-dark-16.muttrc"
# password
source "gpg -d $HOME/.config/mutt/passwd.muttrc.gpg 2> /dev/null |"
diff --git a/config/vim/pluggins.vim b/config/vim/pluggins.vim
index c60ab84..7091c5f 100644
--- a/config/vim/pluggins.vim
+++ b/config/vim/pluggins.vim
@@ -2,7 +2,7 @@
" vim pluggins "
""""""""""""""""
-call plug#begin()
+call plug#begin("$XDG_DATA_HOME/vim/plugged")
Plug 'ctrlpvim/ctrlp.vim' " Ctrl-P similar to vsc
Plug 'tpope/vim-eunuch' " basic unix command in vim
Plug 'tomtom/tcomment_vim' " mininal commenter
diff --git a/config/vim/vimrc b/config/vim/vimrc
index 6b1bcc2..644032f 100644
--- a/config/vim/vimrc
+++ b/config/vim/vimrc
@@ -19,7 +19,7 @@ set directory=$XDG_CACHE_HOME/vim/swap | call mkdir(&directory, 'p')
set undodir=$XDG_CACHE_HOME/vim/undo | call mkdir(&undodir, 'p')
" }}}
-source pluggins.vim " load pluggins
+source $XDG_CONFIG_HOME/vim/pluggins.vim " load pluggins
" common {{{
let mapleader = ' ' " set leader key to space
@@ -94,14 +94,14 @@ set nofoldenable " not folded by default
" let g:dracula_bold = 1
" let g:dracula_italic = 1
" let g:dracula_colorterm = 0
-" colorscheme dracula
+" silent! colorscheme dracula
" }}}
" solarized {{{
set t_Co=16
let g:solarized_termcolors=16
let g:solarized_visibility='low' " visibility of invisible chars with set list
set background=dark
-colorscheme solarized
+silent! colorscheme solarized
" }}}
" lightline {{{
let g:lightline = {}
@@ -171,10 +171,7 @@ nnoremap <leader><TAB> :b#<CR>
nnoremap <leader>bl :ls<CR>
" }}}
-" vimrc {{{
-nnoremap <leader>rc :vsplit $DOTDIR/.vimrc<cr>
-nnoremap <leader>sc :source $MYVIMRC<cr>
-" }}}
+nnoremap <leader>sc :source $MYVIMRC<cr> " source vimrc
" c {{{
" create c function body from prototype
@@ -313,3 +310,5 @@ let g:gutentags_ctags_exclude = ['doc/*', 'Makefile']
" let g:gutentags_ctags_exclude_wildignore = 1
let g:goyo_height = 90
+
+set viminfo+=n$XDG_CACHE_HOME/vim/viminfo
diff --git a/config/startx/xinitrc b/config/x11/xinitrc
index 860fed2..2dbe77a 100755
--- a/config/startx/xinitrc
+++ b/config/x11/xinitrc
@@ -3,10 +3,11 @@
# xinput disable 'ETPS/2 Elantech Touchpad' &
echo 'Starting redshift'
-redshift -c $HOME/.config/redshift.conf &
+redshift -c $XDG_CONFIG_HOME/redshift/redshift.conf &
echo 'Starting dunst'
dunst &
xset r rate 200 50
+pulseaudio --daemonize
case "$(cat /etc/hostname)" in
cacharle-main)
diff --git a/config/xmonad/xmonad.hs b/config/xmonad/xmonad.hs
index b61bcea..b1655ef 100644
--- a/config/xmonad/xmonad.hs
+++ b/config/xmonad/xmonad.hs
@@ -50,12 +50,12 @@ myKeys = [ ("<XF86AudioLowerVolume>", spawn "pulseaudio-ctl down")
, ("M-<F11>", spawn "pulseaudio-ctl down")
, ("M-<F12>", spawn "pulseaudio-ctl up")
- , ("<XF86MonBrightnessUp>", spawn "~/bin/backlight-ctl up")
- , ("<XF86MonBrightnessDown>", spawn "~/bin/backlight-ctl down")
+ , ("<XF86MonBrightnessUp>", spawn "backlight-ctl up")
+ , ("<XF86MonBrightnessDown>", spawn "backlight-ctl down")
, ("<XF86ScreenSaver>", spawn "slock")
- , ("<XF86TouchpadToggle>", spawn "~/bin/touchpad-toggle")
+ , ("<XF86TouchpadToggle>", spawn "touchpad-toggle")
- , ("M-o", spawn "~/bin/project-open")
+ , ("M-o", spawn "project-open")
, ("M-m", spawn "st -e mocp")
, ("M-S-d", spawn "notify-send -i x-office-calendar \"$(date +\"%H:%M %A %d/%m/%Y %B\")\"")
, ("M-S-b", spawn "notify-send \"battery: $(cat /sys/class/power_supply/BAT0/capacity)\"")
diff --git a/config/zsh/.zshrc b/config/zsh/.zshrc
index 9cd21b5..aef07dd 100644
--- a/config/zsh/.zshrc
+++ b/config/zsh/.zshrc
@@ -3,10 +3,8 @@
###############
-[ -z $DOTDIR ] && export DOTDIR=$HOME/git/dotfiles # FIXME have to change path manually if install elsewhere
-
# load aliases
-source $DOTDIR/.zsh_aliases
+source $XDG_CONFIG_HOME/zsh/aliases.zsh
# prompt
case `tty` in
@@ -19,7 +17,7 @@ case `tty` in
;;
*)
# pure prompt
- export FPATH="$FPATH:$HOME/.zsh/pure"
+ export FPATH="$FPATH:$XDG_DATA_HOME/zsh/pure"
ZSH_THEME="pure"
autoload -U promptinit
promptinit
@@ -64,8 +62,7 @@ function chpwd() {
#source /etc/zsh_command_not_found
-# ignore filetypes in autocomplete
-fignore=(o hi)
+fignore=(o hi) # ignore extensions in autocomplete
# pluggins
source $XDG_DATA_HOME/zsh/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh # prompt syntax highlight
@@ -76,5 +73,4 @@ source $XDG_DATA_HOME/zsh/zsh-you-should-use/you-should-use.plugin.zsh # alias
# set tab to 4 spaces
tabs 4
-
export GPG_TTY=$(tty) # fixing gpg fatal error about tty
diff --git a/config/zsh/aliases.zsh b/config/zsh/aliases.zsh
index 790692e..3d2cfa1 100644
--- a/config/zsh/aliases.zsh
+++ b/config/zsh/aliases.zsh
@@ -20,10 +20,10 @@ alias doas='doas ' # same for doas
alias info='info --vi-keys'
# ls
-alias ls='ls --color=auto -F'
-alias ll="ls -lh"
-alias la="ls -a"
-alias lla="ls -alh"
+alias ls='ls --color=auto -Fh'
+alias ll="ls -l"
+alias la="ls -A"
+alias lla="ls -Al"
alias lss="ls -Ssh"
# tree
@@ -88,18 +88,6 @@ alias lpassp='lpass show --password --clip' # put password in clipboard
alias dual='xrandr --output LVDS1 --primary --left-of VGA1 --output VGA1 --mode 1280x1024'
alias single='xrandr --output VGA1 --off'
-
-# edit config files
-alias zshrc="vim $DOTDIR/.zshrc && source $DOTDIR/.zshrc"
-alias zshaliasrc="vim $DOTDIR/.zsh_aliases && source $DOTDIR/.zshrc"
-alias vimrc="vim $DOTDIR/.vimrc"
-alias vimplugrc="vim $DOTDIR/.pluggins.vim"
-alias xmonadrc="vim $DOTDIR/xmonad.hs"
-alias muttrc="vim $DOTDIR/.muttrc"
-
-# other
-#alias date="date -R"
-
# parent directory jump
alias ..='cd ..'
alias ...='cd ../..'
diff --git a/config/zsh/.zprofile b/config/zsh/zprofile
index 91b0c0b..bd9c23b 100755
--- a/config/zsh/.zprofile
+++ b/config/zsh/zprofile
@@ -14,10 +14,19 @@ export BROWSERCLI='w3m'
export XDG_CONFIG_HOME="$HOME/.config"
export XDG_DATA_HOME="$HOME/.local/share"
export XDG_CACHE_HOME="$HOME/.cache"
-
-export ZDOTDIT="$XDG_CONFIG_HOME/zsh"
-
-export HISTFILE="$XDG_CACHE_HOME/histfile"
+# config
+export ZDOTDIR="$XDG_CONFIG_HOME/zsh"
+export XINITRC="$XDG_CONFIG_HOME/x11/xinitrc"
+export VIMINIT='let $MYVIMRC="$XDG_CONFIG_HOME/vim/vimrc" | source $MYVIMRC'
+# data
+export GNUPGHOME="$XDG_DATA_HOME/gnupg"
+export GOPATH="$XDG_DATA_HOME/go"
+export CARGO_HOME="$XDG_DATA_HOME/cargo"
+# cache
+export HISTFILE="$XDG_CACHE_HOME/history"
+export LESSHISTFILE='-' # no ~/.lesshst
+# runtime
+export XAUTHORITY="$XDG_RUNTIME_DIR/Xauthority"
# color in man (less pager)
export LESS_TERMCAP_mb=$'\e[1;32m'
diff --git a/install b/install
index 5b12db2..86d4f1a 100755
--- a/install
+++ b/install
@@ -1,111 +1,64 @@
#!/bin/sh
-create_dotfile_link()
-{
- target="$HOME/$2"
- mkdir -vp "$(dirname "$target")"
- ln -svf "$DOTDIR/$1" "$target"
-}
-
-create_dotfile_link_same()
-{
- create_dotfile_link "$1" "$1"
+mkdir -pv "$XDG_CONFIG_HOME"
+mkdir -pv "$XDG_DATA_HOME"
+mkdir -pv "$XDG_CACHE_HOME"
+
+echo '---------------------------- CONFIG FILE LINKS ---------------------------'
+
+link_home_files() {
+ rice_dir="$1"
+ dest_dir="$2"
+ paths=$(mktemp)
+ # generate a file with the file path in this repo and the link for the real path
+ # each line is in the format: TARGET LINKNAME
+ find "$rice_dir" -type f |
+ sed -e 'p' -e 's:^'"$rice_dir"':'"$dest_dir"':' |
+ awk '{ if (NR % 2 == 1) { print "'"$(pwd)"'" "/" $0 } else print }' |
+ xargs -L 2 > "$paths"
+ cat $paths | cut -d ' ' -f 2 | xargs -L 1 dirname | xargs -L 1 mkdir -pv
+ cat $paths | xargs -L 1 ln -svf
}
-###############################################################################
-# link dotfiles
-###############################################################################
-
-# dotfiles directory
-[ -z "$DOTDIR" ] && DOTDIR=$(pwd) && export DOTDIR
-
-# Creating links
-create_dotfile_link_same .zshrc
-create_dotfile_link_same .bashrc
-create_dotfile_link_same .vimrc
-create_dotfile_link_same .nanorc
-create_dotfile_link_same .pluggins.vim
-create_dotfile_link grep.vim .vim/plugin/grep.vim
-
-create_dotfile_link xmonad.hs .xmonad/xmonad.hs
-
-create_dotfile_link_same .gdbinit
-create_dotfile_link_same .ghci
-create_dotfile_link_same .gitconfig
-create_dotfile_link_same .muttrc
-create_dotfile_link_same .mailcap
-create_dotfile_link_same .xinitrc
-create_dotfile_link_same .zprofile
-
-create_dotfile_link redshift.conf .config/redshift.conf
-create_dotfile_link mimeapps.list .config/mimeapps.list
-create_dotfile_link applications/sxiv.desktop .data/applications/sxiv.desktop
-create_dotfile_link applications/mutt.desktop .data/applications/mutt.desktop
-create_dotfile_link applications/zathura.desktop .data/applications/zathura.desktop
-create_dotfile_link applications/newsboat.desktop .data/applications/newsboat.desktop
-
-create_dotfile_link dunst/dunstrc .config/dunst/dunstrc
-create_dotfile_link pulseaudio-ctl/config .config/pulseaudio-ctl/config
+link_home_files 'config' "$XDG_CONFIG_HOME"
+link_home_files 'local' "$HOME/.local"
-create_dotfile_link_same .newsboat/config
-#create_dotfile_link_same .newsboat/urls
+ln -svf "$(pwd)/config/x11/xinitrc" "$HOME/.xinitrc"
+ln -svf "$(pwd)/config/zsh/zprofile" "$HOME/.zprofile"
-# create_dotfile_link_same slock/config.def.h
-
-create_dotfile_link qutebrowser/config.py .config/qutebrowser/config.py
-
-create_dotfile_link_same .moc/config
-create_dotfile_link_same .moc/keymap
-create_dotfile_link_same .moc/themes/solarized
-
-create_dotfile_link zathura/zathurarc .config/zathura/zathurarc
-
-ln -svT "$DOTDIR/bin" "$HOME/bin"
-
-###############################################################################
+################################################################################
# cacharle-sync install
-###############################################################################
+################################################################################
CACHARLE_SYNC_PATH="$HOME/cacharle-sync"
-if [ -d "$CACHARLE_SYNC_PATH" ]
-then
- ln -svf "$CACHARLE_SYNC_PATH/newsboat-urls" "$HOME/.newsboat/urls"
-fi
+[ -d "$CACHARLE_SYNC_PATH" ] &&
+ ln -svf "$CACHARLE_SYNC_PATH/newsboat-urls" "$XDG_CONFIG_HOME/newsboat/urls"
+################################################################################
+# vim plug
###############################################################################
-# dependencies
-###############################################################################
-
-[ "$#" -ne 1 ] || [ ! "$1" = "-a" ] && exit 0
-echo "Installing Dependencies"
-###############################################################################
-# vim Plug
-PLUGFILE="$HOME/.vim/autoload/plug.vim"
+echo '---------------------------- INSTALL VIM PLUG ----------------------------'
+PLUGFILE="$XDG_DATA_HOME/vim/autoload/plug.vim"
PLUGURL='https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
-[ ! -f "$PLUGFILE" ] && echo "Downloading plug.vim" && \
- curl -fLo "$PLUGFILE" --create-dirs "$PLUGURL"
-echo "Installing plug.vim Pluggins"
+[ ! -f "$PLUGFILE" ] && curl -fLo "$PLUGFILE" --create-dirs "$PLUGURL"
vim -c "PlugInstall" -c "qa"
###############################################################################
# zsh pluggins
+###############################################################################
-update_plugin()
+echo '---------------------------- INSTALL ZSH PLUGGINS ------------------------'
+update_zsh_plugin()
{
url="$1"
- dest_path="$2"
- if [ ! -d "$dest_path" ]
- then
- echo "Installing $dest_path"
- git clone "$url" "$dest_path"
- else
- echo "Updating $dest_path"
- git -C "$dest_path" pull
- fi
+ path="$XDG_DATA_HOME/zsh/$(basename "$url")"
+ ([ ! -d "$path" ] || [ -z "$(ls -A "$path")" ]) &&
+ git clone "$url" "$path" ||
+ git -C "$path" pull
}
-mkdir -p "$HOME/.zsh"
-update_plugin 'https://github.com/sindresorhus/pure' "$HOME/.zsh/pure"
-update_plugin 'https://github.com/zsh-users/zsh-syntax-highlighting' "$HOME/.zsh/zsh-syntax-highlighting"
-update_plugin 'https://github.com/MichaelAquilina/zsh-you-should-use' "$HOME/.zsh/zsh-you-should-use"
+mkdir -p "$XDG_DATA_HOME/zsh"
+update_zsh_plugin 'https://github.com/sindresorhus/pure'
+update_zsh_plugin 'https://github.com/zsh-users/zsh-syntax-highlighting'
+update_zsh_plugin 'https://github.com/MichaelAquilina/zsh-you-should-use'