commit 2d002e7cd28b67ce204abf77fc7b79f13f516f95
parent 73ed6170d7d6eff6a81f146376ed086fab85410f
Author: Bharatvaj Hemanth <bharatvaj@yahoo.com>
Date: Mon, 9 Dec 2024 19:53:36 +0530
Add .confgi/X11/Xresources for handling screens with varied dpi
Make templateDir in git optional
Make the check in cam script with uname switch case
Fix script breaking for filenames with spaces in extrach.sh
Add jk quick quick in .vimrc
Make .git ignore .local/bin, only subdirectories are not ignored
Diffstat:
8 files changed, 41 insertions(+), 14 deletions(-)
diff --git a/.config/X11/Xresources b/.config/X11/Xresources
@@ -0,0 +1,10 @@
+! These might also be useful depending on your monitor and personal preference:
+Xft.autohint: 0
+Xft.lcdfilter: lcddefault
+Xft.hintstyle: hintfull
+Xft.hinting: 1
+Xft.antialias: 1
+Xft.rgba: rgb
+
+! 4K Display
+! Xft.dpi: 192
diff --git a/.config/X11/xinitrc b/.config/X11/xinitrc
@@ -1,9 +1,9 @@
#!/bin/sh
-. $XDG_CONFIG_HOME/X11/keybindings
-
WM=dwm
+xrdb -merge $XDG_CONFIG_HOME/X11/Xresources
+
__type $WM || (echo "$WM not found" && exit 1)
__type slstatus && exec slstatus &
diff --git a/.config/git/config b/.config/git/config
@@ -42,7 +42,7 @@
[init]
defaultBranch = main
- templatedir = ~/.config/git/template
+ # templatedir = ~/.config/git/template
[include]
path = ~/.config/git/user
diff --git a/.config/sh/aliases b/.config/sh/aliases
@@ -2,12 +2,12 @@
alias abook='abook --config "$XDG_CONFIG_HOME"/abook/abookrc --datafile "$XDG_DATA_HOME"/abook/addressbook'
alias abook='abook -C "$XDG_CONFIG_HOME"/abook/abookrc --datafile "$XDG_DATA_HOME"/abook/addressbook'
alias dict='dict -c "$XDG_CONFIG_HOME"/dict/dictrc'
-alias mbsync='mbsync -c "$XDG_CONFIG_HOME"/isync/mbsyncrc'
+there mbsync && alias mbsync='mbsync -c "$XDG_CONFIG_HOME"/isync/mbsyncrc'
alias startx='startx "$XDG_CONFIG_HOME/X11/xinitrc" vt1'
alias wget='wget --hsts-file="$XDG_CACHE_HOME/wget-hsts"'
# [misc]
-alias doas=sudo
+# alias doas=sudo
alias qc='ssh $(ci)'
# [helper_functions]
@@ -55,5 +55,6 @@ alias girl='grep -irl'
alias gir='grep -ir'
alias markdown=md2html
alias fy='fzf | clip'
+alias o='xdg-open'
alias voom='VIM_DIR=$XDG_DATA_HOME/vim voom'
diff --git a/.gitignore b/.gitignore
@@ -18,7 +18,6 @@
# Local shell scripts
!.local/bin/
-# !.local/bin/**
!.local/bin/cmd/
!.local/bin/cmd/**
!.local/bin/sh/
diff --git a/.local/bin/sh/cam b/.local/bin/sh/cam
@@ -2,8 +2,10 @@
c_os="$(uname -s)"
-if [ "$c_os" == "Windows_NT" ]; then
- ffplay -f dshow -i video="Integrated Webcam"
-else
- ffplay -f avfoundation -i 0:0 -video_size 1280x720 -framerate 30
-fi
+case "$c_os" in
+ Windows_NT)
+ ffplay -f dshow -i video="Integrated Webcam";;
+ Darwin)
+ ffplay -f avfoundation -i 0:0 -video_size 1280x720 -framerate 30;;
+*) ffplay /dev/video0
+esac
diff --git a/.local/bin/sh/extract.sh b/.local/bin/sh/extract.sh
@@ -5,8 +5,8 @@
# Treat last argument as dest folder? or use -d
# Allow extraction of multple archives in the order
test $# -lt 1 && { printf "Usage: $(basename $0) <archive>\n"; exit 1; }
-test -f $1 || { printf "$0: $1: No such file \n"; exit 1; }
-case $1 in
+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" ;;
diff --git a/.vimrc b/.vimrc
@@ -5,12 +5,14 @@ endif
" reject netrw, embrace ls
"let loaded_netrwPlugin = 1
+"let g:netrw_home = $XDG_DATA_HOME . "/vim"
set complete-=i
set foldmethod=marker
set foldmarker={,}
set foldlevel=20
set foldopen-=search
+set background=dark
" Debug
let g:termdebug_config = {'sign': '>>', 'winbar': 0, 'wide':163}
@@ -58,7 +60,8 @@ set expandtab
" Netrw customization
let g:netrw_banner = 0
let g:netrw_liststyle = 3
-let g:netrw_fastbrowse= 2
+let g:netrw_fastbrowse = 2
+let g:netrw_dirhistmax = 0
" Disable status
set laststatus=1
@@ -169,3 +172,15 @@ source $XDG_CONFIG_HOME/vim/ftplugin/cpp.vim
source $XDG_DATA_HOME/vim/plugin.vim
let g:birck_default_chan="irc.libera.chat"
+
+" Map key chord `jk` to <Esc>
+let g:esc_j_lasttime = 0
+let g:esc_k_lasttime = 0
+function! JKescape(key)
+ if a:key == 'j' | let g:esc_j_lasttime = reltimefloat(reltime()) | endif
+ if a:key == 'k' | let g:esc_k_lasttime = reltimefloat(reltime()) | endif
+ let l:timediff = abs(g:esc_j_lasttime - g:esc_k_lasttime)
+ return (l:timediff <= 0.05 && l:timediff >=0.001) ? "\b\e" : a:key
+endfunction
+inoremap <expr> j JKescape('j')
+inoremap <expr> k JKescape('k')