commit b192b5171ab1456dc9879c7dc71341820cc769cb
parent ef91c3ba32c4f286c8435969f1d79d2b4e9a391e
Author: Bharatvaj <bharatvaj@yahoo.com>
Date: Fri, 5 Nov 2021 17:49:22 +0530
Merge base into termux
Diffstat:
21 files changed, 152 insertions(+), 138 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"
-which elinks >&/dev/null && alias elinks="elinks ddg.gg"
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,9 +0,0 @@
-# One letter bindings for important commands
-
-[ ! -z "${EDITOR}" ] && alias e=${EDITOR}
-
-alias c=clear
-
-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,7 @@
+mich startx && alias startx="startx \"$XDG_CONFIG_HOME/X11/xinitrc\" vt1"
+mich wget && alias wget="wget --hsts-file=\"$XDG_CACHE_HOME/wget-hsts\""
+mich nvim && alias vim=nvim
+
+# ls conditioning
+mich sl && alias lls=sl && alias llls=sl && alias sls=sl
+
diff --git a/.config/sh/plugin/git b/.config/sh/plugin/git
@@ -0,0 +1,20 @@
+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 gds='git diff --staged'
+alias gst='git status'
+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/keybindings/keybindings.vim b/.config/vim/keybindings/keybindings.vim
@@ -1,6 +1,21 @@
" General keybindings
nnoremap <leader>t :tabnew<cr>
nnoremap <leader>p :Rg<cr>
+nnoremap <leader>f :find
+
+" Buffer Navigation
+nnoremap <C-J> <C-W><C-J>
+nnoremap <C-K> <C-W><C-K>
+nnoremap <C-L> <C-W><C-L>
+nnoremap <C-H> <C-W><C-H>
+
+" Buffer Creation
+nnoremap <Leader>v :vsplit<enter>
+nnoremap <Leader>s :split<enter>
+
+" Quick save and write
+nnoremap <leader>w :w<cr>
+nnoremap <leader>q :q<cr>
" Plugin keybindings
source $XDG_CONFIG_HOME/vim/keybindings/vimspector.vim
diff --git a/.config/vim/keybindings/markdown.vim b/.config/vim/keybindings/markdown.vim
@@ -2,3 +2,11 @@ autocmd FileType markdown set cursorline
" Hide and format markdown elements like **bold**
autocmd FileType markdown set conceallevel=2
+
+function QuickUnderline(n)
+ if a:n == 1
+ normal! yypv$r=
+ else
+ normal! yypv$r-
+ endif
+endfunction
diff --git a/.config/vim/plugin/plugin.vim b/.config/vim/plugin/plugin.vim
@@ -8,19 +8,33 @@ function DownloadPlug()
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 'junegunn/fzf', { 'do': { -> fzf#install() } }
- Plug 'junegunn/fzf.vim'
+ Plug 'tpope/vim-commentary'
+ Plug 'tpope/vim-surround'
+ Plug 'tpope/vim-fugitive'
+ Plug 'tpope/vim-repeat'
+ Plug 'tommcdo/vim-ninja-feet'
+ Plug 'ap/vim-css-color'
+ Plug 'itchyny/lightline.vim'
+ Plug 'wellle/context.vim'
+ Plug 'easymotion/vim-easymotion'
+ Plug 'SirVer/ultisnips'
+ Plug 'sainnhe/gruvbox-material'
+ Plug 'ntpeters/vim-better-whitespace'
+ Plug 'lpinilla/vim-codepainter'
+ Plug '907th/vim-auto-save'
+ Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
+ Plug 'junegunn/fzf.vim'
source $XDG_CONFIG_HOME/vim/plugin/development.vim
call plug#end()
+" Enable auto save only if backups are disabled
+if exists("nowb")
+ let g:auto_save = 1
+endif
+
" Plugin Keybindings
" fzf
nmap <leader>F :GFiles<cr>
-nmap <leader>f :Files<cr>
nnoremap <leader>cc :ChecklistToggleCheckbox<cr>
diff --git a/.config/vim/vimrc b/.config/vim/vimrc
@@ -16,8 +16,7 @@ set undodir=$XDG_CACHE_HOME/vim/undo | call mkdir(&undodir, 'p')
if !has('nvim') | set viminfofile=$XDG_CACHE_HOME/vim/viminfo | endif
-" General
-
+" Line number
"Adapted from https://jeffkreeftmeijer.com/vim-number/
:set number
:augroup numbertoggle
@@ -26,14 +25,23 @@ if !has('nvim') | set viminfofile=$XDG_CACHE_HOME/vim/viminfo | endif
: autocmd BufLeave,FocusLost,InsertEnter,WinLeave * if &nu | set nornu | endif
:augroup END
+" General
set mouse=a
+set cursorline
syntax on
set exrc
+" Turn backup off
+set nobackup
+set nowb
+set noswapfile
" Map leader to space
nnoremap <SPACE> <Nop>
let mapleader = " "
+" Enable hidden buffers
+set hidden
+
" Disable auto fixing end of line
" Useful when opening binary files
set nofixendofline
@@ -44,22 +52,37 @@ set shortmess=Iat
" Search
set hlsearch
set incsearch
-
-" Anti-tab
+" Disable highlight after a search
+augroup vimrc-incsearch-highlight
+ autocmd!
+ autocmd CmdlineEnter /,\? :set hlsearch
+ autocmd CmdlineLeave /,\? :set nohlsearch
+augroup END
+
+" Pro tab
filetype plugin indent on
set tabstop=4
set shiftwidth=4
-set expandtab
" Netrw customization
let g:netrw_banner = 0
-" Hard vim
+" Harder vim
+" Disable arrow keys
for key in ['<Up>', '<Down>', '<Left>', '<Right>']
exec 'noremap' key '<Nop>'
exec 'inoremap' key '<Nop>'
exec 'cnoremap' key '<Nop>'
endfor
+" Disable h and l
+for key in ['h', 'l']
+ exec 'noremap' key '<Nop>'
+endfor
+
+" Visual Tweaks
+" Remove the ugly splits separator
+set fillchars=vert:\│
+hi VertSplit term=NONE cterm=NONE gui=NONE
" Plugins
source $XDG_CONFIG_HOME/vim/plugin/plugin.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,31 @@ export SCREENRC="$XDG_CONFIG_HOME"/screen/screenrc
export DOCKER_CONFIG="$XDG_CONFIG_HOME"/docker
export MACHINE_STORAGE_PATH="$XDG_DATA_HOME"/docker-machine
-# Setup editor
-export VISUAL=vim
-export EDITOR="$VISUAL"
+# Local programs
+export NB_PATH="$XDG_DATA_HOME/notebook"
+
+# Make `history` print timestamp
+HISTTIMEFORMAT="%F %T "
# Local executables
export PATH=${PATH}:~/.local/bin
+
+chance() {
+ # Hit or miss
+ [ -f "${1}" ] && . "${1}"
+}
+
+mich() {
+ # Muted which
+ which "$@" >/dev/null 2>/dev/null
+}
+
+# Setup editor
+
+export VISUAL=$(mich nvim && echo nvim || echo vim )
+export EDITOR="$VISUAL"
+
+chance "${XDG_CONFIG_HOME}/sh/aliases"
+chance "${XDG_CONFIG_HOME}/sh/plugin/index"
+chance "${XDG_CONFIG_HOME}/sh/unstaged"
+