dotfiles

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

commit 6328891be98cee5ea89ec6a05238c5c5dc166fba
parent b51ce9a900960b9ed213387b75e27fb7fdf49973
Author: bharatvaj.ph <bharatvaj.ph@zohocorp.com>
Date:   Sat, 23 Apr 2022 00:14:59 +0530

Merge branch 'base' of https://github.com/bharatvaj/dotfiles into windows

Diffstat:
M.bash_profile | 3+--
M.config/.gitignore | 22+++++++++++++++++-----
M.config/X11/xinitrc | 18+++++++++++++++---
A.config/alacritty/font.yml | 15+++++++++++++++
A.config/alacritty/theme.yml | 31+++++++++++++++++++++++++++++++
D.config/bash/aliases | 4----
M.config/bash/bashrc | 23+++++------------------
D.config/bash/plugin/git | 43-------------------------------------------
D.config/bash/plugin/index | 13-------------
A.config/git/config | 30++++++++++++++++++++++++++++++
M.config/i3/config | 36+++++++++++++++---------------------
A.config/lf/lfrc | 3+++
A.config/lynx/lynx.cfg | 36++++++++++++++++++++++++++++++++++++
A.config/lynx/lynx.lss | 87+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
A.config/nvim/init.lua | 19+++++++++++++++++++
D.config/nvim/init.vim | 3---
R.config/bash/.gitignore -> .config/sh/.gitignore | 0
A.config/sh/aliases | 24++++++++++++++++++++++++
A.config/sh/plugin/git | 10++++++++++
A.config/sh/plugin/index | 13+++++++++++++
A.config/sh/plugin/shorthand | 7+++++++
A.config/tmux/tmux.conf | 68++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
A.config/vim/hyper.vim | 4++++
A.config/vim/keybindings/keybindings.vim | 55+++++++++++++++++++++++++++++++++++++++++++++++++++++++
A.config/vim/keybindings/markdown.vim | 12++++++++++++
A.config/vim/keybindings/rust.vim | 1+
A.config/vim/keybindings/vimspector.vim | 25+++++++++++++++++++++++++
A.config/vim/plugin/plugin.vim | 2++
A.config/vim/themes/themes.vim | 0
M.config/vim/vimrc | 30+++++++++++++++++-------------
A.gitattributes | 1+
M.gitignore | 4++++
A.gitmodules | 54++++++++++++++++++++++++++++++++++++++++++++++++++++++
A.local/bin/call | 7+++++++
A.local/bin/passfind | 21+++++++++++++++++++++
A.local/share/.gitignore | 2++
A.local/share/nvim/pack/general/start/nvim-lspconfig | 1+
A.local/share/vim/.gitignore | 1+
A.local/share/vim/pack/development/start/rust.vim | 1+
A.local/share/vim/pack/development/start/vim-cmake | 1+
A.local/share/vim/pack/development/start/vim-msbuild | 1+
A.local/share/vim/pack/general/start/editorconfig-vim | 1+
A.local/share/vim/pack/general/start/vim-better-whitespace | 1+
A.local/share/vim/pack/general/start/vim-codepainter | 1+
A.local/share/vim/pack/general/start/vim-commentary | 1+
A.local/share/vim/pack/general/start/vim-easymotion | 1+
A.local/share/vim/pack/general/start/vim-fugitive | 1+
A.local/share/vim/pack/general/start/vim-ninja-feet | 1+
A.local/share/vim/pack/general/start/vim-repeat | 1+
A.local/share/vim/pack/general/start/vim-surround | 1+
A.local/share/vim/pack/general/start/vim-textobj-user | 1+
A.local/share/vim/pack/general/start/vim-textobj-xmlattr | 1+
A.local/share/vim/pack/general/start/vim-tmux-navigator | 1+
A.local/share/vim/pack/general/start/vim-unimpaired | 1+
A.local/share/vim/pack/themes/start/gruvbox-material | 1+
M.profile | 81++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------
DX11.md | 12------------
57 files changed, 688 insertions(+), 150 deletions(-)

