dotfiles

Cross platform dotfiles for linux, mac and windows

commit dacba0e39e5b41133b04c1e3368affec05fe009a
parent 978568e7a0712ac217c37f14aad36c95ac192b6a
Author: Bharatvaj <bharatvaj@yahoo.com>
Date: Thu, 3 Mar 2022 22:49:24 +0530

Merge pull request #28 from bharatvaj/macos

Git aliases
13 files changed, 114 insertions(+), 46 deletions(-)
M
.bash_profile
|
1
-
M
.config/.gitignore
|
20
+++++++++++---------
M
.config/alacritty/alacritty.yml
|
9
---------
M
.config/bash/bashrc
|
6
++++++
A
.config/git/config
|
23
+++++++++++++++++++++++
M
.config/sh/aliases
|
11
+++++++++--
M
.config/sh/plugin/git
|
14
++------------
M
.config/sh/plugin/shorthand
|
4
++--
M
.config/tmux/tmux.conf
|
19
+++++++++++++++++++
M
.config/vim/keybindings/keybindings.vim
|
6
------
A
.config/vim/themes/themes.vim
|
0
M
.config/vim/vimrc
|
25
+++++++++++++++++++++++++
M
.profile
|
22
+++++++++++++++++-----
diff --git a/.bash_profile b/.bash_profile
@@ -1,7 +1,6 @@
 # If not running interactively, don't do anything
 [[ $- != *i* ]] && return
 
-set -o vi
 
 [ -f ~/.profile ] && . ~/.profile
 [ -f "${XDG_CONFIG_HOME}/bash/bashrc" ] && . "${XDG_CONFIG_HOME}"/bash/bashrc
diff --git a/.config/.gitignore b/.config/.gitignore
@@ -2,22 +2,24 @@
 *
 
 !.gitignore
