dotfiles

Cross platform dotfiles for linux, mac and windows
git clone git@getsh.org:dotfiles.git
Log | Files | Refs

commit 44e5298bcdc796e2d11584ad08f4230a606b1312
parent 4f8291584be6a899e852df63a9b334f03bae1405
Author: Bharatvaj Hemanth <bharatvaj@yahoo.com>
Date:   Fri,  5 Jan 2024 19:50:38 +0530

Use 'set -+a' in .profile instead of writing export multiple times

Source only interactive stuff in .bashrc, load global vars and functions only once in .profile for bash.

Check if XDG_ROOT is set rather than checking of $1 in .profile

Use 'command -v' in place of type. POSIX says it is available everywhere with the added advantage of not needing to redirect stderr.

Remove compton/picom in xinitrc

Fallback .config/git/ignore change as it ignores files in every repo.
Back to ~/.gitignore :(

Enable :termdebug after buffer loads in vim and set comfortable layout.

Remove gvimrc and just use set in .vimrc

Handle 'sl' command gracefully ;)

Add slstatus in xinitrc

Use 'nnn' instead of 'lf' as terminal file manager.

Remove Xresources as I'm no longer an Urxvt user (st rules)

Remove alacritty config

Remove i3 configs in favour of dwm

Update lynx.cfg to use cross-platform shims and optimize for slow networks(cache).

Use yt-dlp instead of youtube-dl in songdl

NOTE
----
I am going deeper into low-level stuff. Anything that compiles longer than the other gets less preference.

I am using the default XDG recommended user-dirs.dirs, as that makes more sense both in linux and cross-platform.

Diffstat:
D.bash_profile | 6------
D.config/X11/Xresources | 38--------------------------------------
M.config/X11/keybindings | 1-
M.config/X11/xinitrc | 4+---
D.config/alacritty/alacritty.yml | 11-----------
D.config/alacritty/hyper-dark.yml | 31-------------------------------
D.config/alacritty/hyper-light.yml | 32--------------------------------
D.config/i3/config | 158-------------------------------------------------------------------------------
M.config/lynx/lynx.cfg | 22+++++++++++-----------
M.config/sh/aliases | 22++++++++++++----------
M.config/sh/functions | 75++++++++++++++++++++++++++++++++++++++-------------------------------------
M.config/tmux/tmux.conf | 2+-
M.config/user-dirs.dirs | 16++++++++--------
D.config/vim/gvimrc | 3---
R.config/git/ignore -> .gitignore | 0
A.local/bin/sh/clip | 4++++
M.local/bin/sh/extract.sh | 6+++---
M.local/bin/sh/songdl | 7+++----
M.local/share/vim/keybindings.vim | 1-
M.local/share/vim/plugins | 4++--
M.profile | 158+++++++++++++++++++++++++++++++++++++------------------------------------------
M.vimrc | 7++++++-
22 files changed, 163 insertions(+), 445 deletions(-)