diff --git a/.bash_profile b/.bash_profile @@ -1,10 +1,9 @@ # If not running interactively, don't do anything [[ $- != *i* ]] && return + [ -f ~/.profile ] && . ~/.profile -[ -f ~/.personal/config ] && . ~/.personal/config [ -f "${XDG_CONFIG_HOME}/bash/bashrc" ] && . "${XDG_CONFIG_HOME}"/bash/bashrc # Zoho [ -f ~/.zoho/zoho ] && . ~/.zoho/zoho - diff --git a/.config/.gitignore b/.config/.gitignore @@ -2,14 +2,26 @@ * !.gitignore +!X11 !alacritty/ -!alacritty/* +!alacritty/** !bash/ -!bash/* +!bash/** +!git/ +!git/config !i3 +!lf +!lf/** +!lynx/ +!lynx/lynx.cfg +!lynx/lynx.lss !nvim +!nvim/** +!sh/ +!sh/** +!tmux/ +!tmux/tmux.conf +!user-dirs.dirs !vim/ -!vim/* -!X11 +!vim/** !wgetrc -!user-dirs.dirs diff --git a/.config/X11/xinitrc b/.config/X11/xinitrc @@ -1,3 +1,15 @@ -exec i3 & -exec hsetroot -solid "#000000" & -exec compton +#!/bin/sh + +__type() { + type "$@" >/dev/null 2>/dev/null +} + +__type i3 || (echo "i3 not found" && exit 1) + +__type setxkbmap && setxkbmap -option caps:escape +__type xbmap && xbmap +__type xrdb && xrdb merge ~/.config/X11/Xresources +__type hsetroot && exec hsetroot -solid "#000000" & +__type compton && exec compton & + +exec i3 diff --git a/.config/alacritty/font.yml b/.config/alacritty/font.yml @@ -0,0 +1,15 @@ +font: + normal: + family: Fira Code + style: SemiBold + + bold: + family: Fira Code + style: Bold + + italic: + family: Fira Code + style: Italic + + bold_italic: + family: Fira Code diff --git a/.config/alacritty/theme.yml b/.config/alacritty/theme.yml @@ -0,0 +1,31 @@ +# 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: '0xcc00ff' + cyan: '0x00ffff' + white: '0xd0d0d0' + + # Bright colors + bright: + black: '0x808080' + red: '0xfe0100' + green: '0x33ff00' + yellow: '0xfeff00' + blue: '0x0066ff' + magenta: '0xcc00ff' + cyan: '0x00ffff' + white: '0xFFFFFF' 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 @@ -1,25 +1,12 @@ -# -# ~/.bashrc -# - -# Make `history` print timestamp -HISTTIMEFORMAT="%F %T " +set -o vi 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 PATH="${PATH}:${PATH_EXPORTS[*]}" -export PS1="\w $ " +[ -f ${XDG_CONFIG_HOME}/bash/autojump.bash ] && ${XDG_CONFIG_HOME}/bash/autojump.bash -# Plugins -[ -f "${XDG_CONFIG_HOME}/bash/plugin/index" ] && . "${XDG_CONFIG_HOME}/bash/plugin/index" +PS1='\w ∆ ' -# Aliases -[ -f "${XDG_CONFIG_HOME}/bash/aliases" ] && . "${XDG_CONFIG_HOME}"/bash/aliases -# Unstaged -[ -f ~/.config/bash/unstaged ] && . ~/.config/bash/unstaged +[ -f /usr/local/etc/profile.d/autojump.sh ] && . /usr/local/etc/profile.d/autojump.sh diff --git a/.config/bash/plugin/git b/.config/bash/plugin/git @@ -1,43 +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 gi='git init' -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 gs='git status' -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,13 +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 diff --git a/.config/git/config b/.config/git/config @@ -0,0 +1,30 @@ +[alias] + a = add + b = branch + ba = branch --all + c = commit + ca = commit --amend + cl = clone + cm = commit --message + co = checkout + con = config + d = diff + ds = diff --staged + l = log + ld = log --pretty=format:"%h %ad %s" --date=short --all + lg = log --graph --oneline --decorate --all + p = pull + pu = push + rv = remote --verbose + st = status + suir = submodule update --init --recursive + wt = worktree + +[difftool] + prompt = false + +[init] + defaultBranch = main + +[include] + path = config.user diff --git a/.config/i3/config b/.config/i3/config @@ -30,8 +30,7 @@ font pango:monospace 8 floating_modifier $mod # start a terminal -bindsym $mod+Return exec --no-startup-id urxvt -name floating -for_window [class="URxvt" instance="floating"] floating enable +bindsym $mod+Return exec --no-startup-id alacritty # kill focused window bindsym $mod+Shift+q kill @@ -45,10 +44,10 @@ bindsym $mod+n exec sh ~/.config/i3/dmenu_search.sh # bindsym $mod+d exec --no-startup-id i3-dmenu-desktop # change focus -bindsym $mod+j focus left -bindsym $mod+k focus down -bindsym $mod+l focus up -bindsym $mod+semicolon focus right +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 @@ -57,10 +56,10 @@ bindsym $mod+Up focus up bindsym $mod+Right focus right # move focused window -bindsym $mod+Shift+j move left -bindsym $mod+Shift+k move down -bindsym $mod+Shift+l move up -bindsym $mod+Shift+semicolon move right +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 @@ -69,7 +68,7 @@ bindsym $mod+Shift+Up move up bindsym $mod+Shift+Right move right # split in horizontal orientation -bindsym $mod+h split h +bindsym $mod+s split h # split in vertical orientation bindsym $mod+v split v @@ -78,7 +77,7 @@ bindsym $mod+v split v bindsym $mod+f fullscreen toggle # change container layout (stacked, tabbed, toggle split) -bindsym $mod+s layout stacking +bindsym $mod+semicolon layout stacking bindsym $mod+w layout tabbed bindsym $mod+e layout toggle split @@ -133,10 +132,10 @@ mode "resize" { # 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 j resize shrink width 10 px or 10 ppt - bindsym k resize grow height 10 px or 10 ppt - bindsym l resize shrink height 10 px or 10 ppt - bindsym semicolon resize grow width 10 px or 10 ppt + 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 @@ -156,9 +155,4 @@ client.focused #f5f5f5 #f5f5f5 #000000 #f5f5f5 new_window 1pixel bar { - status_command i3status } - -#force floating for all windows -for_window [class="[.]*"] floating enable -for_window [window_role="pop-up"] floating enable diff --git a/.config/lf/lfrc b/.config/lf/lfrc @@ -0,0 +1,3 @@ +map . set hidden! +map v :toggle; down +map V :invert diff --git a/.config/lynx/lynx.cfg b/.config/lynx/lynx.cfg @@ -0,0 +1,36 @@ +STARTFILE:https://lite.duckduckgo.com/lite/ +VI_KEYS_ALWAYS_ON:TRUE +ACCEPT_ALL_COOKIES:TRUE +TEXTFIELDS_NEED_ACTIVATION:TRUE + +AUTO_SESSION:TRUE +SESSION_FILE:./.cache/lynx/lynx_session + +BOOKMARK_FILE:ON +DEFAULT_BOOKMARK_FILE:./.cache/lynx/lynx_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 + +# Status line pausing +INFOSECS:0.5 +MESSAGESECS:0.5 +ALERTSECS:3 +NO_PAUSE:TRUE + +USE_EXTERNALS:TRUE +DEFAULT_USER_MODE:ADVANCED +EXTERNAL:http:open -u %s &:TRUE +KEYMAP:o:ECGOTO +KEYMAP:O:GOTO +KEYMAP:g:HOME +KEYMAP:G:END + +DOWNLOADER:wget:wget %s:TRUE diff --git a/.config/lynx/lynx.lss b/.config/lynx/lynx.lss @@ -0,0 +1,87 @@ +em: bold: brightblue +strong: bold: brightred +b: bold: red +i: bold: brightblue +a: bold: green +img: dim: brown +fig: normal: gray +caption: reverse: brown +hr: normal: yellow +blockquote: normal: brightblue +ul: normal: brown +address: normal: magenta +title: normal: magenta +tt: dim: brightmagenta: black +h1: bold: black: white +label: normal: magenta +q: normal: yellow: magenta +small: dim: default +big: bold: yellow +sup: bold: yellow +sub: dim: gray +li: normal: magenta +code: normal: cyan +cite: normal: cyan + +table: normal: brightcyan +tr: bold: brown +td: normal: default +br: normal: default + +alink: normal: black: lightgray +status: reverse: black: lightgray +alert: bold: yellow: red +whereis: reverse+underline: magenta: cyan + +menu.bg: normal: black: lightgray +menu.frame: normal: black: lightgray +menu.entry: normal: lightgray: black +menu.n: normal: red: gray +menu.active: normal: yellow: black +menu.sb: normal: brightred: lightgray + +forwbackw.arrow:reverse +hot.paste: normal: brightred: gray + +# Styles with classes - <ul class=red> etc. +ul.red: underline: brightred +ul.blue: bold: brightblue +li.red: reverse: red: yellow +li.blue: bold: blue +strong.a: bold: black: red +em.a: reverse: black: blue +strong.b: bold: white: red +em.b: reverse: white: blue +strong.debug: reverse: green +font.letter: normal: white: blue +input.submit: normal: cyan +tr.baone: bold: yellow +tr.batwo: bold: green +tr.bathree: bold: red + +# Special handling for link. +link: normal: white +link.green: bold: brightgreen +link.red: bold: black: red +link.blue: bold: white: blue +link.toc: bold: black: white + +# Special cases for link - the rel or title is appended after the class. +# <link rel=next class=red href="1"> +link.red.next: bold: red +link.red.prev: bold: yellow: red +link.blue.prev: bold: yellow: blue +link.blue.next: bold: blue +link.green.toc: bold: white: green + +# Define styles that will be used when syntax highlighting is requested +span.htmlsrc_comment:normal: white +span.htmlsrc_tag:normal: white +span.htmlsrc_attrib:normal: cyan +span.htmlsrc_attrval:normal: magenta +span.htmlsrc_abracket:normal: white +span.htmlsrc_entity:normal: white +span.htmlsrc_badseq:normal: red +span.htmlsrc_badtag:normal: red +span.htmlsrc_badattr:normal: red +span.htmlsrc_sgmlspecial:normal: yellow diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua @@ -0,0 +1,19 @@ +vim.g.mapleader = ' ' +local set = vim.opt + +set.packpath="$XDG_DATA_HOME/nvim" + +local map = require("utils").map + +map("n", "<Leader>ww", ":w<CR>", { silent = true }) +map("n", "<Leader>wq", ":wq<CR>", { silent = true }) +map("n", "<Leader>qq", ":q<CR>", { silent = true }) +map("n", "<CR>", ":noh<CR>", { silent = true }) + +set.tabstop=4 +set.exrc=false + + +require'lspconfig'.pyright.setup{} + +set.shortmess="Iat" diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim @@ -1,3 +0,0 @@ -set runtimepath^=$XDG_CONFIG_HOME/vim/.vimrc runtimepath+=$XDG_CONFIG_HOME/vim/after -let &packpath=&runtimepath -" source $XDG_CONFIG_HOME/vim/.vimrc diff --git a/.config/bash/.gitignore b/.config/sh/.gitignore diff --git a/.config/sh/aliases b/.config/sh/aliases @@ -0,0 +1,24 @@ +mich abook && alias abook='abook --config "$XDG_CONFIG_HOME"/abook/abookrc --datafile "$XDG_DATA_HOME"/abook/addressbook' +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 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' +mich vim && alias v='vim' +mich nvim && alias n='nvim' + +# conditioning +## ls conditioning +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 + +# ip +mich ifconfig && alias lip="ifconfig | grep -w inet | cut -d ' ' -f2" +mich curl && alias gip="curl ifconfig.co" + +alias '?d'='sr duckduckgo' +alias l=lfcd diff --git a/.config/sh/plugin/git b/.config/sh/plugin/git @@ -0,0 +1,10 @@ +mich git || return + +alias g='git' + +# ---------------------- +# 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 @@ +# Bindings for important commands + +[ -n "${EDITOR}" ] && alias e='${EDITOR}' + +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 @@ -0,0 +1,68 @@ +# Miscellaneous +set -g base-index 1 +set escape-time 0 +set -g set-titles on + +# Status bar +set -g status-position top +set -g status-justify absolute-centre +set -g status-right "" +set -g status-keys vi +bind v split-window -h +bind s split-window -v + +# Navigation +set-window-option -g mode-keys vi + +bind -n C-h select-pane -L +bind -n C-j select-pane -D +bind -n C-k select-pane -U +bind -n C-l select-pane -R + +bind J resize-pane -D 5 +bind K resize-pane -U 5 +bind H resize-pane -L 5 +bind L resize-pane -R 5 + +# Clipboard +unbind -T copy-mode-vi Space +unbind -T copy-mode-vi Enter + +bind -T copy-mode-vi v send-keys -X begin-selection +bind -T copy-mode-vi y send-keys -X copy-selection-and-cancel + +set-option -g mouse on +setw -g mode-keys vi +set-option -s set-clipboard off +bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "pbcopy" +bind P paste-buffer + +# Themes +set -g status-bg black +set -g status-fg white +set -g status-right "#(mpc current)" +set -g window-status-current-style "bg=black,fg=red" +set -g pane-active-border-style "fg=red" + +# 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 +bind R source-file ~/.config/tmux/tmux.conf +bind N display-popup -E "ncmpcpp --quiet --screen visualizer" + diff --git a/.config/vim/hyper.vim b/.config/vim/hyper.vim @@ -0,0 +1,4 @@ +hi LineNr guifg=DarkGray ctermfg=DarkGray +hi LineNrAbove guifg=LightGray ctermfg=LightGray +hi LineNrBelow guifg=LightGray ctermfg=LightGray + diff --git a/.config/vim/keybindings/keybindings.vim b/.config/vim/keybindings/keybindings.vim @@ -0,0 +1,55 @@ +" General keybindings +nnoremap <leader>t :tabnew<cr> +nnoremap <leader>p :Rg<cr> +nnoremap <leader>f :find +nnoremap <Leader>l :ls<CR>:b<space> +nmap <leader>F :GFiles<cr> +nnoremap <leader>co :copen<cr> +nnoremap <leader>g :grep +nnoremap Y y$ + +fun! SetupCommandAlias(from, to) + exec 'cnoreabbrev <expr> '.a:from + \ .' ((getcmdtype() is# ":" && getcmdline() is# "'.a:from.'")' + \ .'? ("'.a:to.'") : ("'.a:from.'"))' +endfun +call SetupCommandAlias("W","w") +call SetupCommandAlias("Wq","wq") + +function! ToggleList() + if &list == "nolist" + set list + else + set nolist + endif +endfunction + +nnoremap <leader>tl :call ToggleList()<CR> + +" Buffer Creation +nnoremap <Leader>v :vsplit<enter> +nnoremap <Leader>s :split<enter> + +" Quick save and write +nnoremap <leader>wq :wq<cr> +nnoremap <leader>ww :w<cr> +nnoremap <leader>qq :q<cr> + +" Run Make +nnoremap <leader>bb :make<CR> + +" Generate ctags +map <leader>c :!ctags -R -f ./.git/tags .<CR> + +nnoremap <CR> :noh<CR><CR>:<backspace> + +" Plugin keybindings +source ~/.config/vim/keybindings/vimspector.vim +source ~/.config/vim/keybindings/markdown.vim + +" Development keybindings +" TODO Have a default build hotkey keybinding, maybe bb,br? +" And make it based on the project +" Make it as a filetype plugin. This should cover most cases. +nnoremap <leader>cb :Cargo build<cr> +nnoremap <leader>cr :Cargo run<cr> diff --git a/.config/vim/keybindings/markdown.vim b/.config/vim/keybindings/markdown.vim @@ -0,0 +1,12 @@ +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/keybindings/rust.vim b/.config/vim/keybindings/rust.vim @@ -0,0 +1 @@ + diff --git a/.config/vim/keybindings/vimspector.vim b/.config/vim/keybindings/vimspector.vim @@ -0,0 +1,25 @@ +fun! GotoWindow(id) + call win_gotoid(a:id) +endfun + +" Debugger remaps +nnoremap <leader>dd :call vimspector#Launch()<CR> +nnoremap <leader>dc :call GotoWindow(g:vimspector_session_windows.code)<CR> +nnoremap <leader>dt :call GotoWindow(g:vimspector_session_windows.tagpage)<CR> +nnoremap <leader>dv :call GotoWindow(g:vimspector_session_windows.variables)<CR> +nnoremap <leader>dw :call GotoWindow(g:vimspector_session_windows.watches)<CR> +nnoremap <leader>ds :call GotoWindow(g:vimspector_session_windows.stack_trace)<CR> +nnoremap <leader>do :call GotoWindow(g:vimspector_session_windows.output)<CR> +nnoremap <leader>de :call vimspector#Reset()<CR> + +nnoremap <leader>dtcb :call vimspector#CleanLineBreakpoint()<CR> + +nmap <leader>dl <Plug>VimspectorStepInto +nmap <leader>dj <Plug>VimspectorStepOver +nmap <leader>dk <Plug>VimspectorStepOut +nmap <leader>d_ <Plug>VimspectorRestart +nnoremap <leader>d<space> :call vimspector#Continue()<CR> + +nmap <leader>drc <Plug>VimspectorRunToCursor +nmap <leader>dbp <Plug>VimspectorToggleBreakpoint +nmap <leader>dcbp <Plug>VimspectorToggleConditionalBreakpoint diff --git a/.config/vim/plugin/plugin.vim b/.config/vim/plugin/plugin.vim @@ -0,0 +1,2 @@ +" Plugin Keybindings +nnoremap <leader>cc :ChecklistToggleCheckbox<cr> diff --git a/.config/vim/themes/themes.vim b/.config/vim/themes/themes.vim diff --git a/.config/vim/vimrc b/.config/vim/vimrc @@ -1,43 +1,47 @@ -if !has('nvim') | set viminfofile=$XDG_CACHE_HOME/vim/viminfo | endif +if !has('nvim') | set viminfofile=$XDG_CACHE_DIR/vim/viminfo | endif " General set number set mouse= set nocursorline set exrc +set scrolloff=8 + +" 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 " Disable vim intro message -set shortmess=I +set shortmess=Iat " Search set hlsearch set incsearch -" Anti-tab +" Pro tab filetype plugin indent on set tabstop=4 set shiftwidth=4 -set expandtab " Netrw customization let g:netrw_banner = 0 -" 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 + set lazyredraw set ttyfast diff --git a/.gitattributes b/.gitattributes @@ -0,0 +1 @@ +* text eol=lf diff --git a/.gitignore b/.gitignore @@ -14,3 +14,7 @@ # Config !.config/ +# Local shell scripts +!.local/ +!.local/bin/ +!.local/bin/* diff --git a/.gitmodules b/.gitmodules @@ -0,0 +1,54 @@ +[submodule ".local/share/vim/pack/development/start/rust.vim"] + path = .local/share/vim/pack/development/start/rust.vim + url = https://git::@github.com/rust-lang/rust.vim.git +[submodule ".local/share/vim/pack/development/start/vim-cmake"] + path = .local/share/vim/pack/development/start/vim-cmake + url = https://git::@github.com/cdelledonne/vim-cmake.git +[submodule ".local/share/vim/pack/development/start/vim-msbuild"] + path = .local/share/vim/pack/development/start/vim-msbuild + url = https://git::@github.com/heaths/vim-msbuild.git +[submodule ".local/share/vim/pack/general/start/editorconfig-vim"] + path = .local/share/vim/pack/general/start/editorconfig-vim + url = https://git::@github.com/editorconfig/editorconfig-vim.git +[submodule ".local/share/vim/pack/general/start/vim-better-whitespace"] + path = .local/share/vim/pack/general/start/vim-better-whitespace + url = https://git::@github.com/ntpeters/vim-better-whitespace.git +[submodule ".local/share/vim/pack/general/start/vim-codepainter"] + path = .local/share/vim/pack/general/start/vim-codepainter + url = https://git::@github.com/lpinilla/vim-codepainter.git +[submodule ".local/share/vim/pack/general/start/vim-commentary"] + path = .local/share/vim/pack/general/start/vim-commentary + url = https://git::@github.com/tpope/vim-commentary.git +[submodule ".local/share/vim/pack/general/start/vim-easymotion"] + path = .local/share/vim/pack/general/start/vim-easymotion + url = https://git::@github.com/easymotion/vim-easymotion.git +[submodule ".local/share/vim/pack/general/start/vim-fugitive"] + path = .local/share/vim/pack/general/start/vim-fugitive + url = https://git::@github.com/tpope/vim-fugitive.git +[submodule ".local/share/vim/pack/general/start/vim-ninja-feet"] + path = .local/share/vim/pack/general/start/vim-ninja-feet + url = https://git::@github.com/tommcdo/vim-ninja-feet.git +[submodule ".local/share/vim/pack/general/start/vim-repeat"] + path = .local/share/vim/pack/general/start/vim-repeat + url = https://git::@github.com/tpope/vim-repeat.git +[submodule ".local/share/vim/pack/general/start/vim-surround"] + path = .local/share/vim/pack/general/start/vim-surround + url = https://git::@github.com/tpope/vim-surround.git +[submodule ".local/share/vim/pack/general/start/vim-textobj-user"] + path = .local/share/vim/pack/general/start/vim-textobj-user + url = https://git::@github.com/kana/vim-textobj-user.git +[submodule ".local/share/vim/pack/general/start/vim-textobj-xmlattr"] + path = .local/share/vim/pack/general/start/vim-textobj-xmlattr + url = https://git::@github.com/whatyouhide/vim-textobj-xmlattr.git +[submodule ".local/share/vim/pack/general/start/vim-unimpaired"] + path = .local/share/vim/pack/general/start/vim-unimpaired + url = https://github.com/tpope/vim-unimpaired +[submodule ".local/share/vim/pack/themes/start/gruvbox-material"] + path = .local/share/vim/pack/themes/start/gruvbox-material + url = https://git::@github.com/sainnhe/gruvbox-material.git +[submodule ".local/share/vim/pack/general/start/vim-tmux-navigator"] + path = .local/share/vim/pack/general/start/vim-tmux-navigator + url = https://github.com/christoomey/vim-tmux-navigator +[submodule ".local/share/nvim/pack/general/start/nvim-lspconfig"] + path = .local/share/nvim/pack/general/start/nvim-lspconfig + url = https://github.com/neovim/nvim-lspconfig diff --git a/.local/bin/call b/.local/bin/call @@ -0,0 +1,7 @@ +export TERMUX_CONTACTS_LIST="$(termux-contact-list)" + +export CNA="$(echo "${TERMUX_CONTACTS_LIST}" | jq '.[] | .name' | fzf)" + +CONTACT_NUMBER="$(echo "${TERMUX_CONTACTS_LIST}" | jq -r ".[] | select(.name==$CNA) | .number")" +echo "${CONTACT_NUMBER}" +termux-telephony-call "${CONTACT_NUMBER}" diff --git a/.local/bin/passfind b/.local/bin/passfind @@ -0,0 +1,21 @@ +#!/bin/sh + +# Adapted from https://gist.github.com/heywoodlh/4c1e27f477a896bc3b0f6d55e2748d26 + +## Assumes that the user is using otp plugin +## Install fzf and make sure pass is configured beforehand + +## If you want to grab the totp code, use like so: `pass-fzf.sh otp`, otherwise script will assume you want password + +type="${1}" + +PASS_DIR=${XDG_DATA_HOME}/pass +selection="$(find -L ${PASS_DIR} -name '*.gpg' -exec realpath --relative-to=${PASS_DIR} {} | sed -e 's/.gpg//' | fzf --layout=reverse)" + +if [ "${type}" == "otp" ] +then + pass otp show "${selection}" +else + pass show "${selection}" +fi + diff --git a/.local/share/.gitignore b/.local/share/.gitignore @@ -0,0 +1,2 @@ +!vim/pack/ +!vim/pack/* diff --git a/.local/share/nvim/pack/general/start/nvim-lspconfig b/.local/share/nvim/pack/general/start/nvim-lspconfig @@ -0,0 +1 @@ +Subproject commit 54181ddb2709a4cd594e29bf82343c79196ec0c6 diff --git a/.local/share/vim/.gitignore b/.local/share/vim/.gitignore @@ -0,0 +1 @@ +!pack/**/start/** diff --git a/.local/share/vim/pack/development/start/rust.vim b/.local/share/vim/pack/development/start/rust.vim @@ -0,0 +1 @@ +Subproject commit c06a17151c69b9d61e60a28274932a28fd37c453 diff --git a/.local/share/vim/pack/development/start/vim-cmake b/.local/share/vim/pack/development/start/vim-cmake @@ -0,0 +1 @@ +Subproject commit 844b85677d52d932432eb115236d9173ebe3664d diff --git a/.local/share/vim/pack/development/start/vim-msbuild b/.local/share/vim/pack/development/start/vim-msbuild @@ -0,0 +1 @@ +Subproject commit 4766d9a225c433e7ce2625bcc6263bfd028c4a50 diff --git a/.local/share/vim/pack/general/start/editorconfig-vim b/.local/share/vim/pack/general/start/editorconfig-vim @@ -0,0 +1 @@ +Subproject commit 3078cd10b28904e57d878c0d0dab42aa0a9fdc89 diff --git a/.local/share/vim/pack/general/start/vim-better-whitespace b/.local/share/vim/pack/general/start/vim-better-whitespace @@ -0,0 +1 @@ +Subproject commit c5afbe91d29c5e3be81d5125ddcdc276fd1f1322 diff --git a/.local/share/vim/pack/general/start/vim-codepainter b/.local/share/vim/pack/general/start/vim-codepainter @@ -0,0 +1 @@ +Subproject commit 1ae0ee4f48e7e196ef90bc84ecbc56cad231e9df diff --git a/.local/share/vim/pack/general/start/vim-commentary b/.local/share/vim/pack/general/start/vim-commentary @@ -0,0 +1 @@ +Subproject commit 349340debb34f6302931f0eb7139b2c11dfdf427 diff --git a/.local/share/vim/pack/general/start/vim-easymotion b/.local/share/vim/pack/general/start/vim-easymotion @@ -0,0 +1 @@ +Subproject commit d75d9591e415652b25d9e0a3669355550325263d diff --git a/.local/share/vim/pack/general/start/vim-fugitive b/.local/share/vim/pack/general/start/vim-fugitive @@ -0,0 +1 @@ +Subproject commit 6f07d7e6cd23b7a76dc461fdfb1984717d233806 diff --git a/.local/share/vim/pack/general/start/vim-ninja-feet b/.local/share/vim/pack/general/start/vim-ninja-feet @@ -0,0 +1 @@ +Subproject commit cb9b448dd468a338255aed474e6113ed115612c1 diff --git a/.local/share/vim/pack/general/start/vim-repeat b/.local/share/vim/pack/general/start/vim-repeat @@ -0,0 +1 @@ +Subproject commit 24afe922e6a05891756ecf331f39a1f6743d3d5a diff --git a/.local/share/vim/pack/general/start/vim-surround b/.local/share/vim/pack/general/start/vim-surround @@ -0,0 +1 @@ +Subproject commit f51a26d3710629d031806305b6c8727189cd1935 diff --git a/.local/share/vim/pack/general/start/vim-textobj-user b/.local/share/vim/pack/general/start/vim-textobj-user @@ -0,0 +1 @@ +Subproject commit 41a675ddbeefd6a93664a4dc52f302fe3086a933 diff --git a/.local/share/vim/pack/general/start/vim-textobj-xmlattr b/.local/share/vim/pack/general/start/vim-textobj-xmlattr @@ -0,0 +1 @@ +Subproject commit 694a297f1d75fd527e87da9769f3c6519a87ebb1 diff --git a/.local/share/vim/pack/general/start/vim-tmux-navigator b/.local/share/vim/pack/general/start/vim-tmux-navigator @@ -0,0 +1 @@ +Subproject commit 9ca5bfe5bd274051b5dd796cc150348afc993b80 diff --git a/.local/share/vim/pack/general/start/vim-unimpaired b/.local/share/vim/pack/general/start/vim-unimpaired @@ -0,0 +1 @@ +Subproject commit e4006d68cd4f390efef935bc09be0ce3bd022e72 diff --git a/.local/share/vim/pack/themes/start/gruvbox-material b/.local/share/vim/pack/themes/start/gruvbox-material @@ -0,0 +1 @@ +Subproject commit fb27ccbd20cc1eda04e181f22c722977bdf9c934 diff --git a/.profile b/.profile @@ -1,29 +1,84 @@ export GREP_COLOR='1;35;40' # XDG -export XDG_DATA_HOME="$HOME/.local/share" export XDG_CONFIG_HOME="$HOME/.config" +export XDG_DATA_HOME="$HOME/.local/share" export XDG_CACHE_HOME="$HOME/.cache" -export GNUPGHOME="$XDG_DATA_HOME/gnupg" -export VIMINIT='source $XDG_CONFIG_HOME/vim/vimrc' + +# Global programs +export VIMINIT="if !has('nvim') +source $XDG_CONFIG_HOME/vim/vimrc +endif" export LESSHISTFILE=- -export NODE_REPL_HISTORY="$XDG_DATA_HOME"/node_repl_history -export NPM_CONFIG_USERCONFIG=$XDG_CONFIG_HOME/npm/npmrc -export PASSWORD_STORE_DIR="$XDG_DATA_HOME"/pass +export LYNX_CFG="$XDG_CONFIG_HOME/lynx/lynx.cfg" +export LYNX_LSS="$XDG_CONFIG_HOME/lynx/lynx.lss" export PSQLRC="$XDG_CONFIG_HOME/pg/psqlrc" -export PSQL_HISTORY="$XDG_CACHE_HOME/pg/psql_history" export PGPASSFILE="$XDG_CONFIG_HOME/pg/pgpass" export PGSERVICEFILE="$XDG_CONFIG_HOME/pg/pg_service.conf" -export RUSTUP_HOME="$XDG_DATA_HOME"/rustup -export HISTFILE="$XDG_DATA_HOME"/bash/history +export TASKRC="$XDG_CONFIG_HOME/task/taskrc" export XINITRC="$XDG_CONFIG_HOME"/X11/xinitrc export XSERVERRC="$XDG_CONFIG_HOME"/X11/xserverrc -export XAUTHORITY="$XDG_RUNTIME_DIR"/Xauthority -export ATOM_HOME="$XDG_DATA_HOME"/atom +export XAUTHORITY="$XDG_RUNTIME_DIR"/Xauthority export WGETRC="$XDG_CONFIG_HOME/wgetrc" 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 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"/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 " + +# Local executables +export PATH=${PATH}:${HOME}/.local/bin:${XDG_DATA_HOME}/npm/bin:${XDG_DATA_HOME}/.cargo/bin + +chance() { + # Hit or miss + [ -f "${1}" ] && . "${1}" +} + +# TODO refactor function name +mich() { + type "$@" >/dev/null 2>/dev/null +} # Setup editor -export EDITOR=vim -export VISUAL=vim + +export VISUAL=$(mich nvim && echo nvim || echo vim ) +export EDITOR="$VISUAL" + +export BROWSER="$(mich lynx && echo lynx)" +export SURFRAW_browser="$BROWSER" + +chance "${XDG_CONFIG_HOME}/sh/aliases" +chance "${XDG_CONFIG_HOME}/sh/plugin/index" +chance "${XDG_CONFIG_HOME}/sh/unstaged" diff --git a/X11.md b/X11.md @@ -1,12 +0,0 @@ -# X11 - -``` -# Launch firefox as user without xorg -# .config/X11/xinitrc file should be cleared for this to work, otherwise it would launch i3 -xinit firefox $* -- :0 vt$XDG_VTNR - - -# Configure xauth manually -# $HOST was not defined in arch, I added it manually when using it -xauth add ${HOST}:0 . $(xxd -l 16 -p /dev/urandom) -```