+!X11
 !alacritty/
 !alacritty/**
 !bash/
 !bash/**
-!sh/
-!sh/**
+!git/
+!git/config
 !i3
-!nvim
-!nvim/**
-!vim/
-!vim/**
-!X11
-!wgetrc
 !lynx/
 !lynx/lynx.cfg
 !lynx/lynx.lss
+!nvim
+!nvim/**
+!sh/
+!sh/**
 !tmux/
-!tmux/*
+!tmux/tmux.conf
 !user-dirs.dirs
+!vim/
+!vim/**
+!wgetrc
diff --git a/.config/alacritty/alacritty.yml b/.config/alacritty/alacritty.yml
@@ -5,13 +5,4 @@ import:
   - ~/.config/alacritty/theme.yml
   - ~/.config/alacritty/font.yml
 
-cursor:
-  style:
-    shape: Beam
-
 live_config_reload: true
-
-shell:
-  program: bash
-  args:
-    - --login
diff --git a/.config/bash/bashrc b/.config/bash/bashrc
@@ -1 +1,7 @@
+set -o vi
 
+PATH_EXPORTS=( "${ESSENTIAL_PATH_EXPORTS[@]}" "${OTHER_PATH_EXPORTS[@]}" )
+
+export PATH="${PATH}:${PATH_EXPORTS[*]}"
+
+[ -f /usr/local/etc/profile.d/autojump.sh ] && . /usr/local/etc/profile.d/autojump.sh
diff --git a/.config/git/config b/.config/git/config
@@ -0,0 +1,23 @@
+[alias]
+	a = add
+	b = branch
+	ba = branch --all
+	c = commit
+	cm = commit --message
+	co = checkout
+	d = diff
+	ds = diff --staged
+	ld = log --pretty=format:"%h %ad %s" --date=short --all
+	lg = log --graph --oneline --decorate --all
+	p = pull
+	st = status
+	wt = worktree
+
+[difftool]
+	prompt = false
+
+[init]
+	defaultBranch = main
+
+[include]
+	path = config.user
diff --git a/.config/sh/aliases b/.config/sh/aliases
@@ -2,13 +2,14 @@ mich abook && alias abook='abook --config "$XDG_CONFIG_HOME"/abook/abookrc --dat
 mich startx && alias startx='startx "$XDG_CONFIG_HOME/X11/xinitrc" vt1'
 mich wget && alias wget='wget --hsts-file="$XDG_CACHE_HOME/wget-hsts"'
 mich mbsync && alias mbsync='mbsync -c "$XDG_CONFIG_HOME"/isync/mbsyncrc'
-mich nvim && alias vim=nvim
 mich emcc && alias emcc='emcc --em-config "$XDG_CONFIG_HOME"/emscripten/config --em-cache "$XDG_CACHE_HOME"/emscripten/cache'
 mich dict && alias dict='dict -c "$XDG_CONFIG_HOME"/dict/dictrc'
+mich btpd && alias btpd='btpd -d "$XDG_DATA_HOME"/btpd'
+mich abook && alias abook='abook -C "$XDG_CONFIG_HOME"/abook/abookrc --datafile "$XDG_DATA_HOME"/abook/addressbook'
 
 # conditioning
 ## ls conditioning
-mich sl && alias lls=sl && alias llls=sl && alias sls=sl && alias lsl=sl && alias lss=sl
+mich sl && alias ld='sl' && alias lls='sl' && alias llls=sl && alias sls=sl && alias lsl=sl && alias lss=sl && alias kls=sl
 
 ## cd conditioning
 mich sl && alias cdd=sl

@@ -16,3 +17,9 @@ mich sl && alias cdd=sl
 # ip
 mich ifconfig && alias lip="ifconfig | grep -w inet  | cut -d ' ' -f2"
 mich curl && alias gip="curl ifconfig.co"
+
+duck() {
+	url="$*"
+	lynx "https://duckduckgo.com/lite?q=$url"
+}
+alias '?'='duck'
diff --git a/.config/sh/plugin/git b/.config/sh/plugin/git
@@ -1,16 +1,6 @@
 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'
+
+alias g='git'
 
 # ----------------------
 # Git Functions
diff --git a/.config/sh/plugin/shorthand b/.config/sh/plugin/shorthand
@@ -1,7 +1,7 @@
-# One letter bindings for important commands
+# Bindings for important commands
 
 [ -n "${EDITOR}" ] && alias e='${EDITOR}'
 
-alias c=clear
+alias cls=clear
 mich git && alias g=git
 mich pass && alias p=pass
diff --git a/.config/tmux/tmux.conf b/.config/tmux/tmux.conf
@@ -40,3 +40,22 @@ set -g status-bg black
 set -g status-fg white
 set -g window-status-current-style "bg=white,fg=black"
 
+# Smart pane switching with awareness of Vim splits.
+# See: https://github.com/christoomey/vim-tmux-navigator
+is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
+    | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
+bind-key -n 'C-h' if-shell "$is_vim" 'send-keys C-h'  'select-pane -L'
+bind-key -n 'C-j' if-shell "$is_vim" 'send-keys C-j'  'select-pane -D'
+bind-key -n 'C-k' if-shell "$is_vim" 'send-keys C-k'  'select-pane -U'
+bind-key -n 'C-l' if-shell "$is_vim" 'send-keys C-l'  'select-pane -R'
+tmux_version='$(tmux -V | sed -En "s/^tmux ([0-9]+(.[0-9]+)?).*/\1/p")'
+if-shell -b '[ "$(echo "$tmux_version < 3.0" | bc)" = 1 ]' \
+    "bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\'  'select-pane -l'"
+if-shell -b '[ "$(echo "$tmux_version >= 3.0" | bc)" = 1 ]' \
+    "bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\\\'  'select-pane -l'"
+
+bind-key -T copy-mode-vi 'C-h' select-pane -L
+bind-key -T copy-mode-vi 'C-j' select-pane -D
+bind-key -T copy-mode-vi 'C-k' select-pane -U
+bind-key -T copy-mode-vi 'C-l' select-pane -R
+bind-key -T copy-mode-vi 'C-\' select-pane -l
diff --git a/.config/vim/keybindings/keybindings.vim b/.config/vim/keybindings/keybindings.vim
@@ -5,12 +5,6 @@ nnoremap <leader>f :find
 nnoremap <Leader>l :ls<CR>:b<space>
 nmap <leader>F :GFiles<cr>
 
-" 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>
diff --git a/.config/vim/themes/themes.vim b/.config/vim/themes/themes.vim
diff --git a/.config/vim/vimrc b/.config/vim/vimrc
@@ -61,8 +61,33 @@ set shiftwidth=4
 " Netrw customization
 let g:netrw_banner = 0
 
+" 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
+hi VertSplit term=NONE cterm=NONE gui=NONE
+
+"TODO use inverse colors from fg and bg instead of hardcoding black and white values
+hi LineNr ctermbg=Black ctermfg=White
+
+" Prominent Cursor Line
+hi CursorLineNr ctermbg=White ctermfg=Black
+
 " Disable status
 set laststatus=1