diff --git a/.bash_profile b/.bash_profile @@ -1,6 +0,0 @@ -[ -n "$1" ] && XDG_ROOT="$1" || XDG_ROOT="$HOME" - -[ -f "${XDG_ROOT}"/.profile ] && . "${XDG_ROOT}"/.profile -set -o vi -PS1='\w> ' -[ -f "$XDG_CONFIG_HOME/bash_unstaged" ] && . "$XDG_CONFIG_HOME/bash_unstaged" diff --git a/.config/X11/Xresources b/.config/X11/Xresources @@ -1,38 +0,0 @@ -URxvt*background: #000000 -URxvt*foreground: #FFFFFF -URxvt*font: xft:Fira Mono:pixelsize=14 xft:Noto Color Emoji:pixelsize=14 -URxvt*boldFont: xft:Fira Mono:bold:pixelsize=14 -URxvt*saveLines: 12000 -URxvt*scrollBar: false -URxvt*scrollstyle: rxvt -URxvt*perl-ext-common: default,matcher,new-window -URxvt*urlLauncher: firefox -URxvt.internalBorder: 6 -URxvt.keysym.C-N: perl:new-window -URxvt*matcher.button: 1 - -URxvt*colorUL: #86a2be -! black -URxvt*color0 : #2E3436 -URxvt*color8 : #555753 -! red -URxvt*color1 : #CC0000 -URxvt*color9 : #EF2929 -! green -URxvt*color2 : #4E9A06 -URxvt*color10 : #8AE234 -! yellow -URxvt*color3 : #C4A000 -URxvt*color11 : #FCE94F -! blue -URxvt*color4 : #3465A4 -URxvt*color12 : #729FCF -! magenta -URxvt*color5 : #75507B -URxvt*color13 : #AD7FA8 -! cyan -URxvt*color6 : #06989A -URxvt*color14 : #34E2E2 -! white -URxvt*color7 : #D3D7CF -URxvt*color15 : #EEEEEC diff --git a/.config/X11/keybindings b/.config/X11/keybindings @@ -3,5 +3,4 @@ __type() { } __type setxkbmap && setxkbmap -option caps:escape -__type setxkbmap && setxkbmap -option altwin:swap_alt_win __type xbmap && xbmap diff --git a/.config/X11/xinitrc b/.config/X11/xinitrc @@ -6,8 +6,6 @@ WM=dwm __type $WM || (echo "$WM not found" && exit 1) -__type xrdb && xrdb merge ~/.config/X11/Xresources -__type hsetroot && exec hsetroot -solid "#000000" & -__type compton && exec compton & +__type slstatus && exec slstatus & exec $WM diff --git a/.config/alacritty/alacritty.yml b/.config/alacritty/alacritty.yml @@ -1,11 +0,0 @@ -import: - - ~/.cache/alacritty_unstaged.yml - -live_config_reload: true - -bell: - command: None - -selection: - save_to_clipboard: true - diff --git a/.config/alacritty/hyper-dark.yml b/.config/alacritty/hyper-dark.yml @@ -1,31 +0,0 @@ -# Colors (Hyper) -colors: - # Default colors - primary: - background: '0x000000' - foreground: '0xffffff' - cursor: - text: '0xF81CE5' - cursor: '0xffffff' - - # Normal colors - normal: - black: '0x000000' - red: '0xfe0100' - green: '0x33ff00' - yellow: '0xfeff00' - blue: '0x0066ff' - magenta: '0x9D8DC8' - cyan: '0x0B8E8B' - white: '0xc0c0c0' - - # Bright colors - bright: - black: '0x555555' - red: '0xFF2222' - green: '0x33ff00' - yellow: '0xfeff00' - blue: '0x0066ff' - magenta: '0xB2F3F3' - cyan: '0x71F4F1' - white: '0xFFFFFF' diff --git a/.config/alacritty/hyper-light.yml b/.config/alacritty/hyper-light.yml @@ -1,32 +0,0 @@ -# github Alacritty Colors -colors: - # Default colors - primary: - background: '0xffffff' - foreground: '0x000000' - - # Normal colors - normal: - black: '0x24292f' - red: '0xcf222e' - green: '0x116329' - yellow: '0x4d2d00' - blue: '0x0969da' - magenta: '0x8250df' - cyan: '0x1b7c83' - white: '0x6e7781' - - # Bright colors - bright: - black: '0x57606a' - red: '0xa40e26' - green: '0x1a7f37' - yellow: '0x633c01' - blue: '0x218bff' - magenta: '0xa475f9' - cyan: '0x3192aa' - white: '0x8c959f' - - indexed_colors: - - { index: 16, color: '0xd18616' } - - { index: 17, color: '0xa40e26' } diff --git a/.config/i3/config b/.config/i3/config @@ -1,158 +0,0 @@ -# This file has been auto-generated by i3-config-wizard(1). -# It will not be overwritten, so edit it as you like. -# -# Should you change your keyboard layout some time, delete -# this file and re-run i3-config-wizard(1). -# - -# i3 config file (v4) -# -# Please see https://i3wm.org/docs/userguide.html for a complete reference! - -set $mod Mod4 - -# Font for window titles. Will also be used by the bar unless a different font -# is used in the bar {} block below. -font pango:monospace 8 - -# This font is widely installed, provides lots of unicode glyphs, right-to-left -# text rendering and scalability on retina/hidpi displays (thanks to pango). -#font pango:DejaVu Sans Mono 8 - -# Before i3 v4.8, we used to recommend this one as the default: -# font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1 -# The font above is very space-efficient, that is, it looks good, sharp and -# clear in small sizes. However, its unicode glyph coverage is limited, the old -# X core fonts rendering does not support right-to-left and this being a bitmap -# font, it doesn’t scale on retina/hidpi displays. - -# Use Mouse+$mod to drag floating windows to their wanted position -floating_modifier $mod - -# start a terminal -bindsym $mod+Return exec --no-startup-id alacritty - -# kill focused window -bindsym $mod+Shift+q kill - -# start dmenu (a program launcher) -bindsym $mod+d exec dmenu_run -bindsym $mod+n exec sh ~/.config/i3/dmenu_search.sh -# There also is the (new) i3-dmenu-desktop which only displays applications -# shipping a .desktop file. It is a wrapper around dmenu, so you need that -# installed. -# bindsym $mod+d exec --no-startup-id i3-dmenu-desktop - -# change focus -bindsym $mod+h focus left -bindsym $mod+j focus down -bindsym $mod+k focus up -bindsym $mod+l focus right - -# alternatively, you can use the cursor keys: -bindsym $mod+Left focus left -bindsym $mod+Down focus down -bindsym $mod+Up focus up -bindsym $mod+Right focus right - -# move focused window -bindsym $mod+Shift+h move left -bindsym $mod+Shift+j move down -bindsym $mod+Shift+k move up -bindsym $mod+Shift+l move right - -# alternatively, you can use the cursor keys: -bindsym $mod+Shift+Left move left -bindsym $mod+Shift+Down move down -bindsym $mod+Shift+Up move up -bindsym $mod+Shift+Right move right - -# split in horizontal orientation -bindsym $mod+s split h - -# split in vertical orientation -bindsym $mod+v split v - -# enter fullscreen mode for the focused container -bindsym $mod+f fullscreen toggle - -# change container layout (stacked, tabbed, toggle split) -bindsym $mod+semicolon layout stacking -bindsym $mod+w layout tabbed -bindsym $mod+e layout toggle split - -# toggle tiling / floating -bindsym $mod+Shift+space floating toggle - -# change focus between tiling / floating windows -bindsym $mod+space focus mode_toggle - -# focus the parent container -bindsym $mod+a focus parent - -# focus the child container -#bindsym $mod+d focus child - -# switch to workspace -bindsym $mod+1 workspace 1 -bindsym $mod+2 workspace 2 -bindsym $mod+3 workspace 3 -bindsym $mod+4 workspace 4 -bindsym $mod+5 workspace 5 -bindsym $mod+6 workspace 6 -bindsym $mod+7 workspace 7 -bindsym $mod+8 workspace 8 -bindsym $mod+9 workspace 9 -bindsym $mod+0 workspace 10 - -# move focused container to workspace -bindsym $mod+Shift+1 move container to workspace 1 -bindsym $mod+Shift+2 move container to workspace 2 -bindsym $mod+Shift+3 move container to workspace 3 -bindsym $mod+Shift+4 move container to workspace 4 -bindsym $mod+Shift+5 move container to workspace 5 -bindsym $mod+Shift+6 move container to workspace 6 -bindsym $mod+Shift+7 move container to workspace 7 -bindsym $mod+Shift+8 move container to workspace 8 -bindsym $mod+Shift+9 move container to workspace 9 -bindsym $mod+Shift+0 move container to workspace 10 - -# reload the configuration file -bindsym $mod+Shift+c reload -# restart i3 inplace (preserves your layout/session, can be used to upgrade i3) -bindsym $mod+Shift+r restart -# exit i3 (logs you out of your X session) -bindsym $mod+Shift+e exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -b 'Yes, exit i3' 'i3-msg exit'" - -# resize window (you can also use the mouse for that) -mode "resize" { - # These bindings trigger as soon as you enter the resize mode - - # Pressing left will shrink the window’s width. - # Pressing right will grow the window’s width. - # Pressing up will shrink the window’s height. - # Pressing down will grow the window’s height. - bindsym h resize shrink width 10 px or 10 ppt - bindsym j resize grow height 10 px or 10 ppt - bindsym k resize shrink height 10 px or 10 ppt - bindsym l resize grow width 10 px or 10 ppt - - # same bindings, but for the arrow keys - bindsym Left resize shrink width 10 px or 10 ppt - bindsym Down resize grow height 10 px or 10 ppt - bindsym Up resize shrink height 10 px or 10 ppt - bindsym Right resize grow width 10 px or 10 ppt - - # back to normal: Enter or Escape - bindsym Return mode "default" - bindsym Escape mode "default" -} - -bindsym $mod+r mode "resize" - -client.focused #f5f5f5 #f5f5f5 #000000 #f5f5f5 - -new_window 1pixel - -bar { -} diff --git a/.config/lynx/lynx.cfg b/.config/lynx/lynx.cfg @@ -7,17 +7,15 @@ AUTO_SESSION:TRUE SESSION_FILE:./.cache/lynx/lynx_session BOOKMARK_FILE:ON -DEFAULT_BOOKMARK_FILE:./.cache/lynx/lynx_bookmarks.html +DEFAULT_BOOKMARK_FILE:./.local/share/bookmarks.html PRETTYSRC:TRUE UPDATE_TERM_TITLE:TRUE DEFAULT_EDITOR:vim EDITOR:vim -KEYMAP:J:DOWN_TWO -KEYMAP:K:UP_TWO DEFAULT_KEYPAD_MODE:LINKS_AND_FIELDS_ARE_NUMBERED -MAKE_LINKS_FOR_ALL_IMAGES:TRUE +#MAKE_LINKS_FOR_ALL_IMAGES:TRUE # Status line pausing INFOSECS:0.5 @@ -25,16 +23,18 @@ MESSAGESECS:0.5 ALERTSECS:3 NO_PAUSE:TRUE +NONRESTARTING_SIGWINCH:TRUE +SOURCE_CACHE:MEMORY +#FORCE_EMPTY_HREFLESS_A:TRUE + USE_EXTERNALS:TRUE DEFAULT_USER_MODE:ADVANCED -EXTERNAL_MENU:http:browser:open -u %s &:TRUE +EXTERNAL_MENU:http:browser:open %s &:TRUE # TODO use a common clipboard program -EXTERNAL_MENU:http:copy:printf %s | pbcopy :TRUE -EXTERNAL_MENU:http:video:mpv %s &:TRUE +EXTERNAL_MENU:http:copy:printf %s | clip :TRUE +EXTERNAL_MENU:http:video:mpv %s 1>/dev/null & :TRUE EXTERNAL_MENU:http:videodl:youtube-dl -q --no-warnings %s &:TRUE EXTERNAL_MENU:http:songdl:songdl %s &:TRUE EXTERNAL_MENU:http:wget:wget %s &:TRUE -KEYMAP:o:ECGOTO -KEYMAP:O:GOTO -KEYMAP:g:HOME -KEYMAP:G:END +#KEYMAP:o:ECGOTO +#KEYMAP:O:GOTO diff --git a/.config/sh/aliases b/.config/sh/aliases @@ -10,12 +10,15 @@ alias wget='wget --hsts-file="$XDG_CACHE_HOME/wget-hsts"' alias doas=sudo alias qc='ssh $(ci)' +# [helper_functions] +cd_and_ls() { cd $* && ls; } +thwart() { for t in $*; do there $t || alias $t="sl '$t'"; done } + # [baseutils_conditioning] -thwart sl && thwart ld && thwart lls && thwart sls && thwart lsl && thwart lss && thwart kls -thwart cdd -thwart mr +thwart lls sls lsl lss kls cdd mr # [ip] +# TODO make this cross-platform there ifconfig && alias lip="ifconfig | grep -w inet | cut -d ' ' -f2" there curl && alias gip="curl ifconfig.co" @@ -27,11 +30,9 @@ alias n='cd_and_ls' alias cf="quickopen cd d" alias ef="quickopen ${EDITOR} f" alias gf='$EDITOR $(git ls-files | ${FUZZER})' -# TODO make it work for linux alias of="quickopen open f" -# This won't work with dash -# dash want's alias \- -alias -- -='cd -' +if [ -n "$BASH" ] || [ -n "$ZSH_VERSION" ]; then __is_bashlike=--; fi +alias $__is_bashlike -='cd -' # [shorthands] alias a=attach @@ -41,17 +42,18 @@ alias d='download' alias e='${EDITOR}' alias f=quickopen alias g=git -alias l=lfcd +# TODO Use nnncd +alias l=nnn alias le=less alias m=smartmake -alias v="$EDITOR" alias x=extract.sh +there rc || alias rc='sudo systemctl' # [midlonghands] alias op='cd $(open_project "$HOME/repo" | fzf)' alias girl='grep -irl' alias gir='grep -ir' alias markdown=md2html -alias fy='fzf | pbcopy' +alias fy='fzf | clip' alias voom='VIM_DIR=$XDG_DATA_HOME/vim voom' diff --git a/.config/sh/functions b/.config/sh/functions @@ -1,48 +1,51 @@ -md() { - mkdir "$@" && cd "$@" -} +[ -n "$BASH" ] && is_bash=-f + +there() { + # Checks the availability of an executable + command -v "$@" >/dev/null 2>&1 +} && export $is_bash there open_project() { # search only dirs - search_dir=${1:-.} - for i in $search_dir/*/; do - if [ -d "$i/.git" ]; then - echo "$i" - else - # if does not have .git, search the subdirs - open_project "$i" - fi + search_loc=${1:-.}/* + for i in $search_loc/.git/ $search_loc/*/.git/; do + echo "$i.." done +} && export $is_bash open_project + +open() { + case "$(uname -o)" in + *Linux*)xdg-open "$@" ;; + Darwin) command open "$@" ;; + *) start "$@" ;; + esac } attach() { - if there abduco && [ $# -eq 0 ]; then + command -v abduco >/dev/null || return + if [ $# -eq 0 ]; then sesh_name=$(abduco -l | tail -n +2 | cut -f3 | $FUZZER) test -z "$sesh_name" && return abduco -a $sesh_name || abduco -c $sesh_name mtm; + else + abduco -a $1 fi - [ $# -gt 0 ] && abduco -a $1 -} +} && export $is_bash attach # TODO make it non-interruptable -insult() { - if there sl; then - sl else printf "You are a noob for typing '$1'\n" - sleep 5 - fi -} +if ! there sl; then + sl() { + printf "You are a noob for typing '$1'\n"; sleep 5; + } && export $is_bash sl +fi smartmake() { if there fmake && there errorformat; then - $(fmake) $* | errorformat + fmake $* | errorformat else make fi -} - -thwart() { - alias $1="insult '$1'" -} +} && export $is_bash smartmake quickopen() { if ! there "${FUZZER}"; then @@ -73,25 +76,23 @@ quickopen() { fi } -cd_and_ls() { - cd $* && ls -} - download() { - # TODO use wget if curl not available - curl -fLO $* + case $1 in + git@*|*.git|https://*.git) git clone $* ;; + *) curl -fLO $* ;; # TODO use wget if curl not available + esac } find_() { find . -name "*$**" } -vim_plug() { export - VIM_PLUGINS_DIR="$XDG_DATA_HOME"/vim/pack/voom/opt export - VIM_DIR="$XDG_DATA_HOME"/vim voom $@ +vim_plug() { + VIM_PLUGINS_DIR="$XDG_DATA_HOME"/vim/pack/voom/opt \ + VIM_DIR="$XDG_DATA_HOME"/vim voom $@ } nvim_plug() { - export VIM_PLUGINS_DIR="$XDG_DATA_HOME"/nvim/pack/voom/opt - export VIM_DIR="$XDG_DATA_HOME"/nvim voom $@ + VIM_PLUGINS_DIR="$XDG_DATA_HOME"/nvim/pack/voom/optj \ + VIM_DIR="$XDG_DATA_HOME"/nvim voom $@ } diff --git a/.config/tmux/tmux.conf b/.config/tmux/tmux.conf @@ -38,7 +38,7 @@ set-option -g mouse on setw -g mode-keys vi set-option -g focus-events on set-option -s set-clipboard off -bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "pbcopy" +bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "clip" bind P paste-buffer # Themes diff --git a/.config/user-dirs.dirs b/.config/user-dirs.dirs @@ -1,8 +1,8 @@ -XDG_DESKTOP_DIR="$XDG_ROOT/desktop" -XDG_DOCUMENTS_DIR="$XDG_ROOT/documents" -XDG_DOWNLOAD_DIR="$XDG_ROOT/downloads" -XDG_MUSIC_DIR="$XDG_ROOT/music" -XDG_PICTURES_DIR="$XDG_ROOT/pictures" -XDG_PUBLICSHARE_DIR="$XDG_ROOT/public" -XDG_TEMPLATES_DIR="$XDG_ROOT/templates" -XDG_VIDEOS_DIR="$XDG_ROOT/videos" +XDG_DESKTOP_DIR="$XDG_ROOT/Desktop" +XDG_DOWNLOAD_DIR="$XDG_ROOT/Downloads" +XDG_TEMPLATES_DIR="$XDG_ROOT/" +XDG_PUBLICSHARE_DIR="$XDG_ROOT/Public" +XDG_DOCUMENTS_DIR="$XDG_ROOT/Documents" +XDG_MUSIC_DIR="$XDG_ROOT/Music" +XDG_PICTURES_DIR="$XDG_ROOT/Pictures" +XDG_VIDEOS_DIR="$XDG_ROOT/Videos" diff --git a/.config/vim/gvimrc b/.config/vim/gvimrc @@ -1,3 +0,0 @@ -set guifont=Bitstream\ Vera\ Sans\ Mono -set guioptions= -colorscheme gruvbox-material diff --git a/.config/git/ignore b/.gitignore diff --git a/.local/bin/sh/clip b/.local/bin/sh/clip @@ -0,0 +1,4 @@ +#!/bin/sh + +# TODO cross-platform clipborad +# Use OS-specific, should work both on console and X diff --git a/.local/bin/sh/extract.sh b/.local/bin/sh/extract.sh @@ -9,12 +9,12 @@ test -f $1 || { printf "$0: $1: No such file \n"; exit 1; } case $1 in *.a) ar x "$1" ;; *.z) 7z x "$1" ;; + *.rar) unrar x "$1" ;; + *.tar|*.tar.xz|*.tar.gz) tar -xvf "$1" ;; + *.tar.bz2) tar -xzvf "$1" ;; *.bz2) bzip2 -d "$1" ;; *.bz) bzip2 -d "$1" ;; *.gz) gunzip -d "$1" ;; - *.rar) unrar x "$1" ;; - *.tar) tar -xvf "$1" ;; - *.tar.gz) tar -xvf "$1" ;; *.tgz) tar -zxvf "$1" ;; *.zip) unzip "$1" ;; *.mp4) diff --git a/.local/bin/sh/songdl b/.local/bin/sh/songdl @@ -2,13 +2,12 @@ [ $# -ne 1 ] && echo "Usage: $0 <youtube-url>" && exit 1 -[ -z "$SONGDL_HOME" ] && SONGDL_HOME="${XDG_MUSIC_DIR}" - -cd "$SONGDL_HOME" +: ${XDG_MUSIC_DIR:=$HOME/Music} +cd "${XDG_MUSIC_DIR:?$XDG_MUSIC_DIR not found}" song_name=$1 -youtube-dl --extract-audio --audio-format mp3 "$song_name" --external-downloader aria2c +yt-dlp --extract-audio --audio-format mp3 "$song_name" --external-downloader aria2c if type mpc >/dev/null; then mpc update diff --git a/.local/share/vim/keybindings.vim b/.local/share/vim/keybindings.vim @@ -1,5 +1,4 @@ " General keybindings -nnoremap <leader>aa :argadd **<cr> nnoremap <leader>co :copen<cr> nnoremap <leader>cd :cdo<space>s/ nnoremap <leader>cs :cdo<space>s/ diff --git a/.local/share/vim/plugins b/.local/share/vim/plugins @@ -4,12 +4,12 @@ tpope/vim-fugitive tpope/vim-surround tpope/vim-unimpaired tpope/vim-repeat -natebosch/vim-lsc -dradtke/vim-dap Bestoa/SearchComplete tpope/vim-projectionist junegunn/goyo.vim +AndrewRadev/tagalong.vim +#ap/vim-css-color #cfdrake/vim-pbxproj #ervandew/supertab #vim-scripts/vimacs diff --git a/.profile b/.profile @@ -1,105 +1,95 @@ #!/bin/sh -[ -n "$1" ] && XDG_ROOT="$1" || XDG_ROOT="$HOME" +: ${XDG_ROOT:=$HOME} +set -a # XDG -export XDG_CONFIG_HOME="$XDG_ROOT/.config" -export XDG_DATA_HOME="$XDG_ROOT/.local/share" -export XDG_CACHE_HOME="$XDG_ROOT/.cache" -export XDG_RUNTIME_DIR="$XDG_ROOT/.local/run" -export XDG_STATE_HOME="$XDG_ROOT/.local/state" +XDG_CONFIG_HOME="$XDG_ROOT/.config" +XDG_DATA_HOME="$XDG_ROOT/.local/share" +XDG_CACHE_HOME="$XDG_ROOT/.cache" +XDG_STATE_HOME="$XDG_ROOT/.local/state" -export ABDUCO_SOCKET_DIR="$XDG_STATE_HOME"/abuco -export LESSHISTFILE="$XDG_STATE_HOME"/lesshst +ABDUCO_SOCKET_DIR="$XDG_STATE_HOME"/abuco +HISTFILE="$XDG_STATE_HOME"/history +LESSHISTFILE="$XDG_STATE_HOME"/lesshst # Global programs -export BUNDLE_USER_CONFIG="$XDG_CONFIG_HOME"/bundle -export DOCKER_CONFIG="$XDG_CONFIG_HOME"/docker -export ELINKS_CONFDIR="$XDG_CONFIG_HOME/elinks" -export INPUTRC="$XDG_CONFIG_HOME"/readline/inputrc -export LESSHISTFILE=- -export LYNX_CFG="$XDG_CONFIG_HOME/lynx/lynx.cfg" -export LYNX_LSS="$XDG_CONFIG_HOME/lynx/lynx.lss" -export NOTMUCH_CONFIG="$XDG_CONFIG_HOME/notmuch/config" -export NPM_CONFIG_USERCONFIG="$XDG_CONFIG_HOME"/npm/npmrc -export NPM_CONFIG_USERCONFIG="$XDG_CONFIG_HOME/npm/npmrc" -export PARALLEL_HOME="$XDG_CONFIG_HOME"/parallel -export PGPASSFILE="$XDG_CONFIG_HOME/pg/pgpass" -export PGSERVICEFILE="$XDG_CONFIG_HOME/pg/pg_service.conf" -export PSQLRC="$XDG_CONFIG_HOME/pg/psqlrc" -export SCREENRC="$XDG_CONFIG_HOME"/screen/screenrc -export TASKRC="$XDG_CONFIG_HOME/task/taskrc" -export WGETRC="$XDG_CONFIG_HOME/wgetrc" -export XAUTHORITY="$XDG_RUNTIME_DIR"/Xauthority -export XINITRC="$XDG_CONFIG_HOME"/X11/xinitrc -export XSERVERRC="$XDG_CONFIG_HOME"/X11/xserverrc +BUNDLE_USER_CONFIG="$XDG_CONFIG_HOME"/bundle +DOCKER_CONFIG="$XDG_CONFIG_HOME"/docker +ELINKS_CONFDIR="$XDG_CONFIG_HOME/elinks" +INPUTRC="$XDG_CONFIG_HOME"/readline/inputrc +LESSHISTFILE=- +LYNX_CFG="$XDG_CONFIG_HOME/lynx/lynx.cfg" +LYNX_LSS="$XDG_CONFIG_HOME/lynx/lynx.lss" +NOTMUCH_CONFIG="$XDG_CONFIG_HOME/notmuch/config" +NPM_CONFIG_USERCONFIG="$XDG_CONFIG_HOME"/npm/npmrc +NPM_CONFIG_PREFIX="~/.local/share/npm" +PARALLEL_HOME="$XDG_CONFIG_HOME"/parallel +PGPASSFILE="$XDG_CONFIG_HOME/pg/pgpass" +PGSERVICEFILE="$XDG_CONFIG_HOME/pg/pg_service.conf" +PSQLRC="$XDG_CONFIG_HOME/pg/psqlrc" +SCREENRC="$XDG_CONFIG_HOME"/screen/screenrc +TASKRC="$XDG_CONFIG_HOME/task/taskrc" +WGETRC="$XDG_CONFIG_HOME/wgetrc" +XINITRC="$XDG_CONFIG_HOME"/X11/xinitrc +#XSERVERRC="$XDG_CONFIG_HOME"/X11/xserverrc -export ANDROID_HOME="$XDG_DATA_HOME"/android -export BUNDLE_USER_PLUGIN="$XDG_DATA_HOME"/bundle -export CARGO_HOME="$XDG_DATA_HOME"/cargo -export FFMPEG_DATADIR="$XDG_DATA_HOME"/ffmpeg -export GEM_HOME="$XDG_DATA_HOME"/gem -export GNUPGHOME="$XDG_DATA_HOME/gnupg" -export GOPATH="$XDG_DATA_HOME"/go -export GRADLE_USER_HOME="$XDG_DATA_HOME"/gradle -export HISTFILE="$XDG_DATA_HOME"/history -export MACHINE_STORAGE_PATH="$XDG_DATA_HOME"/docker-machine -export MYSQL_HISTFILE="$XDG_DATA_HOME/mysql_history" -export NB_PATH="$XDG_DATA_HOME/notebook" -export NODE_REPL_HISTORY="$XDG_DATA_HOME"/node_repl_history -export PASSWORD_STORE_DIR="$XDG_DATA_HOME"/pass -export RUSTUP_HOME="$XDG_DATA_HOME"/rustup -export SONGDL_HOME="${XDG_DATA_HOME}/music/" -export SQLITE_HISTORY="$XDG_DATA_HOME/sqlite_history" -export TERMINFO="$XDG_DATA_HOME"/terminfo -export TERMINFO_DIRS="$XDG_DATA_HOME"/terminfo:/usr/share/terminfo -export VSCODE_PORTABLE="$XDG_DATA_HOME/vscode" -export W3M_DIR="$XDG_DATA_HOME"/w3m -export _Z_DATA="$XDG_DATA_HOME/z" +BUNDLE_USER_PLUGIN="$XDG_DATA_HOME"/bundle +CARGO_HOME="$XDG_DATA_HOME"/cargo +FFMPEG_DATADIR="$XDG_DATA_HOME"/ffmpeg +GEM_HOME="$XDG_DATA_HOME"/gem +GNUPGHOME="$XDG_DATA_HOME/gnupg" +GOPATH="$XDG_DATA_HOME"/go +GRADLE_USER_HOME="$XDG_DATA_HOME"/gradle +MACHINE_STORAGE_PATH="$XDG_DATA_HOME"/docker-machine +MYSQL_HISTFILE="$XDG_DATA_HOME/mysql_history" +NODE_REPL_HISTORY="$XDG_DATA_HOME"/node_repl_history +PASSWORD_STORE_DIR="$XDG_DATA_HOME"/pass +RUSTUP_HOME="$XDG_DATA_HOME"/rustup +SONGDL_HOME="${XDG_DATA_HOME}/music/" +SQLITE_HISTORY="$XDG_DATA_HOME/sqlite_history" +TERMINFO="$XDG_DATA_HOME"/terminfo +TERMINFO_DIRS="$XDG_DATA_HOME"/terminfo:/usr/share/terminfo +VSCODE_PORTABLE="$XDG_DATA_HOME/vscode" +W3M_DIR="$XDG_DATA_HOME"/w3m +_Z_DATA="$XDG_DATA_HOME/z" -export BUNDLE_USER_CACHE="$XDG_CACHE_HOME"/bundle -export GEM_SPEC_CACHE="$XDG_CACHE_HOME"/gem -export NUGET_PACKAGES="$XDG_CACHE_HOME"/NuGetPackages -export PSQL_HISTORY="$XDG_CACHE_HOME/pg/psql_history" - -# Make `history` print timestamp -HISTTIMEFORMAT="%F %T " -HISTCONTROL=erasedups +BUNDLE_USER_CACHE="$XDG_CACHE_HOME"/bundle +GEM_SPEC_CACHE="$XDG_CACHE_HOME"/gem +NUGET_PACKAGES="$XDG_CACHE_HOME"/NuGetPackages +PSQL_HISTORY="$XDG_CACHE_HOME/pg/psql_history" # Local executables -export PATH=${PATH}:${HOME}/.local/bin:${HOME}/.local/bin/sh:${XDG_DATA_HOME}/npm/bin:${XDG_DATA_HOME}/.cargo/bin:${GOPATH}/bin:${XDG_DATA_HOME}/gem/bin - -chance() { - # Hit or miss - [ -f "${1}" ] && . "${1}" -} - -there() { - # Checks the availability of an executable - type "$@" >/dev/null 2>/dev/null -} +PATH=${PATH}:${HOME}/.local/bin:${HOME}/.local/bin/sh:${XDG_DATA_HOME}/npm/bin:${XDG_DATA_HOME}/.cargo/bin:${GOPATH}/bin:${XDG_DATA_HOME}/gem/bin # Setup editor # TODO until I grok the shell and able to control the clipboard and # registers with terminal level keybings. I am not going back to vi/nvi #alias vim=vi #alias nvim=vi -export VISUAL=nvim -export EDITOR=nvim -there $EDITOR || unset $EDITOR -export FUZZER=fzy -there $FUZZER || unset $FUZZER +{ +command -v vim && VISUAL=vim && EDITOR=vim +} >/dev/null -export BROWSER=lynx -export SURFRAW_browser="$BROWSER" +FUZZER=$(command -v fzy) -chance "${XDG_CONFIG_HOME}/sh/functions" -chance "${XDG_CONFIG_HOME}/sh/aliases" -chance "${XDG_CONFIG_HOME}/sh/unstaged" +BROWSER=lynx +SURFRAW_browser="$BROWSER" # Theme # Hyper Red -export LESS_TERMCAP_so=$'\e[31m' -export LESS_TERMCAP_se=$'\e[0m' -export CLICOLOR=1 -export LSCOLORS="xxexcxdxbxegxdxbagxcxd" -export LS_COLORS="di=0:ln=34:so=32:pi=33:ex=31:bd=34;46:cd=0;43:su=0;41:sg=30;46:tw=0;42:ow=0;43" +LESS_TERMCAP_so=$'\e[31m' +LESS_TERMCAP_se=$'\e[0m' +CLICOLOR=1 +LSCOLORS="xxexcxdxbxegxdxbagxcxd" +LS_COLORS="di=0:ln=34:so=32:pi=33:ex=31:bd=34;46:cd=0;43:su=0;41:sg=30;46:tw=0;42:ow=0;43" + +set +a + +# Make `history` print timestamp +HISTTIMEFORMAT="%F %T " +HISTCONTROL=erasedups + +. "${XDG_CONFIG_HOME}/sh/functions" +. "${XDG_CONFIG_HOME}/sh/unstaged" + +[ -n "$BASH" ] && [ -f "$XDG_ROOT/.bashrc" ] && . "$XDG_ROOT/.bashrc" diff --git a/.vimrc b/.vimrc @@ -12,6 +12,9 @@ set foldmarker={,} set foldlevel=20 set foldopen-=search +" Debug +let g:termdebug_config = {'sign': '>>', 'winbar': 0, 'wide':163} + " General set nocompatible set mouse= @@ -132,6 +135,8 @@ function! s:load_plugins(t) abort packadd vim-better-whitespace packadd notmuch-vim packadd vim-dispatch + packadd termdebug + let g:termdebug_wide=163 let g:notmuch_use_fzf = 1 let g:notmuch_open_command = 'fzf' let g:notmuch_fzf_command = 'fzf --reverse' @@ -147,7 +152,7 @@ augroup user_cmds augroup END if has("gui") - source $XDG_CONFIG_HOME/vim/gvimrc + set guioptions= endif if has("win32")