commit 6add67209a6026770f6d3772c6bbb3c2612a1cfd
parent 689c8d2feee41035d0c0762cd36de254fc7df561
Author: Bharatvaj <bharatvaj@yahoo.com>
Date: Wed, 6 Oct 2021 14:13:44 +0530
Remove bashisms
Remove unwanted shell programs
Add 'ap/vim-css-color' vim plugin
Diffstat:
18 files changed, 72 insertions(+), 122 deletions(-)
diff --git a/.bash_profile b/.bash_profile
@@ -4,7 +4,6 @@
set -o vi
[ -f ~/.profile ] && . ~/.profile
-[ -f "${XDG_DATA_HOME}/personal/config" ] && . "${XDG_DATA_HOME}/personal/config"
[ -f "${XDG_CONFIG_HOME}/bash/bashrc" ] && . "${XDG_CONFIG_HOME}"/bash/bashrc
# Zoho
diff --git a/.config/.gitignore b/.config/.gitignore
@@ -6,6 +6,8 @@
!alacritty/**
!bash/
!bash/**
+!sh/
+!sh/**
!i3
!nvim
!vim/
diff --git a/.config/alacritty/alacritty.yml b/.config/alacritty/alacritty.yml
@@ -1,7 +1,3 @@
font:
- size: 16
-shell:
- program: /usr/local/bin/bash
- args:
- - --login
+ size: 14
diff --git a/.config/bash/aliases b/.config/bash/aliases
@@ -1,4 +0,0 @@
-which startx >&/dev/null && alias startx="startx \"$XDG_CONFIG_HOME/X11/xinitrc\" vt1"
-which wget >&/dev/null && alias wget="wget --hsts-file=\"$XDG_CACHE_HOME/wget-hsts\""
-which nvim >&/dev/null && alias vim="nvim" && alias vi="nvim"
-
diff --git a/.config/bash/bashrc b/.config/bash/bashrc
@@ -2,26 +2,6 @@
# ~/.bashrc
#
-# Make `history` print timestamp
-HISTTIMEFORMAT="%F %T "
-
PATH_EXPORTS=( "${ESSENTIAL_PATH_EXPORTS[@]}" "${OTHER_PATH_EXPORTS[@]}" )
-# Include one by one even if it affects performance
-# If something fails, atleast others will be added to path
-for PATH_EXPORT in ${PATH_EXPORTS}; do
- export PATH="${PATH_EXPORT}:${PATH}"
-done
-
-export PS1="\w $ "
-
-shopt -s autocd
-
-# Plugins
-[ -f "${XDG_CONFIG_HOME}/bash/plugin/index" ] && . "${XDG_CONFIG_HOME}/bash/plugin/index"
-
-# Aliases
-[ -f "${XDG_CONFIG_HOME}/bash/aliases" ] && . "${XDG_CONFIG_HOME}"/bash/aliases
-
-# Unstaged
-[ -f ~/.config/bash/unstaged ] && . ~/.config/bash/unstaged
+export PATH="${PATH}:${PATH_EXPORTS[*]}"
diff --git a/.config/bash/plugin/git b/.config/bash/plugin/git
@@ -1,41 +0,0 @@
-# ----------------------
-# Git Aliases
-# ----------------------
-alias ga='git add'
-alias gaa='git add .'
-alias gaaa='git add --all'
-alias gau='git add --update'
-alias gb='git branch'
-alias gbd='git branch --delete '
-alias gc='git commit'
-alias gcm='git commit --message'
-alias gcf='git commit --fixup'
-alias gco='git checkout'
-alias gcob='git checkout -b'
-alias gcom='git checkout master'
-alias gcos='git checkout staging'
-alias gcod='git checkout develop'
-alias gd='git diff'
-alias gda='git diff HEAD'
-alias glg='git log --graph --oneline --decorate --all'
-alias gld='git log --pretty=format:"%h %ad %s" --date=short --all'
-alias gm='git merge --no-ff'
-alias gma='git merge --abort'
-alias gmc='git merge --continue'
-alias gp='git pull'
-alias gpr='git pull --rebase'
-alias gr='git rebase'
-alias gss='git status --short'
-alias gst='git stash'
-alias gsta='git stash apply'
-alias gstd='git stash drop'
-alias gstl='git stash list'
-alias gstp='git stash pop'
-alias gsts='git stash save'
-
-# ----------------------
-# Git Functions
-# ----------------------
-# Git log find by commit message
-function glf() { git log --all --grep="$1"; }
-
diff --git a/.config/bash/plugin/index b/.config/bash/plugin/index
@@ -1,15 +0,0 @@
-# Plugins should be sourced from this file
-# Instead of hardcoding in bashrc file
-# TODO Generalize this(remove bashisms), so we can use this in other shells
-
-BASH_PLUGIN_DIR="${XDG_CONFIG_HOME}/bash/plugin"
-
-function bashplug() {
- plugin_file="${BASH_PLUGIN_DIR}/$1"
- [ -f ${plugin_file} ] && . "${plugin_file}"
-}
-
-# Enable this plugin if 'git' is installed
-which git >&/dev/null && bashplug git
-which ranger >&/dev/null && bashplug nb
-bashplug shorthand
diff --git a/.config/bash/plugin/nb b/.config/bash/plugin/nb
@@ -1,9 +0,0 @@
-# nb - notebook
-NB_PATH="${XDG_DATA_HOME}/notes"
-
-nb() {
- cd "${NB_PATH}"
- file="$(fzf --preview='cat {}')"
- [ "${file}" != "" ] && vim "${file}"
-}
-
diff --git a/.config/bash/plugin/shorthand b/.config/bash/plugin/shorthand
@@ -1,7 +0,0 @@
-# One letter bindings for important commands
-
-[ ! -z "${EDITOR}" ] && alias e=${EDITOR}
-
-which git >&/dev/null && alias g=git
-
-which pass >&/dev/null & alias p=pass
diff --git a/.config/bash/.gitignore b/.config/sh/.gitignore
diff --git a/.config/sh/aliases b/.config/sh/aliases
@@ -0,0 +1,3 @@
+mich startx && alias startx="startx \"$XDG_CONFIG_HOME/X11/xinitrc\" vt1"
+mich wget && alias wget="wget --hsts-file=\"$XDG_CACHE_HOME/wget-hsts\""
+
diff --git a/.config/sh/plugin/git b/.config/sh/plugin/git
@@ -0,0 +1,18 @@
+mich git || return
+# ----------------------
+# Git Aliases
+# ----------------------
+alias ga='git add'
+alias gb='git branch'
+alias gcm='git commit --message'
+alias gco='git checkout'
+alias gd='git diff'
+alias glg='git log --graph --oneline --decorate --all'
+alias gld='git log --pretty=format:"%h %ad %s" --date=short --all'
+
+# ----------------------
+# Git Functions
+# ----------------------
+# Git log find by commit message
+glf() { git log --all --grep="$1"; }
+
diff --git a/.config/sh/plugin/index b/.config/sh/plugin/index
@@ -0,0 +1,13 @@
+# Plugins should be sourced from this file
+# Instead of hardcoding in bashrc file
+
+SH_PLUGIN_DIR="${XDG_CONFIG_HOME}/sh/plugin"
+
+shplug() {
+ PLUGIN_FILE="${SH_PLUGIN_DIR}/${1}"
+ chance "${PLUGIN_FILE}"
+}
+
+shplug git
+shplug nb
+shplug shorthand
diff --git a/.config/sh/plugin/shorthand b/.config/sh/plugin/shorthand
@@ -0,0 +1,7 @@
+# One letter bindings for important commands
+
+[ -n "${EDITOR}" ] && alias e='${EDITOR}'
+
+alias c=clear
+mich git && alias g=git
+mich pass && alias p=pass
diff --git a/.config/vim/plugin/plugin.vim b/.config/vim/plugin/plugin.vim
@@ -10,8 +10,9 @@ endfunction
call plug#begin($XDG_DATA_HOME."/vim/plugged")
Plug 'tpope/vim-commentary'
Plug 'tpope/vim-surround'
- Plug 'itchyny/lightline.vim'
Plug 'tpope/vim-fugitive'
+ Plug 'ap/vim-css-color'
+ Plug 'itchyny/lightline.vim'
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
Plug 'junegunn/fzf.vim'
source $XDG_CONFIG_HOME/vim/plugin/development.vim
diff --git a/.local/bin/jrnl b/.local/bin/jrnl
@@ -1,11 +0,0 @@
-#!/bin/sh
-
- jrnl_path="${XDG_DATA_HOME}/notes"
-
-if [ -d "${jrnl_path}" ]; then
- ranger "${jrnl_path}"
-else
- cd "${jrnl_path}"
- vim "$(fzf --preview 'cat {}')"
-fi
-
diff --git a/.local/bin/jrnl_sync b/.local/bin/jrnl_sync
@@ -1,5 +0,0 @@
-#!/bin/sh
-
- jrnl_path="${XDG_DATA_HOME}/notes"
-
-git --git-dir="${jrnl_path}/.git" add "${jrnl_path}/contents" && git --git-dir="${jrnl_path}/.git" commit "$(date)"
diff --git a/.profile b/.profile
@@ -5,8 +5,10 @@ export GREP_COLOR='1;35;40'
export XDG_DATA_HOME="$HOME/.local/share"
export XDG_CONFIG_HOME="$HOME/.config"
export XDG_CACHE_HOME="$HOME/.cache"
+
+# Global programs
export GNUPGHOME="$XDG_DATA_HOME/gnupg"
-export VIMINIT='source $XDG_CONFIG_HOME/vim/vimrc'
+export VIMINIT="source $XDG_CONFIG_HOME/vim/vimrc"
export LESSHISTFILE=-
export LYNX_CFG="$XDG_CONFIG_HOME/lynx/lynx.cfg"
export NODE_REPL_HISTORY="$XDG_DATA_HOME"/node_repl_history
@@ -28,9 +30,30 @@ export SCREENRC="$XDG_CONFIG_HOME"/screen/screenrc
export DOCKER_CONFIG="$XDG_CONFIG_HOME"/docker
export MACHINE_STORAGE_PATH="$XDG_DATA_HOME"/docker-machine
+# Local programs
+export NB_PATH="$XDG_DATA_HOME/notebook"
+
+# Make `history` print timestamp
+HISTTIMEFORMAT="%F %T "
+
# Setup editor
-export VISUAL=vim
+export VISUAL=vi
export EDITOR="$VISUAL"
# Local executables
export PATH=${PATH}:~/.local/bin
+
+chance() {
+ # Hit or miss
+ [ -f "${1}" ] && . "${1}"
+}
+
+mich() {
+ # Muted which
+ which "$@" >/dev/null 2>/dev/null
+}
+
+chance "${XDG_CONFIG_HOME}/sh/aliases"
+chance "${XDG_CONFIG_HOME}/sh/plugin/index"
+chance "${XDG_CONFIG_HOME}/sh/unstaged"
+