+set nowrapscan
+
+" Plugins
+source $XDG_CONFIG_HOME/vim/plugin/plugin.vim
 
 " Keybindings
 source $XDG_CONFIG_HOME/vim/keybindings/keybindings.vim
diff --git a/.profile b/.profile
@@ -11,7 +11,6 @@ export VIMINIT="source $XDG_CONFIG_HOME/vim/vimrc"
 export LESSHISTFILE=-
 export LYNX_CFG="$XDG_CONFIG_HOME/lynx/lynx.cfg"
 export LYNX_LSS="$XDG_CONFIG_HOME/lynx/lynx.lss"
-export GNUPGHOME="$XDG_DATA_HOME/gnupg"
 export PSQLRC="$XDG_CONFIG_HOME/pg/psqlrc"
 export PGPASSFILE="$XDG_CONFIG_HOME/pg/pgpass"
 export PGSERVICEFILE="$XDG_CONFIG_HOME/pg/pg_service.conf"

@@ -24,23 +23,35 @@ export SCREENRC="$XDG_CONFIG_HOME"/screen/screenrc
 export DOCKER_CONFIG="$XDG_CONFIG_HOME"/docker
 export INPUTRC="$XDG_CONFIG_HOME"/readline/inputrc
 export NOTMUCH_CONFIG="$XDG_CONFIG_HOME/notmuch/config"
-export NPM_CONFIG_USERCONFIG=$XDG_CONFIG_HOME/npm/npmrc
-export FFMPEG_DATADIR="$XDG_CONFIG_HOME"/ffmpeg
+export NPM_CONFIG_USERCONFIG="$XDG_CONFIG_HOME/npm/npmrc"
 export EM_CONFIG="$XDG_CONFIG_HOME"/emscripten/config
+export ELINKS_CONFDIR="$XDG_CONFIG_HOME/elinks"
 
+export FFMPEG_DATADIR="$XDG_DATA_HOME"/ffmpeg
+export GNUPGHOME="$XDG_DATA_HOME/gnupg"
 export ATOM_HOME="$XDG_DATA_HOME"/atom
 export NODE_REPL_HISTORY="$XDG_DATA_HOME"/node_repl_history
 export PASSWORD_STORE_DIR="$XDG_DATA_HOME"/pass
-export HISTFILE="$XDG_DATA_HOME"/bash/history
+export HISTFILE="$XDG_DATA_HOME"/history
 export RUSTUP_HOME="$XDG_DATA_HOME"/rustup
 export MACHINE_STORAGE_PATH="$XDG_DATA_HOME"/docker-machine
 export GOPATH="$XDG_DATA_HOME"/go
 export NB_PATH="$XDG_DATA_HOME/notebook"
 export EM_PORTS="$XDG_DATA_HOME"/emscripten/cache
+export CARGO_HOME="$XDG_DATA_HOME"/cargo
+export GEM_HOME="$XDG_DATA_HOME"/gem
+export TERMINFO="$XDG_DATA_HOME/terminfo"
+export TERMINFO_DIRS="$XDG_DATA_HOME/terminfo":/usr/share/terminfo
+export VSCODE_PORTABLE="$XDG_DATA_HOME/vscode"
+export GRADLE_USER_HOME="$XDG_DATA_HOME"/gradle
+export SQLITE_HISTORY="$XDG_DATA_HOME/sqlite_history"
+export MYSQL_HISTFILE="$XDG_DATA_HOME/mysql_history"
+# export ZDOTDIR="$XDG_DATA_HOME/zsh"
 
 export PSQL_HISTORY="$XDG_CACHE_HOME/pg/psql_history"
 export NUGET_PACKAGES="$XDG_CACHE_HOME"/NuGetPackages
 export EM_CACHE="$XDG_CACHE_HOME"/emscripten/cache
+export GEM_SPEC_CACHE="$XDG_CACHE_HOME"/gem
 
 # Make `history` print timestamp
 HISTTIMEFORMAT="%F %T "

@@ -60,7 +71,8 @@ mich() {
 
 # Setup editor
 
-export VISUAL=$(mich nvim && echo nvim || echo vim )
+# export VISUAL=$(mich nvim && echo nvim || echo vim )
+export VISUAL=nvi
 export EDITOR="$VISUAL"
 
 export BROWSER=$(mich lynx && echo lynx)