├── .gitignore ├── README.md ├── bin ├── battery_status ├── buildnvim ├── buildscrcpy ├── buildvim ├── cht.sh ├── comp ├── create-vim-plugin ├── def ├── findhuge ├── git-release ├── kalivm ├── ngp ├── pair ├── reminders │ ├── agenda │ └── water ├── review ├── rsync_dotoo_files ├── tdate ├── updatecron ├── updatedotfiles ├── updatenvim ├── updatescrcpy ├── updatevim ├── usbarmory └── weather ├── config ├── aerospace.toml ├── alacritty.yml ├── eclipse-java-google-style.xml ├── google_checks.xml ├── i3 │ ├── config │ └── i3status │ │ └── config ├── kitty.conf ├── mu4e.signature.txt ├── redshift.conf ├── signature.gmail.txt ├── sketchybar │ ├── plugins │ │ ├── aerospace.sh │ │ ├── battery.sh │ │ ├── calendar.sh │ │ ├── clock.sh │ │ ├── front_app.sh │ │ └── volume.sh │ └── sketchybarrc ├── skhdrc ├── spacebarrc ├── tmux-linux.conf ├── tmux-osx.conf ├── tmux.conf ├── wezterm.lua ├── xprofile └── yabairc ├── crontab ├── emacs ├── .gitignore ├── custom.el ├── ds │ ├── aoc-mode.el │ ├── init-ai.el │ ├── init-consult.el │ ├── init-embark.el │ ├── init-erc.el │ ├── init-evil.el │ ├── init-general.el │ ├── init-gptel.el │ ├── init-langs.el │ ├── init-lsp.el │ ├── init-mu4e.el │ ├── init-org.el │ ├── init-packages.el │ ├── init-straight.el │ ├── ui.el │ └── util.el └── init.el ├── git ├── attributes ├── commit_template ├── config ├── ignore └── template │ └── hooks │ ├── ctags │ ├── post-checkout │ ├── post-commit │ ├── post-merge │ └── post-rewrite ├── hammerspoon └── init.lua ├── nvim ├── README.md ├── UltiSnips │ ├── jsx.snippets │ └── python.snippets ├── after │ └── plugin │ │ └── obsession.vim ├── autocmd.vim ├── autoload │ └── functions.vim ├── commands.vim ├── config.vim ├── doc │ └── grokvi.txt ├── ftplugin │ ├── cucumber │ │ └── custom.vim │ ├── git │ │ └── custom.vim │ ├── go │ │ └── custom.vim │ ├── haml │ │ └── custom.vim │ ├── java │ │ └── custom.vim │ ├── markdown │ │ └── custom.vim │ ├── plantuml │ │ └── custom.vim │ ├── ruby │ │ └── custom.vim │ ├── rust │ │ ├── custom.vim │ │ └── surround.lua │ ├── sql │ │ └── custom.vim │ ├── sshconfig │ │ └── custom.vim │ ├── tex │ │ └── surround.lua │ ├── typescript │ │ └── surround.lua │ ├── typescriptreact │ │ └── surround.lua │ ├── vimwiki │ │ └── custom.vim │ ├── xml │ │ └── custom.vim │ └── yaml │ │ └── custom.vim ├── init.vim ├── lazy-lock.json ├── lua │ ├── ds │ │ ├── dap.lua │ │ ├── init.lua │ │ ├── keymaps.lua │ │ ├── lazy.lua │ │ ├── lsp.lua │ │ ├── plugins │ │ │ ├── ai.lua │ │ │ ├── colors.lua │ │ │ ├── dap.lua │ │ │ ├── folke.lua │ │ │ ├── local.lua │ │ │ ├── lsp.lua │ │ │ ├── misc.lua │ │ │ ├── org.lua │ │ │ ├── telescope.lua │ │ │ ├── tpope.lua │ │ │ └── treesitter.lua │ │ └── surround.lua │ └── init.lua ├── mappings.vim ├── plugin │ ├── age.vim │ ├── browse.vim │ ├── bufdo.vim │ ├── cdpath.vim │ ├── dash.vim │ ├── dict.vim │ ├── dotedit.vim │ ├── encrypt.vim │ ├── extract.vim │ ├── fugitive_extra.vim │ ├── hard_ass.vim │ ├── includeexpr.vim │ ├── neatfoldtext.vim │ ├── scratch.vim │ ├── search.vim │ ├── statusline.vim │ ├── sync_dotoo_files.vim │ ├── tabline.vim │ ├── underheadline.vim │ ├── view.vim │ ├── vinegar.vim │ └── winbar.vim ├── plugin_settings │ ├── ale.vim │ ├── bundler.vim │ ├── coc.vim │ ├── ctrlp.vim │ ├── doge.vim │ ├── dotoo.vim │ ├── flog.vim │ ├── fzf.vim │ ├── gist.vim │ ├── gitv.vim │ ├── go.vim │ ├── hexokinase.vim │ ├── javascript.vim │ ├── jekyll.vim │ ├── jsx.vim │ ├── langclient.vim │ ├── netrw.vim │ ├── prosession.vim │ ├── quickrun.vim │ ├── rails.vim │ ├── ruby.vim │ ├── slime.vim │ ├── snipmate.vim │ ├── switch.vim │ ├── syntastic.vim │ ├── table.vim │ ├── tagbar.vim │ ├── test.vim │ ├── ultisnips.vim │ ├── vimtex.vim │ ├── vimwiki.vim │ └── vrc.vim ├── spell │ ├── en.utf-8.add │ ├── en.utf-8.add.spl │ ├── en.utf-8.spl │ ├── en.utf-8.sug │ └── mthesaur.txt └── syntax │ └── tab.vim ├── qutebrowser ├── autoconfig.yml ├── bookmarks │ └── urls ├── config.py ├── greasemonkey │ └── youtube-adblock.user.js ├── qsettings │ └── QtProject.conf ├── quickmarks └── userscripts │ └── qute-pass ├── setup ├── setup_arch ├── setup_asdf ├── setup_darwin ├── setup_debian ├── setup_git ├── setup_linux ├── setup_nvim ├── setup_pass ├── setup_scrcpy ├── setup_tmux ├── setup_vim ├── slides ├── rust.md └── tmux.md ├── sshconfig ├── templates ├── cpp │ └── file.cpp ├── go │ └── file.go ├── hs │ └── file.hs ├── rb │ └── file.rb ├── rust │ ├── .gitignore │ ├── Cargo.lock │ ├── Cargo.toml │ └── src │ │ └── main.rs ├── shared │ ├── README.md │ ├── input │ └── tinput └── zig │ └── file.zig ├── vim ├── .gitignore ├── README.md ├── RUBY_TIPS.md ├── UltiSnips │ ├── jsx.snippets │ └── python.snippets ├── after │ └── plugin │ │ ├── obsession.vim │ │ └── sandwich.vim ├── autocmd.vim ├── autoload │ └── functions.vim ├── coc-settings.json ├── commands.vim ├── config.vim ├── doc │ └── grokvi.txt ├── ftdetect │ └── tab.vim ├── ftplugin │ ├── cucumber │ │ └── custom.vim │ ├── git │ │ └── custom.vim │ ├── go │ │ └── custom.vim │ ├── haml │ │ └── custom.vim │ ├── markdown │ │ └── custom.vim │ ├── ruby │ │ └── custom.vim │ ├── sshconfig │ │ └── custom.vim │ ├── vim │ │ └── custom.vim │ ├── vimwiki │ │ └── custom.vim │ ├── xml │ │ └── custom.vim │ └── yaml │ │ └── custom.vim ├── gvimrc ├── init.vim ├── mappings.vim ├── packs.vim ├── plugin │ ├── browse.vim │ ├── bufdo.vim │ ├── cdpath.vim │ ├── codejam.vim │ ├── dash.vim │ ├── dotedit.vim │ ├── edit.vim │ ├── encrypt.vim │ ├── extract.vim │ ├── fugitive_extra.vim │ ├── hard_ass.vim │ ├── includeexpr.vim │ ├── neatfoldtext.vim │ ├── scratch.vim │ ├── search.vim │ ├── statusline.vim │ ├── sync_dotoo_files.vim │ ├── tabline.vim │ ├── underheadline.vim │ ├── view.vim │ └── vinegar.vim ├── plugin_authoring.md ├── plugin_settings │ ├── ale.vim │ ├── bundler.vim │ ├── coc.vim │ ├── ctrlp.vim │ ├── dotoo.vim │ ├── flog.vim │ ├── fzf.vim │ ├── gist.vim │ ├── gitv.vim │ ├── go.vim │ ├── hexokinase.vim │ ├── indentLine.vim │ ├── indentguides.vim │ ├── javascript.vim │ ├── jekyll.vim │ ├── jsx.vim │ ├── langclient.vim │ ├── netrw.vim │ ├── nuake.vim │ ├── prosession.vim │ ├── quickrun.vim │ ├── rails.vim │ ├── ruby.vim │ ├── slime.vim │ ├── snipmate.vim │ ├── switch.vim │ ├── syntastic.vim │ ├── table.vim │ ├── tagbar.vim │ ├── test.vim │ ├── ultisnips.vim │ ├── vimwiki.vim │ └── vrc.vim ├── spell │ ├── en.utf-8.add │ ├── en.utf-8.add.spl │ ├── en.utf-8.spl │ ├── en.utf-8.sug │ └── mthesaur.txt ├── syntax │ └── tab.vim ├── tridactylrc ├── vimpagerrc └── vimrc ├── weechat ├── .gitignore ├── alias.conf ├── aspell.conf ├── buffers.conf ├── buflist.conf ├── charset.conf ├── exec.conf ├── fifo.conf ├── fset.conf ├── guile.conf ├── irc.conf ├── logger.conf ├── lua.conf ├── matrix.conf ├── matrix │ └── matrix_org │ │ ├── @dhruvasagar:matrix.org_UYUGHDLKHG.db │ │ └── dhruvasagar.device_id ├── perl.conf ├── perl │ ├── autoload │ │ ├── colorize_lines.pl │ │ └── highmon.pl │ ├── colorize_lines.pl │ └── highmon.pl ├── plugins.conf ├── python.conf ├── python │ ├── autoload │ │ ├── go.py │ │ ├── matrix.py │ │ └── notification_center.py │ ├── go.py │ ├── matrix │ ├── matrix.py │ ├── notification_center.py │ └── wee_slack.py ├── relay.conf ├── rmodifier.conf ├── ruby.conf ├── script.conf ├── sec.conf ├── spell.conf ├── tcl.conf ├── trigger.conf ├── typing.conf ├── weechat.conf └── xfer.conf └── zsh ├── aliases ├── benchmark ├── benchmarks ├── Dockerfile-myzsh ├── Dockerfile-ohmyzsh ├── Dockerfile-prezto ├── Dockerfile-zsh ├── install_ohmyzsh ├── install_prezto ├── timezsh ├── zpreztorc └── zshrc ├── bindkeys ├── cdpath ├── compinit ├── funcs ├── hist ├── paths ├── plugin └── dirsh ├── pristine_prompt ├── zshrc └── zstyles /.gitignore: -------------------------------------------------------------------------------- 1 | log/* 2 | .luarc.json 3 | .env 4 | .aider* 5 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # My dotfiles 2 | 3 | This repository contains all my dotfiles as well as other commonly used 4 | configuration files. 5 | 6 | It also provides a good platform agnostic setup process that not only 7 | sets up these configuration files needed by various developer tools that I use 8 | but also install all basic tools necessary to create my development 9 | environment on a new machine 10 | 11 | ## Setup 12 | 13 | Simply run `./setup` in this directory to setup all required tools as well 14 | as set all configuration files appropriately. 15 | 16 | ## License 17 | 18 | This repository is MIT-licensed. 19 | -------------------------------------------------------------------------------- /bin/battery_status: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | platform=`uname` 4 | 5 | if [ "$platform" = 'Linux' ]; then 6 | if command -v upower; then 7 | BATTERY_STATUS=$(upower -i $(upower -e | grep BAT) | grep state | awk '{print $2}') 8 | BATTERY_PERCENTAGE=$(upower -i $(upower -e | grep BAT) | grep percentage | awk '{print $2}') 9 | if [ -z "$BATTERY_STATUS" ]; then 10 | BATTERY_STATUS="No Battery" 11 | BATTERY_PERCENTAGE="100%" 12 | fi 13 | printf "%s $BATTERY_STATUS" $BATTERY_PERCENTAGE 14 | else 15 | BATTERY_PATH="/sys/class/power_supply/BAT0" 16 | ENERGY_NOW=`cat $BATTERY_PATH/energy_now` 17 | ENERGY_FULL=`cat $BATTERY_PATH/energy_full` 18 | BATTERY_STATUS=`cat $BATTERY_PATH/status` 19 | BATTERY_PERCENTAGE=$($ENERGY_NOW*100/$ENERGY_FULL | bc -l) 20 | printf "%.2f%% $BATTERY_STATUS" $BATTERY_PERCENTAGE 21 | fi 22 | elif [ "$platform" = 'Darwin' ]; then 23 | PERCENTAGE=`pmset -g batt | egrep "([0-9]+\%).*" -o --colour=auto | cut -f1 -d';'` 24 | CHARGING=`pmset -g batt | egrep "([0-9]+\%).*" -o --colour=auto | cut -f2 -d';'` 25 | REMAINING=`pmset -g batt | egrep "([0-9]+\%).*" -o --colour=auto | cut -f3 -d';'` 26 | echo $PERCENTAGE $CHARGING 27 | fi 28 | -------------------------------------------------------------------------------- /bin/buildnvim: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | make distclean 4 | make deps 5 | make CMAKE_BUILD_TYPE=Release 6 | sudo make install 7 | -------------------------------------------------------------------------------- /bin/buildscrcpy: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | platform=$(uname | awk '{print tolower($0)}') 4 | 5 | if [ "$platform" = "linux" ]; then 6 | cd ~/src/oss/scrcpy 7 | ./install_release.sh 8 | fi 9 | -------------------------------------------------------------------------------- /bin/buildvim: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | platform=$(uname | awk '{print tolower($0)}') 4 | 5 | make distclean 6 | 7 | if [ "$platform" = "linux" ]; then 8 | ./configure \ 9 | --with-x \ 10 | --with-features=huge \ 11 | --enable-rubyinterp \ 12 | --enable-pythoninterp \ 13 | --enable-python3interp \ 14 | --with-compiledby="Dhruva Sagar " \ 15 | --with-python-config-dir="$(python2-config --configdir)" \ 16 | --with-python3-config-dir="$(python3-config --configdir)" 17 | else 18 | ./configure \ 19 | --prefix=/usr/local \ 20 | --enable-rubyinterp \ 21 | --enable-python3interp \ 22 | --with-features=huge \ 23 | --with-compiledby="Dhruva Sagar " \ 24 | --with-python3-config-dir="$(python3-config --configdir)" 25 | fi 26 | 27 | sudo make 28 | sudo make install 29 | -------------------------------------------------------------------------------- /bin/comp: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | 5 | info() { 6 | tput setaf 6 7 | echo "$1" 8 | tput sgr0 9 | } 10 | 11 | error() { 12 | tput setaf 1 13 | (echo >&2 "$1") 14 | tput sgr0 15 | } 16 | 17 | success() { 18 | tput setaf 2 19 | echo "$1" 20 | tput sgr0 21 | } 22 | 23 | quit() { 24 | usage 25 | exit 1 26 | } 27 | 28 | usage() { 29 | cat << EOM 30 | comp v0.1 31 | Dhruva Sagar 32 | 33 | Scaffolds files for solving a new comp problem 34 | 35 | USAGE: 36 | $0 [COMMAND] [ARGS] 37 | 38 | COMMANDS: 39 | create 40 | Scaffolds all the files in a new directory for the given programming 41 | language. 42 | 43 | Examples: 44 | $0 create 45 | 46 | help 47 | Prints this usage information. 48 | EOM 49 | } 50 | 51 | TEMPLATE_DIR="${HOME}/dotfiles/templates" 52 | 53 | # Ensure you have bash version 4+ 54 | declare -A extn_map 55 | extn_map['ruby']='rb' 56 | extn_map['python']='py' 57 | extn_map['haskell']='hs' 58 | 59 | create_project() { 60 | extn=${extn_map["$1"]} 61 | if [ -z $extn ]; then 62 | extn="$1" 63 | fi 64 | name="$2" 65 | cd "$name" 66 | if [ -f "${TEMPLATE_DIR}/file.${extn}" ]; then 67 | cp "${TEMPLATE_DIR}/file.${extn}" "${name}.${extn}" 68 | elif [ -d "${TEMPLATE_DIR}/${extn}" ]; then 69 | cp -R "${TEMPLATE_DIR}/${extn}/." . 70 | if [ -f "file.${extn}" ]; then 71 | mv "file.${extn}" "${name}.${extn}" 72 | fi 73 | else 74 | touch "${name}.${extn}" 75 | fi 76 | cp -R "${TEMPLATE_DIR}/shared/." . 77 | # find . -type f -exec sed -i "s/{{name}}/${name}/g" {} + 78 | find . -type f -exec sed -i '' -e "s/{{name}}/${name}/g" {} \; 79 | } 80 | 81 | create() { 82 | lang="$1" 83 | if [ -z "$lang" ]; then 84 | quit 85 | fi 86 | name="$2" 87 | if [ -z "$name" ]; then 88 | quit 89 | fi 90 | name="$2" 91 | mkdir -p "$name/bin" 92 | create_project "$lang" "$name" 93 | } 94 | 95 | COMMAND=$1 96 | case "$COMMAND" in 97 | create) 98 | create "${@:2}" 99 | ;; 100 | help) 101 | usage 102 | ;; 103 | *) 104 | quit 105 | ;; 106 | esac 107 | -------------------------------------------------------------------------------- /bin/create-vim-plugin: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | command=$(basename "$0") 4 | 5 | help(){ 6 | echo "Usage: $command " 7 | } 8 | 9 | createvimplugin(){ 10 | plugindir="vim-$1" 11 | mkdir "$plugindir" 12 | cd "$plugindir" || return 13 | touch README.md 14 | mkdir plugin doc autoload 15 | touch doc/"$1".txt plugin/"$1".vim autoload/"$1".vim 16 | git init 17 | sed -n -i "p;105a call packup#add('$plugindir')" ~/dotfiles/vim/packs.vim 18 | echo "execute 'cd $plugindir' to switch to the new plugin directory" 19 | } 20 | 21 | subcommand=$1 22 | case $subcommand in 23 | '' | '-h' | '--help') 24 | help 25 | ;; 26 | *) 27 | createvimplugin "$1" 28 | ;; 29 | esac 30 | -------------------------------------------------------------------------------- /bin/def: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | curl --silent "dict://dict.org/d:$*" | sed "s/ //g" 4 | -------------------------------------------------------------------------------- /bin/findhuge: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | usage() { 4 | echo "$(basename "$0") [-h] [ -d dir] [-t type] [-c count] 5 | -h Show this help text 6 | -d dir Directory to search in Default - '.' 7 | -t type [f/d] for file / directory Default - 'f' 8 | -c count Number of results Default - 10" 1>&2 9 | } 10 | 11 | _DIR='.' 12 | _TYPE='f' 13 | _COUNT=10 14 | 15 | while getopts ":h:d:t:c:" opts; do 16 | case "${opts}" in 17 | d) _DIR=${OPTARG} ;; 18 | t) _TYPE=${OPTARG} ;; 19 | c) _COUNT=${OPTARG} ;; 20 | h | *) 21 | usage 22 | exit 1 23 | ;; 24 | esac 25 | done 26 | 27 | command -v gdu >/dev/null 2>&1 && alias du=gdu 28 | 29 | find "$_DIR" -type "$_TYPE" -print0 | du -h --files0-from=- | sort -hr | head -"$_COUNT" 30 | -------------------------------------------------------------------------------- /bin/git-release: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #get highest tag number 4 | VERSION=`git describe --abbrev=0 --tags` 5 | 6 | #replace . with space so can split into an array 7 | VERSION_BITS=(${VERSION//./ }) 8 | 9 | #get number parts and increase last one by 1 10 | VNUM1=${VERSION_BITS[0]-0} 11 | VNUM2=${VERSION_BITS[1]-0} 12 | VNUM3=${VERSION_BITS[2]-0} 13 | VNUM3=$((VNUM3+1)) 14 | 15 | #get current hash and see if it already has a tag 16 | GIT_COMMIT=`git rev-parse HEAD` 17 | NEEDS_TAG=`git describe --contains $GIT_COMMIT 2>/dev/null` 18 | 19 | #only tag if no tag already 20 | if [ -z "$NEEDS_TAG" ]; then 21 | #create new tag 22 | if [ -z "$TAG"]; then 23 | TAG="$VNUM1.$VNUM2.$VNUM3" 24 | fi 25 | 26 | echo "Updating $VERSION to $TAG" 27 | 28 | if [ -f "README.md" ]; then 29 | sed -i "s/$VERSION/$TAG/" README.md 2>/dev/null 30 | fi 31 | if [ -f "doc/*.txt" ]; then 32 | sed -i "s/$VERSION/$TAG/" doc/*.txt 2>/dev/null 33 | fi 34 | git commit -a -m "Releasing version $TAG" 2>/dev/null 35 | 36 | git tag $TAG 37 | echo "Tagged with $TAG" 38 | git push --tags 39 | else 40 | echo "Already a tag on this commit" 41 | fi 42 | -------------------------------------------------------------------------------- /bin/kalivm: -------------------------------------------------------------------------------- 1 | #!/bin/bash - 2 | 3 | if [ -z $(docker volume ls -qf "name=kalivm") ] ; then 4 | echo "Creating volume for kalivm" 5 | docker volume create kalivm 6 | fi 7 | 8 | if [ -z $(docker ps -qf "name=kalivm") ]; then 9 | echo "Starting kalivm container" 10 | docker run \ 11 | --rm \ 12 | --privileged \ 13 | -v kalivm:/var/run/postgresql \ 14 | --name kalivm \ 15 | -d \ 16 | -it booyaabes/kali-linux-full:latest \ 17 | /bin/bash 18 | fi 19 | # Use to detach without killing 20 | docker attach kalivm 21 | -------------------------------------------------------------------------------- /bin/ngp: -------------------------------------------------------------------------------- 1 | #!/bin/zsh 2 | # http://iamvery.com/2013/11/16/tmux-pairing-anywhere-on-your-box.html 3 | 4 | ngrok_host=${NGROK_HOST:-ngrok.io} 5 | tmux_user=${TMUX_USER:-$USER} 6 | 7 | if [ ! $(command -v ngrok) ]; then 8 | echo "You must install https://ngrok.com to use this script." 9 | exit 1 10 | fi 11 | 12 | help(){ 13 | echo "Usage: $command [options]\n" 14 | echo "Subcommands:" 15 | echo " connect Connect ngrok reverse tunnel" 16 | echo " ssh Display ssh command to connect through" 17 | echo " ngrok tunnel" 18 | echo "" 19 | } 20 | 21 | connect(){ 22 | if [ $@ ]; then 23 | ngrok $@ 24 | else 25 | ngrok tcp 22 26 | fi 27 | } 28 | 29 | ssh(){ 30 | port=$(tunnel_port) 31 | 32 | if [ ! -z $port ]; then 33 | ssh_command="ssh -p $port $tmux_user@0.tcp.$ngrok_host" 34 | echo $ssh_command 35 | else 36 | echo "Tunnel with TCP forwarding doesn't seem to be connected." 37 | fi 38 | } 39 | 40 | tunnel_port(){ 41 | tunnel_info_endpoint="http://localhost:4040/status" 42 | search_string="tcp://.*$ngrok_host" 43 | port_strip_regex="s/^.*$ngrok_host:\([0-9]*\).*$/\1/" 44 | 45 | curl -s $tunnel_info_endpoint | grep $search_string | sed $port_strip_regex 46 | } 47 | 48 | subcommand=$1 49 | case $subcommand in 50 | '' | '-h' | '--help') 51 | help ;; 52 | *) 53 | shift 54 | ${subcommand} $@ 55 | ;; 56 | esac 57 | -------------------------------------------------------------------------------- /bin/pair: -------------------------------------------------------------------------------- 1 | #!/bin/zsh 2 | # http://iamvery.com/2013/11/16/tmux-pairing-anywhere-on-your-box.html 3 | 4 | command=$(basename $0) 5 | 6 | # Make sure dependencies are installed 7 | if [ ! $(command -v gh-auth) ]; then 8 | gem install github-auth 9 | fi 10 | if [ ! $(command -v tmux) ]; then 11 | echo "This script depends on tmux. Try: brew install tmux" 12 | exit 1 13 | fi 14 | if [ ! $(command -v ng) ]; then 15 | echo "This script depends on https://github.com/iamvery/dotfiles/blob/master/bin/ng" 16 | exit 1 17 | fi 18 | 19 | help(){ 20 | echo "Usage: $command [options]\n" 21 | echo "Subcommands:" 22 | echo " add Add a github user" 23 | echo " rm Remove a github user" 24 | echo " ls List github users" 25 | echo " up Open shared tmux session" 26 | echo " ssh Start a reverse tunnel for pair sharing" 27 | echo " See: https://ngrok.com" 28 | } 29 | 30 | add(){ 31 | gh-auth add --users $@ --command="$(which tmux) attach -t pairing" 32 | } 33 | 34 | rm(){ 35 | gh-auth remove --users $@ 36 | } 37 | 38 | ls(){ 39 | gh-auth list 40 | } 41 | 42 | up(){ 43 | # Add any users, if specified 44 | if [[ ! -z $@ ]]; then 45 | add $@ 46 | fi 47 | 48 | tmux new-session -d -s pairing "ng connect" 49 | tmux split-window 50 | sleep 1.0 # some delay so tunnel has time to get up 51 | tmux send-keys "pair ssh" C-m 52 | tmux attach 53 | } 54 | 55 | ssh(){ 56 | clipboard_helper="reattach-to-user-namespace" 57 | ssh_command=$(ng ssh) 58 | echo $ssh_command 59 | 60 | if [ $(command -v $clipboard_helper) ]; then 61 | echo $ssh_command | $clipboard_helper pbcopy 62 | else 63 | echo "You must have $clipboard_helper installed to copy ssh command automatically. Try: brew install $clipboard_command" 64 | fi 65 | } 66 | 67 | subcommand=$1 68 | case $subcommand in 69 | '' | '-h' | '--help') 70 | help ;; 71 | *) 72 | shift 73 | ${subcommand} $@ 74 | ;; 75 | esac 76 | -------------------------------------------------------------------------------- /bin/reminders/agenda: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | for session in $(tmux list-session -F '#S'); do 4 | pane=$(tmux list-panes \ 5 | -F '#{session_name}:#{window_index}.#{pane_index} #{?pane_active,active,inactive}' \ 6 | -t "${session}:" | 7 | grep -w active | 8 | awk '{print $1}') 9 | tmux send-keys -t "$pane" Escape gAa 10 | done 11 | -------------------------------------------------------------------------------- /bin/reminders/water: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | platform=$(uname) 4 | if [ "$platform" = 'Linux' ]; then 5 | DISPLAY=:1 /usr/bin/zenity --question --icon-name=info --title='Reminder' --text='Drink Water' 6 | elif [ "$platform" = 'Darwin' ]; then 7 | osascript -e 'tell app "System Events" to display dialog "Drink Water" with title "Reminder"' 8 | fi 9 | -------------------------------------------------------------------------------- /bin/rsync_dotoo_files: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | rsync -aruv blog:~/dotoo-files/ ~/Documents/dotoo-files 4 | rsync -aruv --delete ~/Documents/dotoo-files/ blog:~/dotoo-files 5 | -------------------------------------------------------------------------------- /bin/tdate: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | _tz="${1:-"Asia/Kolkata"}" 4 | TZ="$_tz" date +"%d-%m-%Y %H:%M %Z" 5 | -------------------------------------------------------------------------------- /bin/updatecron: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | cat ~/dotfiles/crontab | crontab - 4 | -------------------------------------------------------------------------------- /bin/updatedotfiles: -------------------------------------------------------------------------------- 1 | #!/bin/zsh 2 | 3 | cd ~/dotfiles 4 | git pull origin master 5 | 6 | [[ "$ZSH_NAME" = "zsh" ]] && echo "reloading ~/.zshrc" && source ~/.zshrc 7 | [[ -n "$TMUX" ]] && echo "reloading ~/.tmux.conf" && tmux source-file ~/.tmux.conf 8 | -------------------------------------------------------------------------------- /bin/updatenvim: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | cd ~/src/oss/neovim 4 | git pull origin master 5 | ~/dotfiles/bin/buildnvim 6 | -------------------------------------------------------------------------------- /bin/updatescrcpy: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | cd ~/src/oss/scrcpy 4 | git pull origin master 5 | ~/dotfiles/bin/buildscrcpy 6 | -------------------------------------------------------------------------------- /bin/updatevim: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | cd ~/src/oss/vim 4 | git pull origin master 5 | cd src 6 | ~/dotfiles/bin/buildvim 7 | -------------------------------------------------------------------------------- /bin/usbarmory: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | inet=${1-'en8'} 4 | ifconfig $inet 10.0.0.2 5 | if [ $? -eq 0 ]; then 6 | sysctl -w net.inet.ip.forwarding=1 7 | pfctl -e 8 | echo "nat on en0 from $inet:network to any -> (en0)" | pfctl -f - 9 | echo "nat on en0 from 10.0.0.0/8 to any -> (en0)" | pfctl -f - 10 | fi 11 | -------------------------------------------------------------------------------- /bin/weather: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | location=${1:-"New York"} 4 | curl -s wttr.in/$location 5 | -------------------------------------------------------------------------------- /config/i3/i3status/config: -------------------------------------------------------------------------------- 1 | general { 2 | output_format = "i3bar" 3 | colors = false 4 | markup = pango 5 | interval = 5 6 | color_good = '#2f343f' 7 | color_degraded = '#ebcb8b' 8 | color_bad = '#ba5e57' 9 | } 10 | 11 | order += "load" 12 | order += "disk /" 13 | order += "disk /home" 14 | order += "ethernet enp2s0" 15 | order += "wireless wlp3s0" 16 | order += "volume master" 17 | order += "tztime local" 18 | 19 | load { 20 | format = " L: %5min Load " 21 | } 22 | 23 | cpu_temperature 0 { 24 | format = " Temp: %degrees °C " 25 | path = "/sys/class/thermal/thermal_zone0/temp" 26 | } 27 | 28 | disk "/" { 29 | format = " S: %free Free " 30 | } 31 | 32 | disk "/home" { 33 | format = " S (home): %free Free " 34 | } 35 | 36 | ethernet enp2s0 { 37 | format_up = "E: %ip " 38 | format_down = "E: Disconnected " 39 | } 40 | 41 | wireless wlp3s0 { 42 | format_up = " W: %essid " 43 | format_down = " W: Disconnected " 44 | } 45 | 46 | volume master { 47 | format = " V: %volume " 48 | format_muted = " V: Muted " 49 | device = "default" 50 | mixer = "Master" 51 | mixer_idx = 0 52 | } 53 | 54 | tztime local { 55 | format = " %time " 56 | format_time = "T: %a %-d %b %H:%M" 57 | } 58 | -------------------------------------------------------------------------------- /config/mu4e.signature.txt: -------------------------------------------------------------------------------- 1 | -- 2 | Thanks & Regards, 3 | Dhruva Sagar from mu4e 4 | -------------------------------------------------------------------------------- /config/redshift.conf: -------------------------------------------------------------------------------- 1 | ; Global settings for redshift 2 | [redshift] 3 | ; Set the day and night screen temperatures 4 | temp-day=5700 5 | temp-night=3500 6 | 7 | ; Disable the smooth fade between temperatures when Redshift starts and stops. 8 | ; 0 will cause an immediate change between screen temperatures. 9 | ; 1 will gradually apply the new screen temperature over a couple of seconds. 10 | fade=1 11 | 12 | ; Solar elevation thresholds. 13 | ; By default, Redshift will use the current elevation of the sun to determine 14 | ; whether it is daytime, night or in transition (dawn/dusk). When the sun is 15 | ; above the degrees specified with elevation-high it is considered daytime and 16 | ; below elevation-low it is considered night. 17 | ;elevation-high=3 18 | ;elevation-low=-6 19 | 20 | ; Custom dawn/dusk intervals. 21 | ; Instead of using the solar elevation, the time intervals of dawn and dusk 22 | ; can be specified manually. The times must be specified as HH:MM in 24-hour 23 | ; format. 24 | ;dawn-time=6:00-7:45 25 | ;dusk-time=18:35-20:15 26 | 27 | ; Set the screen brightness. Default is 1.0. 28 | ;brightness=0.9 29 | ; It is also possible to use different settings for day and night 30 | ; since version 1.8. 31 | ;brightness-day=0.7 32 | ;brightness-night=0.4 33 | ; Set the screen gamma (for all colors, or each color channel 34 | ; individually) 35 | gamma=0.8 36 | ;gamma=0.8:0.7:0.8 37 | ; This can also be set individually for day and night since 38 | ; version 1.10. 39 | ;gamma-day=0.8:0.7:0.8 40 | ;gamma-night=0.6 41 | 42 | ; Set the location-provider: 'geoclue2', 'manual' 43 | ; type 'redshift -l list' to see possible values. 44 | ; The location provider settings are in a different section. 45 | location-provider=manual 46 | 47 | ; Set the adjustment-method: 'randr', 'vidmode' 48 | ; type 'redshift -m list' to see all possible values. 49 | ; 'randr' is the preferred method, 'vidmode' is an older API. 50 | ; but works in some cases when 'randr' does not. 51 | ; The adjustment method settings are in a different section. 52 | adjustment-method=randr 53 | 54 | ; Configuration of the location-provider: 55 | ; type 'redshift -l PROVIDER:help' to see the settings. 56 | ; ex: 'redshift -l manual:help' 57 | ; Keep in mind that longitudes west of Greenwich (e.g. the Americas) 58 | ; are negative numbers. 59 | [manual] 60 | lat=27.2046 61 | lon=77.4977 62 | 63 | ; Configuration of the adjustment-method 64 | ; type 'redshift -m METHOD:help' to see the settings. 65 | ; ex: 'redshift -m randr:help' 66 | ; In this example, randr is configured to adjust only screen 0. 67 | ; Note that the numbering starts from 0, so this is actually the first screen. 68 | ; If this option is not specified, Redshift will try to adjust _all_ screens. 69 | ; [randr] 70 | ; screen=0 71 | -------------------------------------------------------------------------------- /config/signature.gmail.txt: -------------------------------------------------------------------------------- 1 | -- 2 | Thanks & Regards, 3 | Dhruva Sagar 4 | -------------------------------------------------------------------------------- /config/sketchybar/plugins/aerospace.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # if [ "$1" = "$FOCUSED_WORKSPACE" ]; then 4 | # sketchybar --set $NAME background.drawing=on 5 | # else 6 | # sketchybar --set $NAME background.drawing=off 7 | # fi 8 | 9 | sketchybar --set $NAME label="${FOCUSED_WORKSPACE-1}" 10 | -------------------------------------------------------------------------------- /config/sketchybar/plugins/battery.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | PERCENTAGE="$(pmset -g batt | grep -Eo "\d+%" | cut -d% -f1)" 4 | CHARGING="$(pmset -g batt | grep 'AC Power')" 5 | 6 | if [ "$PERCENTAGE" = "" ]; then 7 | exit 0 8 | fi 9 | 10 | case "${PERCENTAGE}" in 11 | 9[0-9] | 100) 12 | ICON="" 13 | ;; 14 | [6-8][0-9]) 15 | ICON="" 16 | ;; 17 | [3-5][0-9]) 18 | ICON="" 19 | ;; 20 | [1-2][0-9]) 21 | ICON="" 22 | ;; 23 | *) ICON="" ;; 24 | esac 25 | 26 | if [[ "$CHARGING" != "" ]]; then 27 | ICON="" 28 | fi 29 | 30 | # The item invoking this script (name $NAME) will get its icon and label 31 | # updated with the current battery status 32 | sketchybar --set "$NAME" icon="$ICON" label="${PERCENTAGE}%" 33 | -------------------------------------------------------------------------------- /config/sketchybar/plugins/clock.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # The $NAME variable is passed from sketchybar and holds the name of 4 | # the item invoking this script: 5 | # https://felixkratz.github.io/SketchyBar/config/events#events-and-scripting 6 | 7 | sketchybar --set "$NAME" label="$(date '+%a %d %b, %Y %H:%M')" 8 | -------------------------------------------------------------------------------- /config/sketchybar/plugins/front_app.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Some events send additional information specific to the event in the $INFO 4 | # variable. E.g. the front_app_switched event sends the name of the newly 5 | # focused application in the $INFO variable: 6 | # https://felixkratz.github.io/SketchyBar/config/events#events-and-scripting 7 | 8 | if [ "$SENDER" = "front_app_switched" ]; then 9 | sketchybar --set "$NAME" label="$INFO" 10 | fi 11 | -------------------------------------------------------------------------------- /config/sketchybar/plugins/volume.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # The volume_change event supplies a $INFO variable in which the current volume 4 | # percentage is passed to the script. 5 | 6 | if [ "$SENDER" = "volume_change" ]; then 7 | VOLUME="$INFO" 8 | 9 | case "$VOLUME" in 10 | [6-9][0-9] | 100) 11 | ICON="󰕾" 12 | ;; 13 | [3-5][0-9]) 14 | ICON="󰖀" 15 | ;; 16 | [1-9] | [1-2][0-9]) 17 | ICON="󰕿" 18 | ;; 19 | *) ICON="󰖁" ;; 20 | esac 21 | 22 | sketchybar --set "$NAME" icon="$ICON" label="$VOLUME%" 23 | fi 24 | -------------------------------------------------------------------------------- /config/spacebarrc: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | spacebar -m config position top 4 | spacebar -m config height 32 5 | spacebar -m config title on 6 | spacebar -m config spaces on 7 | spacebar -m config clock on 8 | spacebar -m config power on 9 | spacebar -m config padding_left 20 10 | spacebar -m config padding_right 20 11 | spacebar -m config spacing_left 25 12 | spacebar -m config spacing_right 15 13 | spacebar -m config text_font "FiraCode Nerd Font:Bold:12.0" 14 | spacebar -m config icon_font "FiraCode Nerd Font:Bold:12.0" 15 | spacebar -m config background_color 0xff202020 16 | spacebar -m config foreground_color 0xffa8a8a8 17 | spacebar -m config space_icon_color 0xff458588 18 | spacebar -m config power_icon_color 0xffcd950c 19 | spacebar -m config battery_icon_color 0xffd75f5f 20 | spacebar -m config dnd_icon_color 0xffa8a8a8 21 | spacebar -m config clock_icon_color 0xffa8a8a8 22 | spacebar -m config power_icon_strip   23 | spacebar -m config space_icon_strip I II III IV V VI VII VIII IX X 24 | spacebar -m config space_icon  25 | spacebar -m config clock_icon  26 | spacebar -m config dnd_icon  27 | spacebar -m config clock_format "%a %d %b %Y %R" 28 | spacebar -m config right_shell on 29 | spacebar -m config right_shell_command "whoami" 30 | spacebar -m config display "all" 31 | 32 | echo "spacebar configuration loaded.." 33 | -------------------------------------------------------------------------------- /config/tmux-linux.conf: -------------------------------------------------------------------------------- 1 | # vim: set ft=conf 2 | 3 | bind-key -T copy-mode-vi v send -X begin-selection 4 | bind-key -T copy-mode-vi y send -X copy-pipe-and-cancel 'xclip -in -selection clipboard' 5 | # bind-key -T copy-mode-vi y send -X copy-selection-and-cancel 6 | -------------------------------------------------------------------------------- /config/tmux-osx.conf: -------------------------------------------------------------------------------- 1 | # vim: set ft=conf 2 | 3 | set-option -g default-command 'reattach-to-user-namespace -l zsh' 4 | 5 | bind-key -T copy-mode-vi v send-keys -X begin-selection 6 | bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'reattach-to-user-namespace pbcopy' 7 | bind-key -T copy-mode-vi C-v send-keys -X rectangle-toggle 8 | -------------------------------------------------------------------------------- /config/wezterm.lua: -------------------------------------------------------------------------------- 1 | local wezterm = require("wezterm") 2 | 3 | local config = {} 4 | 5 | config.font = wezterm.font("FiraCode Nerd Font Mono") 6 | config.term = "wezterm" 7 | config.font_size = 15.0 8 | config.window_decorations = "RESIZE" 9 | config.enable_kitty_graphics = true 10 | config.window_close_confirmation = "NeverPrompt" 11 | config.enable_tab_bar = false 12 | config.enable_scroll_bar = false 13 | config.window_padding = { 14 | left = "5px", 15 | right = "5px", 16 | top = "5px", 17 | bottom = "5px", 18 | } 19 | 20 | config.colors = { 21 | foreground = "#e4e4e4", 22 | background = "#121212", 23 | ansi = { 24 | "#121212", 25 | "#cc0000", 26 | "#4e9a06", 27 | "#c4a000", 28 | "#3465a4", 29 | "#75507b", 30 | "#06989a", 31 | "#d3d7cf", 32 | }, 33 | brights = { 34 | "#555753", 35 | "#ef2929", 36 | "#8ae234", 37 | "#fce94f", 38 | "#729fcf", 39 | "#ad7fa8", 40 | "#34e2e2", 41 | "#eeeeec", 42 | }, 43 | } 44 | 45 | return config 46 | -------------------------------------------------------------------------------- /config/xprofile: -------------------------------------------------------------------------------- 1 | setxkbmap -option ctrl:nocaps 2 | xcape -e 'Control_L=Escape' 3 | -------------------------------------------------------------------------------- /config/yabairc: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | yabai -m signal --add event=dock_did_restart action="sudo yabai --load-sa" 4 | sudo yabai --load-sa 5 | 6 | # the scripting-addition must be loaded manually if 7 | # you are running yabai on macOS Big Sur. Uncomment 8 | # the following line to have the injection performed 9 | # when the config is executed during startup. 10 | # 11 | # for this to work you must configure sudo such that 12 | # it will be able to run the command without password 13 | # 14 | # see this wiki page for information: 15 | # - https://github.com/koekeishiya/yabai/wiki/Installing-yabai-(latest-release) 16 | 17 | sudo yabai --load-sa 18 | yabai -m signal --add event=dock_did_restart action="sudo yabai --load-sa" 19 | 20 | # global settings 21 | yabai -m config mouse_follows_focus off 22 | yabai -m config focus_follows_mouse off 23 | yabai -m config window_placement second_child 24 | yabai -m config window_topmost off 25 | yabai -m config window_shadow on 26 | yabai -m config window_opacity off 27 | yabai -m config window_opacity_duration 0.0 28 | yabai -m config active_window_opacity 1.0 29 | yabai -m config normal_window_opacity 0.90 30 | yabai -m config window_border off 31 | yabai -m config window_border_width 6 32 | yabai -m config active_window_border_color 0xff775759 33 | yabai -m config normal_window_border_color 0xff555555 34 | yabai -m config insert_feedback_color 0xffd75f5f 35 | yabai -m config split_ratio 0.50 36 | yabai -m config auto_balance on 37 | yabai -m config mouse_modifier fn 38 | yabai -m config mouse_action1 move 39 | yabai -m config mouse_action2 resize 40 | yabai -m config mouse_drop_action swap 41 | 42 | # general space settings 43 | yabai -m config layout bsp 44 | yabai -m config top_padding 0 45 | yabai -m config bottom_padding 0 46 | yabai -m config left_padding 0 47 | yabai -m config right_padding 0 48 | yabai -m config window_gap 3 49 | 50 | SPACEBAR_HEIGHT=26 51 | yabai -m config external_bar all:0:$SPACEBAR_HEIGHT 52 | 53 | yabai -m rule --add app="^Alacritty$" manage=off sticky=on layer=above 54 | yabai -m rule --add app="^Calculator$" manage=off grid=4:4:1:1:2:2 55 | yabai -m rule --add app="^System Information$" manage=off grid=4:4:1:1:2:2 56 | yabai -m rule --add app="^System Preferences$" manage=off grid=5:5:2:1:2:2 57 | yabai -m rule --add app="^Simulator$" manage=off 58 | 59 | echo "yabai configuration loaded.." 60 | -------------------------------------------------------------------------------- /crontab: -------------------------------------------------------------------------------- 1 | @hourly ~/dotfiles/bin/reminders/agenda > ~/dotfiles/log/remind_agenda.log 2>&1 2 | @hourly ~/dotfiles/bin/reminders/water > ~/dotfiles/log/remind_water.log 2>&1 3 | 4 | -------------------------------------------------------------------------------- /emacs/.gitignore: -------------------------------------------------------------------------------- 1 | etc/ 2 | var/ 3 | chats/ 4 | codeium/ 5 | straight/ 6 | tree-sitter/ 7 | -------------------------------------------------------------------------------- /emacs/custom.el: -------------------------------------------------------------------------------- 1 | (custom-set-variables 2 | ;; custom-set-variables was added by Custom. 3 | ;; If you edit it by hand, you could mess it up, so be careful. 4 | ;; Your init file should contain only one such instance. 5 | ;; If there is more than one, they won't work right. 6 | '(doom-modeline-check-simple-format t nil nil "Customized with use-package doom-modeline") 7 | '(safe-local-variable-values 8 | '((blacken-executable 9 | . "/Users/dhruva/.local/share/virtualenvs/qualitycontrol-eqFOpcz7/bin/black") 10 | (pyvenv-virtual-env-name . "qualitycontrol-eqFOpcz7") 11 | (pyvenv-virtual-env 12 | . "/Users/dhruva/.local/share/virtualenvs/qualitycontrol-eqFOpcz7/") 13 | (python-pytest-executable . "docker-compose exec app pytest")))) 14 | (custom-set-faces 15 | ;; custom-set-faces was added by Custom. 16 | ;; If you edit it by hand, you could mess it up, so be careful. 17 | ;; Your init file should contain only one such instance. 18 | ;; If there is more than one, they won't work right. 19 | ) 20 | -------------------------------------------------------------------------------- /emacs/ds/init-erc.el: -------------------------------------------------------------------------------- 1 | (define-prefix-command 'ds/erc-map) 2 | (define-key ctl-x-map "e" 'ds/erc-map) 3 | 4 | (defun ds/erc-connect-libera () 5 | (interactive) 6 | (erc-tls :server "irc.libera.chat" :port "6697" 7 | :nick "dhruvasagar")) 8 | (define-key ds/erc-map "s" 'ds/erc-connect-libera) 9 | (define-key ds/erc-map "a" 'erc-track-switch-buffer) 10 | 11 | (defun ds/erc-quit () 12 | "Kill ERC buffers and terminate any child processes." 13 | (interactive) 14 | (let ((kill-buffer-query-functions nil) 15 | (erc-buffers (erc-buffer-list))) 16 | (if (not erc-buffers) 17 | (message "There are no ERC buffers to kill.")) 18 | (progn 19 | (dolist (buffer erc-buffers) 20 | (kill-buffer buffer)) 21 | (message "Killed all ERC buffers.")))) 22 | (define-key ds/erc-map "q" 'ds/erc-quit) 23 | 24 | (setopt erc-sasl-mechanism 'plain) 25 | ;; Join the #emacs and #erc channels whenever connecting to 26 | ;; Libera.Chat. 27 | (setq erc-autojoin-channels-alist 28 | '(("Libera.Chat" "#vim" "#neovim" "#emacs" "#ruby" "#rust" "#golang"))) 29 | 30 | ;; Interpret mIRC-style color commands in IRC chats 31 | (setq erc-interpret-mirc-color t) 32 | 33 | ;; Ingore annoying (and unnecessary) Join, Part, Quit messages 34 | (setq erc-hide-list '("JOIN" "PART" "QUIT")) 35 | 36 | ;; The following are commented out by default, but users of other 37 | ;; non-Emacs IRC clients might find them useful. 38 | ;; Kill buffers for channels after /part 39 | (setq erc-kill-buffer-on-part t) 40 | ;; Kill buffers for private queries after quitting the server 41 | (setq erc-kill-queries-on-quit t) 42 | ;; Kill buffers for server messages after quitting the server 43 | (setq erc-kill-server-buffer-on-quit t) 44 | 45 | (add-hook 'erc-mode-hook (lambda () (local-set-key (kbd "C-") 'erc-track-switch-buffer))) 46 | 47 | (provide 'init-erc) 48 | -------------------------------------------------------------------------------- /emacs/ds/init-evil.el: -------------------------------------------------------------------------------- 1 | (use-package evil 2 | :init 3 | (setq evil-want-keybinding nil 4 | evil-split-window-below t 5 | evil-vsplit-window-right t 6 | evil-want-integration t 7 | evil-want-fine-undo t) 8 | :config 9 | (evil-mode 1) 10 | (evil-set-undo-system 'undo-tree) 11 | (evil-select-search-module 'evil-search-module 'evil-search) 12 | :general 13 | (:states 'normal "C" "c$") 14 | (:states 'normal "Y" "y$") 15 | :bind 16 | (:map evil-normal-state-map 17 | ("-" . dired-jump) 18 | ("C-l" . (lambda () 19 | (interactive) 20 | (redraw-display) 21 | (evil-ex-nohighlight))) 22 | ("C-c C-g" . evil-show-file-info) 23 | ("C-c C-u" . evil-delete-back-to-indentation)) 24 | :hook 25 | (org-mode . (lambda () (evil-local-set-key 'normal (kbd "RET") 'org-return)))) 26 | 27 | (use-package undo-tree 28 | :init 29 | (global-undo-tree-mode t) 30 | (setq undo-tree-auto-save-history t) 31 | (setq undo-tree-history-directory-alist '(("." . "~/.emacs.d/var/undo"))) 32 | :bind 33 | ("C-x C-v" . undo-tree-visualize)) 34 | 35 | (use-package evil-collection 36 | :after evil 37 | :init 38 | (evil-collection-init)) 39 | 40 | (use-package evil-surround 41 | :after evil 42 | :config 43 | (global-evil-surround-mode 1)) 44 | 45 | (use-package evil-commentary 46 | :after evil 47 | :config 48 | (evil-commentary-mode)) 49 | 50 | (use-package evil-matchit 51 | :after evil 52 | :config 53 | (global-evil-matchit-mode 1)) 54 | 55 | (use-package evil-exchange 56 | :after evil 57 | :config 58 | (evil-exchange-cx-install)) 59 | 60 | (use-package evil-visualstar 61 | :after evil 62 | :config 63 | (global-evil-visualstar-mode t)) 64 | 65 | (use-package evil-args 66 | :after evil 67 | :bind 68 | (:map evil-inner-text-objects-map ("a" . evil-inner-arg)) 69 | (:map evil-outer-text-objects-map ("a" . evil-outer-arg))) 70 | 71 | (use-package evil-numbers 72 | :bind 73 | (:map evil-normal-state-map 74 | ("C-c +" . evil-numbers/inc-at-pt) 75 | ("C-c -" . evil-numbers/dec-at-pt))) 76 | 77 | (use-package evil-anzu 78 | :after anzu) 79 | 80 | (use-package evil-textobj-tree-sitter 81 | :straight (evil-textobj-tree-sitter :type git 82 | :host github 83 | :repo "meain/evil-textobj-tree-sitter" 84 | :files (:defaults "queries" "treesit-queries"))) 85 | 86 | (provide 'init-evil) 87 | -------------------------------------------------------------------------------- /emacs/ds/init-general.el: -------------------------------------------------------------------------------- 1 | (use-package general) 2 | 3 | (provide 'init-general) 4 | -------------------------------------------------------------------------------- /emacs/ds/init-straight.el: -------------------------------------------------------------------------------- 1 | (defvar bootstrap-version) 2 | (let ((bootstrap-file 3 | (expand-file-name 4 | "straight/repos/straight.el/bootstrap.el" 5 | (or (bound-and-true-p straight-base-dir) 6 | user-emacs-directory))) 7 | (bootstrap-version 7)) 8 | (unless (file-exists-p bootstrap-file) 9 | (with-current-buffer 10 | (url-retrieve-synchronously 11 | "https://raw.githubusercontent.com/radian-software/straight.el/develop/install.el" 12 | 'silent 'inhibit-cookies) 13 | (goto-char (point-max)) 14 | (eval-print-last-sexp))) 15 | (load bootstrap-file nil 'nomessage)) 16 | 17 | ;; Ensure straight.el is used for package management 18 | (setq straight-use-package-by-default t) 19 | 20 | (use-package use-package :config 21 | (setq use-package-always-ensure t) ;; Ensure packages are always installed 22 | (straight-use-package 'use-package)) 23 | 24 | (provide 'init-straight) 25 | -------------------------------------------------------------------------------- /emacs/ds/util.el: -------------------------------------------------------------------------------- 1 | (defun random-alnum (&optional length) 2 | (let ((times (or length 5)) 3 | (random "")) 4 | (setq-local random "") 5 | (dotimes (_ times) 6 | (setq random (concat random (let* ((alnum "abcdefghijklmnopqrstuvwxyz0123456789") 7 | (i (% (abs (random)) (length alnum)))) 8 | (substring alnum i (1+ i)))))) 9 | random)) 10 | 11 | (defun util/test-emacs () 12 | "Test if emacs starts correctly." 13 | (interactive) 14 | (if (eq last-command this-command) 15 | (save-buffers-kill-terminal) 16 | (require 'async) 17 | (async-start 18 | (lambda () (shell-command-to-string 19 | "emacs --batch --eval \" 20 | (condition-case e 21 | (progn 22 | (load \\\"~/.emacs.d/init.el\\\") 23 | (message \\\"-OK-\\\")) 24 | (error 25 | (message \\\"ERROR!\\\") 26 | (signal (car e) (cdr e))))\"")) 27 | `(lambda (output) 28 | (if (string-match "-OK-" output) 29 | (when ,(called-interactively-p 'any) 30 | (message "All is well")) 31 | (switch-to-buffer-other-window "*startup error*") 32 | (delete-region (point-min) (point-max)) 33 | (insert output) 34 | (search-backward "ERROR!")))))) 35 | 36 | (provide 'util) 37 | -------------------------------------------------------------------------------- /git/attributes: -------------------------------------------------------------------------------- 1 | *.rb diff=ruby 2 | *.rake diff=ruby 3 | *.gemspec diff=ruby 4 | -------------------------------------------------------------------------------- /git/commit_template: -------------------------------------------------------------------------------- 1 | 2 | 3 | # Why is this change necessary ? 4 | 5 | # How does it address the issue ? 6 | 7 | # What side effects does this change have ? 8 | 9 | # References 10 | -------------------------------------------------------------------------------- /git/config: -------------------------------------------------------------------------------- 1 | [core] 2 | editor = vim 3 | excludesfile = ~/.gitignore 4 | ignorecase = false 5 | pager = delta 6 | [interactive] 7 | deltaFilter = delta --color-only 8 | [delta "interactive"] 9 | keep-plus-minus-markers = false 10 | [delta] 11 | navigate = true 12 | dark = true 13 | [merge] 14 | conflictstyle = diff3 15 | [push] 16 | default = simple 17 | [user] 18 | name = Dhruva Sagar 19 | email = dhruva.sagar@gmail.com 20 | [color] 21 | ui = true 22 | [commit] 23 | ; Commented to allow prepare-commit-msg hook to work 24 | ; template = ~/.gitcommit_template 25 | verbose = true 26 | [github] 27 | user = dhruvasagar 28 | [gitlab] 29 | user = dhruvasagar_zo 30 | [pull] 31 | rebase = false 32 | [alias] 33 | ; Is this short enough ? I also have gst zsh alias tho... 34 | st = status 35 | ; I typo a lot, save me alias 36 | pul = pull 37 | pus = push 38 | ; Here be cats 39 | purr = pull --rebase 40 | ; We're ready to push a bunch of changes, lets rebase and clean the commit 41 | ; history before we do so 42 | ready = rebase -i @{u} 43 | ; Who's been messing up our code more ? Tell me git 44 | stats = shortlog -sn --no-merges 45 | ; What have I been upto ? 46 | mylog = log --pretty=format:'%Cred%h%Creset -%Creset %s %Cgreen(%cD) %C(bold blue)<%an>%Creset' --author dhruvasagar 47 | standup = log --pretty=format:'%Cred%h%Creset -%Creset %s %Cgreen(%cD) %C(bold blue)<%an>%Creset' --since yesterday --author dhruvasagar 48 | ; Nice logs 49 | lg = log --pretty=format:'%Cred%h%Creset -%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' 50 | lgg1 = log --graph --all --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(bold white)— %an%C(reset)%C(bold yellow)%d%C(reset)' --abbrev-commit --date=relative 51 | lgg2 = log --graph --all --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n'' %C(white)%s%C(reset) %C(bold white)— %an%C(reset)' --abbrev-commit 52 | ; list files which have changed since REVIEW_BASE 53 | ; (REVIEW_BASE defaults to 'master' in my zshrc) 54 | files = !git diff --name-only $(git merge-base HEAD \"$REVIEW_BASE\") 55 | ; Same as above, but with a diff stat instead of just names 56 | ; (better for interactive use) 57 | stat = !git diff --stat $(git merge-base HEAD \"$REVIEW_BASE\") 58 | ; NOTE: These aliases depend on the `git files` alias from 59 | ; a few sections ago! 60 | 61 | ; Open all files changed since REVIEW_BASE in Vim tabs 62 | ; Then, run fugitive's :Gdiff in each tab, and finally 63 | ; tell vim-gitgutter to show +/- for changes since REVIEW_BASE 64 | review = !vim -p $(git files) +\"tabdo Gdiff $REVIEW_BASE\" +\"let g:gitgutter_diff_base = '$REVIEW_BASE'\" 65 | 66 | ; Same as the above, except specify names of files as arguments, 67 | ; instead of opening all files: 68 | ; git reviewone foo.js bar.js 69 | reviewone = !vim -p +\"tabdo Gdiff $REVIEW_BASE\" +\"let g:gitgutter_diff_base = '$REVIEW_BASE'\" 70 | [init] 71 | defaultBranch = main 72 | 73 | [diff] 74 | submodule = log 75 | colorMoved = default 76 | 77 | [pager] 78 | blame = delta 79 | diff = delta 80 | reflog = delta 81 | show = delta 82 | -------------------------------------------------------------------------------- /git/ignore: -------------------------------------------------------------------------------- 1 | tags 2 | !tags/ 3 | todo.txt 4 | todo.dotoo 5 | todo.md 6 | notes.md 7 | scratch.* 8 | !scratch.vim 9 | *.rest 10 | .vimrc 11 | .zshrc 12 | .nvimrc 13 | .tool-versions 14 | .projections.json 15 | testify_results.txt 16 | config/projections.json 17 | debug.el 18 | -------------------------------------------------------------------------------- /git/template/hooks/ctags: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | PATH=/usr/local/bin:$PATH 4 | trap "rm -f .git/tags.$$" EXIT 5 | ctags --tag-relative -Rf.git/tags.$$ --exclude=.git 6 | mv .git/tags.$$ .git/tags 7 | -------------------------------------------------------------------------------- /git/template/hooks/post-checkout: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | .git/hooks/ctags >/dev/null 2>&1 & 3 | -------------------------------------------------------------------------------- /git/template/hooks/post-commit: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | .git/hooks/ctags >/dev/null 2>&1 & 3 | -------------------------------------------------------------------------------- /git/template/hooks/post-merge: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | .git/hooks/ctags >/dev/null 2>&1 & 3 | -------------------------------------------------------------------------------- /git/template/hooks/post-rewrite: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | case "$1" in 3 | rebase) exec .git/hooks/post-merge ;; 4 | esac 5 | -------------------------------------------------------------------------------- /hammerspoon/init.lua: -------------------------------------------------------------------------------- 1 | local laucnOrFocusTerm = function() 2 | local term = hs.application.get("WezTerm") 3 | if term and term:isFrontmost() then 4 | term:hide() 5 | else 6 | hs.application.launchOrFocus("/Applications/WezTerm.app") 7 | end 8 | end 9 | hs.hotkey.bind({ "ctrl" }, "`", laucnOrFocusTerm) 10 | hs.hotkey.bind({ "ctrl" }, "escape", laucnOrFocusTerm) 11 | -------------------------------------------------------------------------------- /nvim/UltiSnips/jsx.snippets: -------------------------------------------------------------------------------- 1 | extends html 2 | 3 | snippet h5 "XHTML
" w 4 |
$0
5 | endsnippet 6 | 7 | snippet div. "
with className" w! 8 | 9 | $0 10 |
11 | endsnippet 12 | 13 | snippet div# "
with ID & className" w! 14 | 15 | $0 16 |
17 | endsnippet 18 | 19 | snippet span "" w 20 | $0 21 | endsnippet 22 | 23 | snippet span. " with className" w 24 | $0 25 | endsnippet 26 | 27 | snippet . "className" w 28 | className="$0" 29 | endsnippet 30 | # vim:ft=snippets: 31 | -------------------------------------------------------------------------------- /nvim/UltiSnips/python.snippets: -------------------------------------------------------------------------------- 1 | snippet code 2 | code.interact(local=dict(globals(), **locals())) 3 | endsnippet 4 | -------------------------------------------------------------------------------- /nvim/after/plugin/obsession.vim: -------------------------------------------------------------------------------- 1 | if exists(':Obsession') 2 | silent! packadd vim-prosession 3 | endif 4 | -------------------------------------------------------------------------------- /nvim/autocmd.vim: -------------------------------------------------------------------------------- 1 | augroup vimrcEx "{{{1 2 | au! 3 | 4 | " Automatically load .vimrc changes 5 | autocmd BufWritePost $MYVIMRC nested source $MYVIMRC 6 | augroup END 7 | 8 | augroup Packer "{{{1 9 | au! 10 | 11 | autocmd BufWritePost packer.lua source % | LspRestart | PackerCompile 12 | augroup END 13 | 14 | augroup EditJump "{{{1 15 | au! 16 | 17 | " When editing a file, always jump to the last known cursor position. 18 | " Don't do it when the position is invalid or when inside an event handler 19 | " (happens when dropping a file on gvim). 20 | autocmd BufReadPost * 21 | \ if line("'\"") > 0 && line("'\"") <= line("$") | 22 | \ exe "normal g`\"" | 23 | \ endif 24 | augroup END 25 | 26 | augroup SetTitleString "{{{1 27 | au! 28 | 29 | autocmd BufEnter * call functions#SetTitleString() 30 | augroup END 31 | 32 | augroup CursorLine "{{{1 33 | au! 34 | 35 | autocmd BufEnter,WinEnter * setl cursorline 36 | autocmd BufLeave,WinLeave * setl nocursorline 37 | augroup END 38 | 39 | let g:LargeFile = 200000 40 | function! LargeFile() 41 | set ft= 42 | endfunction 43 | augroup LargeFiles "{{{1 44 | au! 45 | 46 | autocmd BufRead * let f = getfsize(expand('')) | if f > g:LargeFile || f == -2 | call LargeFile() | endif 47 | augroup END 48 | 49 | augroup Terminal "{{{1 50 | au! 51 | 52 | if has('nvim') 53 | autocmd TermOpen * setl nolist 54 | else 55 | autocmd TerminalOpen * setl nolist 56 | end 57 | augroup END 58 | 59 | augroup CronTab "{{{1 60 | au! 61 | 62 | autocmd BufWritePost ~/dotfiles/crontab !updatecron 63 | augroup END 64 | 65 | augroup Kitty 66 | au! 67 | 68 | autocmd BufWritePost ~/.config/kitty/kitty.conf :silent !kill -SIGUSR1 $(pgrep kitty) 69 | augroup END 70 | -------------------------------------------------------------------------------- /nvim/autoload/functions.vim: -------------------------------------------------------------------------------- 1 | " Title String for tabs {{{1 2 | function! functions#SetTitleString() 3 | set titlestring=%f\ %m 4 | set titlestring+=\ -\ [%{split(substitute(getcwd(),$HOME,'~',''),'/')[-1]}] 5 | endfunction 6 | 7 | 8 | " Fugitive {{{1 9 | function! functions#GitExecInPath(cmd, ...) "{{{2 10 | if a:0 11 | let path = a:1 12 | elseif exists('b:git_dir') 13 | let path = b:git_dir 14 | let path = fnamemodify(path, ':h') 15 | else 16 | let path = FugitiveExtractGitDir('.') 17 | let path = fnamemodify(path, ':h') 18 | endif 19 | 20 | return system('cd ' . fnameescape(path) . '; ' . a:cmd) 21 | endfunction 22 | -------------------------------------------------------------------------------- /nvim/commands.vim: -------------------------------------------------------------------------------- 1 | function! s:makeTags() abort 2 | if executable('ctags') 3 | !ctags -R --execlude=.git 4 | elseif executable('ptags') 5 | !ptags 6 | endif 7 | endfunction 8 | 9 | command! MakeTags call s:makeTags() 10 | -------------------------------------------------------------------------------- /nvim/ftplugin/cucumber/custom.vim: -------------------------------------------------------------------------------- 1 | compiler cucumber 2 | setl makeprg=cucumber\ \"%:p\" 3 | -------------------------------------------------------------------------------- /nvim/ftplugin/git/custom.vim: -------------------------------------------------------------------------------- 1 | set foldlevel=9 2 | -------------------------------------------------------------------------------- /nvim/ftplugin/go/custom.vim: -------------------------------------------------------------------------------- 1 | let g:go_highlight_types = 1 2 | let g:go_highlight_fields = 1 3 | let g:go_doc_popup_window = 1 4 | let g:go_highlight_functions = 1 5 | let g:go_highlight_operators = 1 6 | let g:go_highlight_extra_types = 1 7 | let g:go_highlight_generate_tags = 1 8 | let g:go_highlight_format_strings = 1 9 | let g:go_highlight_function_calls = 1 10 | -------------------------------------------------------------------------------- /nvim/ftplugin/haml/custom.vim: -------------------------------------------------------------------------------- 1 | setl foldmethod=indent 2 | -------------------------------------------------------------------------------- /nvim/ftplugin/java/custom.vim: -------------------------------------------------------------------------------- 1 | setl tabstop=4 2 | setl shiftwidth=4 3 | -------------------------------------------------------------------------------- /nvim/ftplugin/markdown/custom.vim: -------------------------------------------------------------------------------- 1 | setl textwidth=78 2 | let g:markdown_folding = 1 3 | let g:markdown_fenced_languages = [ 4 | \ 'css', 5 | \ 'erb=eruby', 6 | \ 'javascript', 7 | \ 'js=javascript', 8 | \ 'json=javascript', 9 | \ 'java', 10 | \ 'ruby', 11 | \ 'sass', 12 | \ 'xml', 13 | \ 'html', 14 | \ 'zsh', 15 | \ 'bash', 16 | \ 'sh', 17 | \ 'sql', 18 | \ 'go', 19 | \ 'vim', 20 | \ 'testify', 21 | \ 'lua', 22 | \ 'clojure', 23 | \ ] 24 | 25 | nnoremap g :Glow 26 | -------------------------------------------------------------------------------- /nvim/ftplugin/plantuml/custom.vim: -------------------------------------------------------------------------------- 1 | function! s:puml_preview() abort 2 | let buf = nvim_create_buf(v:false, v:true) 3 | let file = expand('%') 4 | let fname = expand('%:r') 5 | call system('plantuml -ttxt ' . file) 6 | let lines = readfile(fname . '.atxt') 7 | call nvim_buf_set_lines(buf, 0, -1, v:true, lines) 8 | 9 | let gheight = nvim_list_uis()[0].height 10 | let gwidth = nvim_list_uis()[0].width 11 | let width = 100 12 | let height = 30 13 | let win = nvim_open_win(buf, v:true, { 14 | \ 'relative': 'editor', 15 | \ 'col': (gwidth - width) * 0.5, 16 | \ 'row': (gheight - height) * 0.5, 17 | \ 'width': width, 18 | \ 'height': height, 19 | \ 'anchor': 'NW', 20 | \ 'style': 'minimal', 21 | \ 'border': 'rounded', 22 | \ 'title': 'PlantUML Preview: "'. file . '"', 23 | \ 'title_pos': 'center', 24 | \ 'fixed': v:true, 25 | \}) 26 | call nvim_set_option_value('wrap', v:false, {'win': win}) 27 | call nvim_set_option_value('winhl', 'Normal:MyHighlight', {'win': win}) 28 | endfunction 29 | 30 | nnoremap p :call puml_preview() 31 | -------------------------------------------------------------------------------- /nvim/ftplugin/ruby/custom.vim: -------------------------------------------------------------------------------- 1 | setl foldmethod=indent 2 | 3 | command! MakeTags !ctags -R --languages=ruby --exclude=.git --exclude=log . $(bundle list --paths) 4 | -------------------------------------------------------------------------------- /nvim/ftplugin/rust/custom.vim: -------------------------------------------------------------------------------- 1 | let g:termdebugger="rust-gdb" 2 | -------------------------------------------------------------------------------- /nvim/ftplugin/rust/surround.lua: -------------------------------------------------------------------------------- 1 | require("nvim-surround").buffer_setup(require("ds.surround").generic) 2 | -------------------------------------------------------------------------------- /nvim/ftplugin/sql/custom.vim: -------------------------------------------------------------------------------- 1 | let g:omni_sql_default_compl_type = 'syntax' 2 | -------------------------------------------------------------------------------- /nvim/ftplugin/sshconfig/custom.vim: -------------------------------------------------------------------------------- 1 | set foldmethod=marker 2 | -------------------------------------------------------------------------------- /nvim/ftplugin/tex/surround.lua: -------------------------------------------------------------------------------- 1 | require("nvim-surround").buffer_setup(require("ds.surround").tex) 2 | -------------------------------------------------------------------------------- /nvim/ftplugin/typescript/surround.lua: -------------------------------------------------------------------------------- 1 | require("nvim-surround").buffer_setup(require("ds.surround").generic) 2 | -------------------------------------------------------------------------------- /nvim/ftplugin/typescriptreact/surround.lua: -------------------------------------------------------------------------------- 1 | require("nvim-surround").buffer_setup(require("ds.surround").generic) 2 | -------------------------------------------------------------------------------- /nvim/ftplugin/vimwiki/custom.vim: -------------------------------------------------------------------------------- 1 | setl nowrap 2 | setl concealcursor=nc 3 | -------------------------------------------------------------------------------- /nvim/ftplugin/xml/custom.vim: -------------------------------------------------------------------------------- 1 | setl foldmethod=indent 2 | setl equalprg=xmllint\ --format\ --recover\ - 3 | -------------------------------------------------------------------------------- /nvim/ftplugin/yaml/custom.vim: -------------------------------------------------------------------------------- 1 | setl foldmethod=indent 2 | -------------------------------------------------------------------------------- /nvim/init.vim: -------------------------------------------------------------------------------- 1 | set termguicolors 2 | 3 | let g:vim_home = expand('~/.config/nvim/') 4 | 5 | let config_list = [ 6 | \ 'config.vim', 7 | \ 'autocmd.vim', 8 | \ 'commands.vim', 9 | \ 'mappings.vim', 10 | \ 'plugin_settings/*.vim' 11 | \] 12 | for files in config_list 13 | for f in glob(g:vim_home.files, 1, 1) 14 | exec 'source' f 15 | endfor 16 | endfor 17 | 18 | packadd cfilter 19 | packadd termdebug 20 | 21 | lua require 'init' 22 | 23 | " Set at the end to work around 'exrc' 24 | set secure 25 | -------------------------------------------------------------------------------- /nvim/lua/ds/init.lua: -------------------------------------------------------------------------------- 1 | require("ds.lazy") 2 | require("ds.lsp") 3 | require("ds.dap") 4 | require("ds.keymaps") 5 | -------------------------------------------------------------------------------- /nvim/lua/ds/keymaps.lua: -------------------------------------------------------------------------------- 1 | -- vim.keymap.set("n", "ca", function() 2 | -- require("tiny-code-action").code_action() 3 | -- end, { noremap = true, silent = true }) 4 | -------------------------------------------------------------------------------- /nvim/lua/ds/lazy.lua: -------------------------------------------------------------------------------- 1 | local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" 2 | if not vim.loop.fs_stat(lazypath) then 3 | vim.fn.system({ 4 | "git", 5 | "clone", 6 | "--filter=blob:none", 7 | "https://github.com/folke/lazy.nvim.git", 8 | "--branch=stable", -- latest stable release 9 | lazypath, 10 | }) 11 | end 12 | vim.opt.rtp:prepend(lazypath) 13 | 14 | require("lazy").setup("ds.plugins", { 15 | ui = { 16 | border = "rounded", 17 | }, 18 | }) 19 | -------------------------------------------------------------------------------- /nvim/lua/ds/plugins/colors.lua: -------------------------------------------------------------------------------- 1 | return { 2 | { 3 | "EdenEast/nightfox.nvim", 4 | config = function() 5 | require("nightfox").setup({ 6 | groups = { 7 | all = { 8 | DiffAdd = { fg = "#e4e4e4", bg = "#005f00" }, 9 | DiffText = { fg = "#ffffff", bg = "#ff0000" }, 10 | DiffChange = { fg = "#ffffff", bg = "#870087" }, 11 | DiffDelete = { fg = "#000000", bg = "#5f0000" }, 12 | }, 13 | }, 14 | }) 15 | -- vim.cmd("colorscheme nightfox") 16 | -- vim.cmd("colorscheme duskfox") 17 | -- vim.cmd("colorscheme carbonfox") 18 | end, 19 | }, 20 | { 21 | "Shatur/neovim-ayu", 22 | config = function() 23 | require("ayu").setup({ 24 | overrides = { 25 | DiffAdd = { fg = "#e4e4e4", bg = "#005f00" }, 26 | DiffText = { fg = "#ffffff", bg = "#ff0000" }, 27 | DiffChange = { fg = "#ffffff", bg = "#870087" }, 28 | DiffDelete = { fg = "#000000", bg = "#5f0000" }, 29 | }, 30 | }) 31 | -- vim.cmd("colorscheme ayu") 32 | end, 33 | }, 34 | { 35 | "AlexvZyl/nordic.nvim", 36 | config = function() 37 | local palette = require("nordic.colors") 38 | require("nordic").setup({ 39 | bright_border = true, 40 | cursorline = { 41 | bold = true, 42 | theme = "light", 43 | }, 44 | on_highlight = { 45 | DiffAdd = { fg = "#e4e4e4", bg = "#005f00" }, 46 | DiffText = { fg = "#ffffff", bg = "#ff0000" }, 47 | DiffChange = { fg = "#ffffff", bg = "#870087" }, 48 | DiffDelete = { fg = "#000000", bg = "#5f0000" }, 49 | PmenuSel = { bg = "#434C5E" }, 50 | ["@markup.strong"] = { 51 | fg = palette.red.base, 52 | }, 53 | ["@markup.raw"] = { 54 | fg = palette.blue0, 55 | }, 56 | ["@markup.italic"] = { 57 | bold = true, 58 | italic = true, 59 | }, 60 | ["@markup.heading.1"] = { 61 | fg = palette.yellow.dim, 62 | bold = true, 63 | }, 64 | ["@markup.heading.2"] = { 65 | fg = palette.green.dim, 66 | bold = true, 67 | }, 68 | ["@markup.heading.3"] = { 69 | fg = palette.magenta.dim, 70 | bold = true, 71 | }, 72 | }, 73 | }) 74 | -- vim.cmd("colorscheme nordic") 75 | end, 76 | }, 77 | { 78 | "ab-dx/ares.nvim", 79 | name = "ares", 80 | priority = 1000, 81 | dependencies = { "rktjmp/lush.nvim" }, 82 | config = function() 83 | vim.cmd("colorscheme ares") 84 | end, 85 | }, 86 | } 87 | -------------------------------------------------------------------------------- /nvim/lua/ds/plugins/dap.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "mfussenegger/nvim-dap", 3 | { 4 | "rcarriga/nvim-dap-ui", 5 | lazy = true, 6 | dependencies = { "mfussenegger/nvim-dap", "nvim-neotest/nvim-nio" }, 7 | config = function() 8 | require("dapui").setup() 9 | end, 10 | }, 11 | { 12 | "leoluz/nvim-dap-go", 13 | lazy = true, 14 | config = function() 15 | require("dap-go").setup() 16 | end, 17 | }, 18 | { 19 | "jbyuki/one-small-step-for-vimkind", 20 | dependencies = { "mfussenegger/nvim-dap" }, 21 | }, 22 | { 23 | "theHamsta/nvim-dap-virtual-text", 24 | dependencies = { "mfussenegger/nvim-dap", "nvim-treesitter/nvim-treesitter" }, 25 | opts = {}, 26 | }, 27 | } 28 | -------------------------------------------------------------------------------- /nvim/lua/ds/plugins/local.lua: -------------------------------------------------------------------------------- 1 | return { 2 | { dir = "~/dotfiles/vim/pack/packup/start/vim-less" }, 3 | { dir = "~/dotfiles/vim/pack/packup/start/vim-marp" }, 4 | { dir = "~/dotfiles/vim/pack/packup/start/vim-zoom" }, 5 | { dir = "~/dotfiles/vim/pack/packup/start/vim-dotoo" }, 6 | { dir = "~/dotfiles/vim/pack/packup/start/vim-pairify" }, 7 | { dir = "~/dotfiles/vim/pack/packup/start/vim-markify" }, 8 | { dir = "~/dotfiles/vim/pack/packup/start/vim-testify" }, 9 | { dir = "~/dotfiles/vim/pack/packup/start/vim-open-url" }, 10 | { dir = "~/dotfiles/vim/pack/packup/start/vim-table-mode/" }, 11 | { dir = "~/dotfiles/vim/pack/packup/start/vim-buffer-history" }, 12 | { 13 | dir = "~/dotfiles/vim/pack/packup/start/vim-railscasts-theme", 14 | config = function() 15 | -- vim.cmd("colorscheme railscasts") 16 | end, 17 | }, 18 | { dir = "~/dotfiles/vim/pack/packup/start/vim-github-review" }, 19 | { dir = "~/dotfiles/vim/pack/packup/start/vim-comp" }, 20 | { 21 | dir = "~/dotfiles/vim/pack/packup/opt/vim-prosession", 22 | dependencies = { "tpope/vim-obsession", "nvim-telescope/telescope.nvim" }, 23 | config = function() 24 | require("telescope").load_extension("prosession") 25 | end, 26 | }, 27 | } 28 | -------------------------------------------------------------------------------- /nvim/lua/ds/plugins/telescope.lua: -------------------------------------------------------------------------------- 1 | return { 2 | { 3 | "nvim-telescope/telescope.nvim", 4 | dependencies = { "nvim-lua/plenary.nvim" }, 5 | config = function() 6 | require("telescope").setup({ 7 | defaults = { 8 | path_display = { "filename_first" }, 9 | dynamic_preview_title = true, 10 | }, 11 | }) 12 | end, 13 | }, 14 | { 15 | "nvim-telescope/telescope-fzf-native.nvim", 16 | enabled = false, 17 | build = "make", 18 | dependencies = { "nvim-telescope/telescope.nvim" }, 19 | cond = function() 20 | return vim.fn.executable("make") == 1 21 | end, 22 | config = function() 23 | require("telescope").load_extension("fzf") 24 | end, 25 | }, 26 | { 27 | "nvim-telescope/telescope-github.nvim", 28 | dependencies = { "nvim-telescope/telescope.nvim" }, 29 | config = function() 30 | require("telescope").load_extension("gh") 31 | end, 32 | }, 33 | { 34 | "debugloop/telescope-undo.nvim", 35 | dependencies = { -- note how they're inverted to above example 36 | { 37 | "nvim-telescope/telescope.nvim", 38 | dependencies = { "nvim-lua/plenary.nvim" }, 39 | }, 40 | }, 41 | keys = { 42 | { -- lazy style key map 43 | "su", 44 | "Telescope undo", 45 | desc = "undo history", 46 | }, 47 | }, 48 | opts = { 49 | -- don't use `defaults = { }` here, do this in the main telescope spec 50 | extensions = { 51 | undo = { 52 | -- telescope-undo.nvim config, see below 53 | }, 54 | -- no other extensions here, they can have their own spec too 55 | }, 56 | }, 57 | config = function(_, opts) 58 | -- Calling telescope's setup from multiple specs does not hurt, it will happily merge the 59 | -- configs for us. We won't use data, as everything is in it's own namespace (telescope 60 | -- defaults, as well as each extension). 61 | require("telescope").setup(opts) 62 | require("telescope").load_extension("undo") 63 | end, 64 | }, 65 | } 66 | -------------------------------------------------------------------------------- /nvim/lua/ds/plugins/tpope.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "tpope/vim-rsi", 3 | "tpope/vim-rake", 4 | "tpope/vim-tbone", 5 | "tpope/vim-apathy", 6 | "tpope/vim-repeat", 7 | "tpope/vim-abolish", 8 | "tpope/vim-endwise", 9 | "tpope/vim-rhubarb", 10 | { 11 | "tpope/vim-dispatch", 12 | lazy = true, 13 | cmd = { "Dispatch", "Make", "Focus", "Start" }, 14 | }, 15 | "tpope/vim-fugitive", 16 | "tpope/vim-sensible", 17 | { "tpope/vim-fireplace", lazy = true }, 18 | { "tpope/vim-leiningen", lazy = true }, 19 | -- "tpope/vim-commentary", 20 | "tpope/vim-scriptease", 21 | "tpope/vim-unimpaired", 22 | "tpope/vim-speeddating", 23 | "tpope/vim-characterize", 24 | { "tpope/vim-sexp-mappings-for-regular-people", lazy = true }, 25 | "tpope/vim-rails", 26 | "tpope/vim-eunuch", 27 | "tpope/vim-bundler", 28 | "tpope/vim-cucumber", 29 | "tpope/vim-sleuth", 30 | } 31 | -------------------------------------------------------------------------------- /nvim/lua/init.lua: -------------------------------------------------------------------------------- 1 | require("ds") 2 | -------------------------------------------------------------------------------- /nvim/mappings.vim: -------------------------------------------------------------------------------- 1 | " List of available normal mode mappings for future use : 2 | " 3 | " * cq, cu, cd, cm, c, c<, c>, c. 4 | " 5 | " * dq, dr, dy, du, dx, dc, dm, d<, d>, d. 6 | " 7 | " * gy, gz 8 | " 9 | " * yq, yr, yu, yx, yc, ym 10 | " 11 | " * zq, zy, zp 12 | 13 | " Use repeat operator with visual selection {{{1 14 | xnoremap . :normal! . 15 | 16 | " To make Y inline with other capitals {{{1 17 | nnoremap Y y$ 18 | 19 | " Q to :q a window {{{1 20 | " nmap Q empty(maparg('q', 'n')) ? ':q' : 'q' 21 | nnoremap Q :echo "Use :q instead" 22 | 23 | " Dispatch {{{1 24 | nnoremap d :Dispatch 25 | 26 | " Tabular {{{1 27 | nnoremap z/ ':Tabular/'.nr2char(getchar()).'' 28 | xnoremap z/ ':Tabular/'.nr2char(getchar()).'' 29 | nnoremap z// :Tabular/ 30 | xnoremap z// :Tabular/ 31 | 32 | " Use ` when ' {{{1 33 | nnoremap ' ` 34 | 35 | " Test {{{1 36 | nnoremap cl :TestLast 37 | nnoremap cf :TestFile 38 | nnoremap cs :TestSuite 39 | nnoremap cc :TestNearest 40 | 41 | " Remap Esc in terminal for NeoVim 42 | if exists(':tnoremap') 43 | tnoremap 44 | endif 45 | 46 | nnoremap g< vap:Twrite bottom-left 47 | xnoremap g< :Twrite bottom-left 48 | nnoremap g> vap:Twrite bottom-right 49 | xnoremap g> :Twrite bottom-right 50 | 51 | nnoremap <, :SidewaysLeft 52 | nnoremap >, :SidewaysRight 53 | 54 | nnoremap go :Goyo 55 | 56 | cnoremap 57 | 58 | nnoremap Telescope find_files follow=true 59 | nnoremap sf Telescope oldfiles only_cwd=true 60 | nnoremap sb Telescope buffers 61 | nnoremap sh Telescope help_tags 62 | nnoremap sw Telescope grep_string 63 | nnoremap sg Telescope live_grep 64 | nnoremap sd Telescope diagnostics 65 | nnoremap su Telescope undo 66 | 67 | nnoremap c- :.!toilet -w 200 -f small 68 | nnoremap c+ :.!toilet -w 200 -f standard 69 | nnoremap cb :.!toilet -w 200 -f term -F border 70 | 71 | nnoremap zS TSHighlightCapturesUnderCursor 72 | 73 | nnoremap J :TSJJoin 74 | nnoremap S :TSJSplit 75 | -------------------------------------------------------------------------------- /nvim/plugin/age.vim: -------------------------------------------------------------------------------- 1 | function! s:age_encrypt() abort 2 | silent exec '!cat' expand('%') '| age -e -i ~/.ssh/age/key.txt -o' expand('%') 3 | endfunction 4 | 5 | function! s:age_decrypt() abort 6 | silent exec '!cat' expand('%') '| age -d -i ~/.ssh/age/key.txt -o' expand('%') 7 | endfunction 8 | 9 | command! AgeFileEncrypt call s:age_encrypt() 10 | command! AgeFileDecrypt call s:age_decrypt() 11 | -------------------------------------------------------------------------------- /nvim/plugin/browse.vim: -------------------------------------------------------------------------------- 1 | function! s:Browse(bang) range 2 | if exists('b:git_dir') 3 | let path = b:git_dir 4 | else 5 | let path = fugitive#extract_git_dir(expand('%:p')) 6 | endif 7 | 8 | " Get working directory name 9 | if empty(path) 10 | let path = expand('%:p:h') 11 | else 12 | let path = fnamemodify(path, ':h:t') 13 | endif 14 | 15 | " Get path relative to working directory 16 | let path = fnamemodify(expand('%:p'), ':s?.*' . path . '/??') 17 | 18 | let name_with_lnum = path . ':' 19 | if a:lastline == a:firstline 20 | let name_with_lnum .= a:firstline 21 | else 22 | let name_with_lnum .= a:firstline . '-' . a:lastline 23 | endif 24 | 25 | if a:bang 26 | let @+ = name_with_lnum 27 | echomsg @+ . ' Copied to clipboard' 28 | else 29 | echomsg name_with_lnum 30 | end 31 | endfunction 32 | 33 | command! -bang -range Browse ,call s:Browse(0) 34 | -------------------------------------------------------------------------------- /nvim/plugin/bufdo.vim: -------------------------------------------------------------------------------- 1 | function! s:BufDo(command) 2 | let curbuff = bufnr('%') 3 | execute 'bufdo' a:command 4 | execute 'buffer' curbuff 5 | endfunction 6 | 7 | command! -bar -nargs=+ -complete=command Bufdo call s:BufDo() 8 | -------------------------------------------------------------------------------- /nvim/plugin/cdpath.vim: -------------------------------------------------------------------------------- 1 | function! s:CdComplete(ArgLead, CmdLine, CursorPos) 2 | let pattern = empty(a:ArgLead) ? '*/' : '*' . a:ArgLead . '*/' 3 | return map(globpath(&cdpath, pattern, 1, 1), 'fnamemodify(v:val, ":h:t")') 4 | endfunction 5 | 6 | command! -bar -nargs=1 -complete=customlist,s:CdComplete Cd cd 7 | command! -bar -nargs=1 -complete=customlist,s:CdComplete Lcd lcd 8 | -------------------------------------------------------------------------------- /nvim/plugin/dash.vim: -------------------------------------------------------------------------------- 1 | if exists('g:loaded_dash') 2 | finish 3 | endif 4 | let g:loaded_dash = 1 5 | 6 | function! s:Dash(search) 7 | exec 'silent !open "dash://' . join(split(a:search), ':') . '"' 8 | redraw! 9 | endfunction 10 | 11 | command! -bar -nargs=+ Dash call s:Dash() 12 | nnoremap dx :Dash =&filetype 13 | -------------------------------------------------------------------------------- /nvim/plugin/dict.vim: -------------------------------------------------------------------------------- 1 | function! s:lookup() abort 2 | let word = expand('') 3 | let buf = nvim_create_buf(v:false, v:true) 4 | let lines = systemlist('def '. word) 5 | call nvim_buf_set_lines(buf, 0, -1, v:true, lines) 6 | let win = nvim_open_win(buf, v:true, { 7 | \ 'relative': 'cursor', 8 | \ 'col': 0, 9 | \ 'row': 1, 10 | \ 'width': 100, 11 | \ 'height': 20, 12 | \ 'anchor': 'NW', 13 | \ 'style': 'minimal', 14 | \ 'border': 'rounded', 15 | \ 'title': 'Definition of word: "'. word . '"', 16 | \ 'title_pos': 'center', 17 | \ 'fixed': v:true, 18 | \}) 19 | call nvim_set_option_value('wrap', v:false, {'win': win}) 20 | call nvim_set_option_value('winhl', 'Normal:MyHighlight', {'win': win}) 21 | endfunction 22 | 23 | nnoremap def :call lookup() 24 | -------------------------------------------------------------------------------- /nvim/plugin/dotedit.vim: -------------------------------------------------------------------------------- 1 | function! s:DotComplete(ArgLead, CmdLine, CursorPos) abort 2 | let paths = globpath(expand('~/dotfiles'), '**/'.a:ArgLead.'*', 1, 1) 3 | for ppath in ['packup', 'backup'] 4 | let paths = filter(paths, 'v:val !~# "'.ppath.'"') 5 | endfor 6 | return paths 7 | endfunction 8 | 9 | function! s:DotEdit(cmd, fname) abort 10 | exec a:cmd a:fname 11 | endfunction 12 | 13 | command! -bar -nargs=1 -complete=customlist,s:DotComplete Dedit call s:DotEdit('edit', ) 14 | command! -bar -nargs=1 -complete=customlist,s:DotComplete Dsplit call s:DotEdit('split', ) 15 | command! -bar -nargs=1 -complete=customlist,s:DotComplete Dvsplit call s:DotEdit('vsplit', ) 16 | command! -bar -nargs=1 -complete=customlist,s:DotComplete Dtabedit call s:DotEdit('tabedit', ) 17 | -------------------------------------------------------------------------------- /nvim/plugin/encrypt.vim: -------------------------------------------------------------------------------- 1 | if exists('g:loaded_encrypt') 2 | finish 3 | endif 4 | let g:loaded_encrypt = 1 5 | 6 | if !exists('g:encrypt_credentials_file') 7 | let g:encrypt_credentials_file = expand('~/Dropbox/Documents/encryption-keys.txt') 8 | endif 9 | 10 | function! s:BackupCreds(pass) abort 11 | let fname = expand('%:p') 12 | let credline = printf("%s : %s", fname, a:pass) 13 | exec 'split' g:encrypt_credentials_file 14 | " Delete the line if it already exists 15 | exec 'global#^'.fnameescape(fname).'#d' 16 | call append(line('$'), credline) 17 | write 18 | quit 19 | endfunction 20 | 21 | function s:Encrypt() abort 22 | set cryptmethod=blowfish2 23 | let pass = inputsecret("Enter password: ") 24 | exec 'set key='.pass 25 | write 26 | call s:BackupCreds(pass) 27 | endfunction 28 | 29 | command! Encrypt call s:Encrypt() 30 | -------------------------------------------------------------------------------- /nvim/plugin/extract.vim: -------------------------------------------------------------------------------- 1 | function! s:Extract(bang,cmd,fname) range abort 2 | let extn = expand('%:e') 3 | if empty(extn) 4 | let l:fname = a:fname 5 | else 6 | let l:fname = a:fname . '.' . extn 7 | endif 8 | let [first, last] = [a:firstline, a:lastline] 9 | let range = first.",".last 10 | let spaces = matchstr(getline(first),"^ *") 11 | let buf = @@ 12 | silent exe range."yank" 13 | let partial = @@ 14 | let @@ = buf 15 | let old_ai = &ai 16 | try 17 | let &ai = 0 18 | silent exe "norm! :".range."change\".spaces.a:fname."\.\" 19 | finally 20 | let &ai = old_ai 21 | endtry 22 | execute a:cmd . ' ' . expand('%:p:h') . '/' . l:fname 23 | let @@ = partial 24 | silent put 25 | 0delete 26 | let @@ = buf 27 | if !empty(spaces) 28 | silent! exe '%substitute/^' . spaces . '//' 29 | endif 30 | endfunction 31 | 32 | command! -bar -nargs=1 -range SExtract :,call s:Extract(0,"split",) 33 | command! -bar -nargs=1 -range VExtract :,call s:Extract(0,"vsplit",) 34 | command! -bar -nargs=1 -range TExtract :,call s:Extract(0,"tabnew",) 35 | -------------------------------------------------------------------------------- /nvim/plugin/fugitive_extra.vim: -------------------------------------------------------------------------------- 1 | function! s:close_gstatus() 2 | for l:winnr in range(1, winnr('$')) 3 | if !empty(getwinvar(l:winnr, 'fugitive_status')) 4 | execute l:winnr.'close' 5 | endif 6 | endfor 7 | endfunction 8 | command! GstatusClose call s:close_gstatus() 9 | 10 | " Commands & Mappings {{{1 11 | command! -bar -nargs=* Gpurr Git pull --rebase 12 | command! -bar Gpnp Git pull | Git push 13 | command! -bar Gprp Gpurr | Git push 14 | command! -bar Gush Git push origin head 15 | 16 | nnoremap gsl :Glog 17 | nnoremap gsd :Gdiff 18 | nnoremap gse :Gedit 19 | nnoremap gsb :Git blame 20 | nnoremap gsw :Gwrite 21 | nnoremap gsC :Git commit 22 | nnoremap gst :Git 23 | nnoremap gsq :GstatusClose 24 | nnoremap gscd :Gcdpwd 25 | nnoremap gsld :Glcdpwd 26 | nnoremap gsps :Git push 27 | nnoremap gspl :Git pull 28 | -------------------------------------------------------------------------------- /nvim/plugin/hard_ass.vim: -------------------------------------------------------------------------------- 1 | let s:hard_ass = 0 2 | 3 | function! s:ToggleHardAss() abort 4 | let s:hard_ass = !s:hard_ass 5 | 6 | if s:hard_ass 7 | map 8 | map 9 | map 10 | map 11 | 12 | imap 13 | imap 14 | imap 15 | imap 16 | else 17 | unmap 18 | unmap 19 | unmap 20 | unmap 21 | 22 | iunmap 23 | iunmap 24 | iunmap 25 | iunmap 26 | endif 27 | endfunction 28 | 29 | call s:ToggleHardAss() 30 | nnoremap h :call ToggleHardAss() 31 | -------------------------------------------------------------------------------- /nvim/plugin/includeexpr.vim: -------------------------------------------------------------------------------- 1 | function! IncludeExpr() 2 | if v:fname =~? '^this\.' 3 | return substitute(v:fname, '^this\.', '', 'g') 4 | endif 5 | if !exists('g:Abolish') || empty(g:Abolish) | return | endif 6 | return findfile(g:Abolish.snakecase(v:fname)) 7 | endfunction 8 | set includeexpr=IncludeExpr() 9 | -------------------------------------------------------------------------------- /nvim/plugin/neatfoldtext.vim: -------------------------------------------------------------------------------- 1 | function! NeatFoldText() "{{{1 2 | let line = ' ' . substitute(getline(v:foldstart), '^\s*"\?\s*\|\s*"\?\s*{{' . '{\d*\s*', '', 'g') . ' ' 3 | let lines_count = v:foldend - v:foldstart + 1 4 | let lines_count_text = '| ' . printf("%10s", lines_count . ' lines') . ' |' 5 | let foldchar = matchstr(&fillchars, 'fold:\zs.') 6 | let foldtextstart = strpart('+' . repeat(foldchar, v:foldlevel*2) . line, 0, (winwidth(0)*2)/3) 7 | let foldtextend = lines_count_text . repeat(foldchar, 8) 8 | let foldtextlength = strlen(substitute(foldtextstart . foldtextend, '.', 'x', 'g')) + &foldcolumn 9 | return foldtextstart . repeat(foldchar, winwidth(0)-foldtextlength) . foldtextend 10 | endfunction 11 | set foldtext=NeatFoldText() 12 | -------------------------------------------------------------------------------- /nvim/plugin/scratch.vim: -------------------------------------------------------------------------------- 1 | if exists('g:loaded_scratch') 2 | finish 3 | endif 4 | let g:loaded_scratch = 1 5 | 6 | function! s:ScratchEdit(cmd, options) 7 | exe a:cmd tempname() 8 | setl buftype=nofile bufhidden=wipe nobuflisted 9 | if !empty(a:options) | exe 'setl' a:options | endif 10 | endfunction 11 | 12 | let s:filetype_extensions = { 13 | \ 'ruby': 'rb', 14 | \ 'python': 'py', 15 | \ 'javascript': 'js', 16 | \} 17 | 18 | function! s:ScratchFile(cmd, ft) 19 | let extn = get(s:filetype_extensions, a:ft, a:ft) 20 | exec a:cmd 'scratch.'.extn 21 | endfunction 22 | 23 | command! -bar -nargs=* Sedit call s:ScratchEdit('edit', ) 24 | command! -bar -nargs=* Ssplit call s:ScratchEdit('split', ) 25 | command! -bar -nargs=* Svsplit call s:ScratchEdit('vsplit', ) 26 | command! -bar -nargs=* Stabedit call s:ScratchEdit('tabe', ) 27 | 28 | command! -bar -nargs=1 -complete=filetype Sfedit call s:ScratchFile('edit', ) 29 | command! -bar -nargs=1 -complete=filetype Sfsplit call s:ScratchFile('split', ) 30 | command! -bar -nargs=1 -complete=filetype Sfvsplit call s:ScratchFile('vsplit', ) 31 | command! -bar -nargs=1 -complete=filetype Sftabedit call s:ScratchFile('tabe', ) 32 | -------------------------------------------------------------------------------- /nvim/plugin/search.vim: -------------------------------------------------------------------------------- 1 | function! s:Vword() 2 | return getline('.')[col("'<")-1:col("'>")-1] 3 | endfunction 4 | 5 | function! s:search(type, ...) 6 | let sel_save = &selection 7 | let &selection = 'inclusive' 8 | let reg_save = @@ 9 | 10 | if a:0 11 | silent exe 'normal! gvy' 12 | elseif a:type == 'line' 13 | silent exe "normal! '[V']y" 14 | else 15 | silent exe "normal! `[v`]y" 16 | endif 17 | 18 | silent! exec ":grep '" . @@ . "'" getcwd() 19 | redraw! 20 | echo ":grep '" . @@ . "'" getcwd() 21 | 22 | let &selection = sel_save 23 | let @@ = reg_save 24 | endfunction 25 | 26 | nnoremap g/ :set opfunc=searchg@ 27 | xnoremap g/ :call search(visualmode(), 1) 28 | 29 | xnoremap * /\v<=Vword()> 30 | xnoremap g* /\v=Vword() 31 | 32 | xnoremap # o?\v<=Vword()> 33 | xnoremap g# o?\v=Vword() 34 | -------------------------------------------------------------------------------- /nvim/plugin/statusline.vim: -------------------------------------------------------------------------------- 1 | function! s:StatusLineClearVars() 2 | unlet! b:statusline_git_flag 3 | unlet! b:statusline_file_name 4 | unlet! b:statusline_pwd_git_flag 5 | if exists('b:statusline_pwd') && fnamemodify(getcwd(), ':t') !=# b:statusline_pwd 6 | unlet b:statusline_pwd 7 | endif 8 | endfunction 9 | 10 | function! StatusLinePWD() 11 | if !exists('b:statusline_pwd') 12 | let b:statusline_pwd = fnamemodify(getcwd(), ':t') 13 | endif 14 | return b:statusline_pwd 15 | endfunction 16 | 17 | function! StatusLineGitFlag() 18 | if !exists('b:statusline_git_flag') 19 | if !file_readable(expand('%')) 20 | let b:statusline_git_flag = '' 21 | else 22 | let b:statusline_git_flag = functions#GitExecInPath('git status --porcelain ' . expand('%') . " 2>/dev/null | awk '{print $1}'")[:-2] 23 | endif 24 | endif 25 | return b:statusline_git_flag 26 | endfunction 27 | 28 | function! StatusLinePWDGitFlag() 29 | if !exists('b:statusline_pwd_git_flag') 30 | let b:statusline_pwd_git_flag = functions#GitExecInPath("git status --porcelain 2>/dev/null | head -1 | awk '{print $1}'", getcwd())[:-2] 31 | if !empty(b:statusline_pwd_git_flag) 32 | let b:statusline_pwd_git_flag .= ' ' 33 | endif 34 | endif 35 | return b:statusline_pwd_git_flag 36 | endfunction 37 | 38 | function! StatusLineFileName() 39 | let pre = '' 40 | let pat = '://' 41 | let name = expand('%:~:.') 42 | if name =~# pat 43 | let pre = name[:stridx(name, pat) + len(pat)-1] . '...' 44 | let name = name[stridx(name, pat) + len(pat):] 45 | elseif empty(name) && &filetype ==# 'netrw' 46 | let name = fnamemodify(b:netrw_curdir, ':~:.') 47 | endif 48 | let name = simplify(name) 49 | let ratio = winwidth(0) / len(name) 50 | if ratio <= 2 && ratio > 1 51 | let name = pathshorten(name) 52 | elseif ratio <= 1 53 | let name = fnamemodify(name, ':t') 54 | endif 55 | return pre . name 56 | endfunction 57 | 58 | augroup StatusLine 59 | au! 60 | 61 | autocmd WinEnter,CursorHold * call StatusLineClearVars() 62 | augroup END 63 | 64 | function! ArrowStatusline() 65 | return v:lua.require('arrow.statusline').text_for_statusline_with_icons() 66 | endfunction 67 | 68 | set statusline=%(\ %5*%{zoom#statusline()}%*\ \|%) 69 | set statusline+=%(\ %{fugitive#Head()}\ \|%) 70 | set statusline+=%(\ %{StatusLinePWD()}\ \|\ %) 71 | " set statusline+=%(%{ArrowStatusline()}\ \|\ %) 72 | 73 | set statusline+=%(%r%m\ %) 74 | 75 | set statusline+=%1*%{StatusLineFileName()}\ %* 76 | 77 | set statusline+=%4*%(%{dotoo#clock#summary()}\ %)%* 78 | set statusline+=%<%= 79 | set statusline+=%(%{&filetype}\ \|\ %) 80 | set statusline+=%(%3p%%\ \|\ %) 81 | set statusline+=%3l(%L):%-3c 82 | -------------------------------------------------------------------------------- /nvim/plugin/sync_dotoo_files.vim: -------------------------------------------------------------------------------- 1 | function! s:SyncFiles() 2 | :!~/dotfiles/bin/rsync_dotoo_files 3 | endfunction 4 | 5 | command! SyncDotooFiles call s:SyncFiles() 6 | -------------------------------------------------------------------------------- /nvim/plugin/tabline.vim: -------------------------------------------------------------------------------- 1 | " Based on : http://www.offensivethinking.org/data/dotfiles/vimrc 2 | function! MyTabLine() 3 | let s = '' 4 | for i in range(tabpagenr('$')) 5 | let tabnr = i + 1 " range() starts at 0 6 | let winnr = tabpagewinnr(tabnr) 7 | let buflist = tabpagebuflist(tabnr) 8 | let bufnr = buflist[winnr - 1] 9 | let bufname = fnamemodify(bufname(bufnr), ':t') 10 | 11 | let s .= '%' . tabnr . 'T' 12 | let s .= (tabnr == tabpagenr() ? '%#TabLineSel#' : '%#TabLine#') 13 | let s .= ' ' . tabnr 14 | 15 | let n = tabpagewinnr(tabnr,'$') 16 | if n > 1 | let s .= ':' . n | endif 17 | 18 | let s .= empty(bufname) ? ' [No Name] ' : ' ' . bufname . ' ' 19 | 20 | let bufmodified = getbufvar(bufnr, "&mod") 21 | if bufmodified | let s .= '+ ' | endif 22 | endfor 23 | let s .= '%#TabLineFill#' 24 | return s 25 | endfunction 26 | set tabline=%!MyTabLine() 27 | -------------------------------------------------------------------------------- /nvim/plugin/underheadline.vim: -------------------------------------------------------------------------------- 1 | let g:underheadline_char = '-' 2 | 3 | function! s:UnderHeadline() 4 | let cur = [line('.'), col('.')] 5 | exec 'normal! yypwv$r' . g:underheadline_char 6 | call cursor(cur) 7 | endfunction 8 | 9 | command! UnderHeadline call s:UnderHeadline() 10 | nnoremap uh :UnderHeadline 11 | -------------------------------------------------------------------------------- /nvim/plugin/view.vim: -------------------------------------------------------------------------------- 1 | function! s:View(cmd) 2 | redir => output 3 | silent execute a:cmd 4 | redir END 5 | Ssplit " depends on Scratch.vim 6 | call setline(1, split(output, '\n')) 7 | endfunction 8 | 9 | command! -bar -nargs=1 -complete=command View call s:View() 10 | -------------------------------------------------------------------------------- /nvim/plugin/vinegar.vim: -------------------------------------------------------------------------------- 1 | if exists('g:loaded_vinegar') 2 | finish 3 | endif 4 | let g:loaded_vinegar = 1 5 | 6 | function! s:vinegar() 7 | let fname = expand('%:t') 8 | edit %:p:h 9 | normal! gg 10 | call search('\<'.fname.'\>') 11 | endfunction 12 | " nnoremap - :call vinegar() 13 | -------------------------------------------------------------------------------- /nvim/plugin/winbar.vim: -------------------------------------------------------------------------------- 1 | function! s:diagnostics() abort 2 | let ds = [] 3 | let eCount = luaeval("#vim.diagnostic.get(0, { severity = vim.diagnostic.severity.ERROR })") 4 | let wCount = luaeval("#vim.diagnostic.get(0, { severity = vim.diagnostic.severity.WARN })") 5 | if eCount > 0 6 | call add(ds, "%#DiagnosticSignError#E: " . eCount . "%*") 7 | endif 8 | if wCount > 0 9 | call add(ds, "%#DiagnosticSignWarn#W: " . wCount . "%*") 10 | endif 11 | if !empty(ds) 12 | return "Diagnostics: " . join(ds, ", ") 13 | endif 14 | return "" 15 | endfunction 16 | 17 | function! s:gitStatus() abort 18 | let gstatus = StatusLineGitFlag() 19 | if !empty(gstatus) 20 | return "Git: " . gstatus . "%*" 21 | endif 22 | return "" 23 | endfunction 24 | 25 | function! s:addNotEmpty(list, item) abort 26 | if !empty(a:item) 27 | call add(a:list, a:item) 28 | endif 29 | endfunction 30 | 31 | function! Winbar() abort 32 | let winbar = [] 33 | call s:addNotEmpty(winbar, s:gitStatus()) 34 | call s:addNotEmpty(winbar, s:diagnostics()) 35 | return join(winbar, " | ") 36 | endfunction 37 | -------------------------------------------------------------------------------- /nvim/plugin_settings/ale.vim: -------------------------------------------------------------------------------- 1 | let g:ale_lint_on_text_changed = 'never' 2 | let g:ale_lint_on_insert_leave = 0 3 | let g:ale_lint_on_enter = 0 4 | 5 | let g:ale_echo_msg_error_str = 'E' 6 | let g:ale_echo_msg_warning_str = 'W' 7 | let g:ale_echo_msg_format = '[%linter%] %s [%severity%]' 8 | let g:ale_fix_on_save = 1 9 | 10 | let g:ale_fixers = { 11 | \ 'haskell': ['hindent'], 12 | \ 'rust': ['rustfmt'], 13 | \} 14 | -------------------------------------------------------------------------------- /nvim/plugin_settings/bundler.vim: -------------------------------------------------------------------------------- 1 | augroup Bundler 2 | au! 3 | 4 | autocmd User Bundler if &makeprg !~# 'bundle' | setl makeprg^=bundle\ exec\ | endif 5 | augroup END 6 | -------------------------------------------------------------------------------- /nvim/plugin_settings/coc.vim: -------------------------------------------------------------------------------- 1 | " Use `[g` and `]g` to navigate diagnostics 2 | " nmap [g (coc-diagnostic-prev) 3 | " nmap ]g (coc-diagnostic-next) 4 | 5 | " GoTo code navigation. 6 | " nmap gd (coc-definition) 7 | " nmap gy (coc-type-definition) 8 | " nmap gi (coc-implementation) 9 | " nmap gr (coc-references) 10 | 11 | " function! s:show_documentation() abort 12 | " if !CocAction('doHover') 13 | " normal! K 14 | " endif 15 | " endfunction 16 | 17 | " Use K to show documentation in preview window. 18 | " nnoremap K :call show_documentation() 19 | 20 | " Introduce function text object 21 | " NOTE: Requires 'textDocument.documentSymbol' support from the language server. 22 | " xmap if (coc-funcobj-i) 23 | " xmap af (coc-funcobj-a) 24 | " omap if (coc-funcobj-i) 25 | " omap af (coc-funcobj-a) 26 | 27 | let g:coc_global_extensions = [ 28 | \ 'coc-sh', 29 | \ 'coc-css', 30 | \ 'coc-sql', 31 | \ 'coc-java', 32 | \ 'coc-json', 33 | \ 'coc-yaml', 34 | \ 'coc-vimlsp', 35 | \ 'coc-graphql', 36 | \ 'coc-swagger', 37 | \ 'coc-tsserver', 38 | \ 'coc-solargraph', 39 | \ 'coc-rust-analyzer', 40 | \ ] 41 | -------------------------------------------------------------------------------- /nvim/plugin_settings/ctrlp.vim: -------------------------------------------------------------------------------- 1 | let g:ctrlp_cache_dir = $HOME . '/.cache/ctrlp' 2 | let g:ctrlp_extensions = ['tag', 'buffertag'] 3 | let g:ctrlp_show_hidden = 1 4 | let g:ctrlp_custom_ignore = 'node_modules' 5 | 6 | if executable('ag') 7 | let g:ctrlp_user_command = 'ag %s -l --nocolor -g ""' 8 | elseif executable('rg') 9 | let g:ctrlp_user_command = 'rg %s --files --color=never --glob ""' 10 | else 11 | let g:ctrlp_user_command = ['.git', 12 | \ 'cd %s && git ls-files . -co --exclude-standard', 13 | \ 'find %s -type f' ] 14 | endif 15 | -------------------------------------------------------------------------------- /nvim/plugin_settings/doge.vim: -------------------------------------------------------------------------------- 1 | let g:doge_mapping = 'dg' 2 | -------------------------------------------------------------------------------- /nvim/plugin_settings/dotoo.vim: -------------------------------------------------------------------------------- 1 | let g:dotoo#home=expand('~/Dropbox/Documents/org-files') 2 | let g:dotoo#agenda#files=['~/Dropbox/Documents/org-files/**/*.org'] 3 | let g:dotoo#capture#refile=expand('~/Dropbox/Documents/org-files/refile.org') 4 | let g:dotoo_begin_src_languages=[ 5 | \ 'vim', 6 | \ 'json', 7 | \ 'javascript', 8 | \ 'ruby', 9 | \ 'typescript', 10 | \ 'go', 11 | \ 'rust', 12 | \ 'java', 13 | \] 14 | 15 | nnoremap ww :edit ~/Dropbox/Documents/dotoo-files/notes.dotoo 16 | nnoremap wj :edit ~/Dropbox/Documents/dotoo-files/notes/diary 17 | -------------------------------------------------------------------------------- /nvim/plugin_settings/flog.vim: -------------------------------------------------------------------------------- 1 | augroup myfloggroup 2 | autocmd FileType floggraph nmap q FlogQuit 3 | augroup END 4 | -------------------------------------------------------------------------------- /nvim/plugin_settings/fzf.vim: -------------------------------------------------------------------------------- 1 | let g:fzf_command_prefix = 'Fzf' 2 | let g:fzf_preview_window='right:60%' 3 | let g:fzf_layout = { 'window': { 'width': 0.9, 'height': 0.6 } } 4 | -------------------------------------------------------------------------------- /nvim/plugin_settings/gist.vim: -------------------------------------------------------------------------------- 1 | let g:gist_show_privates = 0 2 | let g:gist_detect_filetype = 1 3 | let g:gist_open_browser_after_post = 1 4 | -------------------------------------------------------------------------------- /nvim/plugin_settings/gitv.vim: -------------------------------------------------------------------------------- 1 | let g:Gitv_WipeAllOnClose = 1 2 | let g:Gitv_DoNotMapCtrlKey = 1 3 | let g:Gitv_OpenPreviewOnLaunch = 1 4 | let g:Gitv_TruncateCommitSubjects = 1 5 | -------------------------------------------------------------------------------- /nvim/plugin_settings/go.vim: -------------------------------------------------------------------------------- 1 | let g:go_template_autocreate = 0 2 | -------------------------------------------------------------------------------- /nvim/plugin_settings/hexokinase.vim: -------------------------------------------------------------------------------- 1 | let g:Hexokinase_highlighters = [ 'backgroundfull' ] 2 | let g:Hexokinase_optOutPatterns = [ 'colour_names' ] 3 | -------------------------------------------------------------------------------- /nvim/plugin_settings/javascript.vim: -------------------------------------------------------------------------------- 1 | let g:javascript_conceal = 1 2 | let g:javascript_plugin_flow = 1 3 | let g:javascript_plugin_jsdoc = 1 4 | let g:javascript_enable_domhtmlcss = 1 5 | 6 | let g:javascript_conceal_function = "ƒ" 7 | let g:javascript_conceal_null = "ø" 8 | let g:javascript_conceal_this = "@" 9 | let g:javascript_conceal_return = "⇚" 10 | let g:javascript_conceal_undefined = "¿" 11 | let g:javascript_conceal_NaN = "ℕ" 12 | let g:javascript_conceal_prototype = "¶" 13 | let g:javascript_conceal_static = "•" 14 | let g:javascript_conceal_super = "Ω" 15 | let g:javascript_conceal_arrow_function = "⇒" 16 | -------------------------------------------------------------------------------- /nvim/plugin_settings/jekyll.vim: -------------------------------------------------------------------------------- 1 | let g:jekyll_path = "~/src/dhruvasagar.com" 2 | 3 | nnoremap jb :JekyllBuild 4 | nnoremap jn :JekyllPost 5 | nnoremap jl :JekyllList 6 | -------------------------------------------------------------------------------- /nvim/plugin_settings/jsx.vim: -------------------------------------------------------------------------------- 1 | let g:jsx_ext_required = 0 2 | -------------------------------------------------------------------------------- /nvim/plugin_settings/langclient.vim: -------------------------------------------------------------------------------- 1 | " let g:LanguageClient_serverCommands = { 2 | " \ 'rust': ['rustup', 'run', 'nightly', 'rls'], 3 | " \ 'javascript': ['javascript-typescript-stdio'], 4 | " \ 'javascript.jsx': ['javascript-typescript-stdio'], 5 | " \ 'typescript': ['javascript-typescript-stdio'], 6 | " \ } 7 | " let g:LanguageClient_diagnosticsList = "Disabled" 8 | 9 | " function! LC_maps() 10 | " if has_key(g:LanguageClient_serverCommands, &filetype) 11 | " nnoremap K :call LanguageClient#textDocument_hover() 12 | " nnoremap :call LanguageClient#textDocument_definition() 13 | " nnoremap :call LanguageClient#textDocument_rename() 14 | " endif 15 | " endfunction 16 | 17 | " augroup LanguageClient 18 | " au! 19 | 20 | " autocmd FileType * call LC_maps() 21 | " augroup END 22 | -------------------------------------------------------------------------------- /nvim/plugin_settings/netrw.vim: -------------------------------------------------------------------------------- 1 | let g:netrw_banner=0 2 | 3 | -------------------------------------------------------------------------------- /nvim/plugin_settings/prosession.vim: -------------------------------------------------------------------------------- 1 | let g:prosession_tmux_title = 1 2 | -------------------------------------------------------------------------------- /nvim/plugin_settings/quickrun.vim: -------------------------------------------------------------------------------- 1 | let g:quickrun_config = {} 2 | let g:quickrun_config.clojure = { 3 | \ 'command': 'clojure' 4 | \ } 5 | let g:quickrun_config.javascript = { 6 | \ 'command': 'node', 7 | \ } 8 | -------------------------------------------------------------------------------- /nvim/plugin_settings/rails.vim: -------------------------------------------------------------------------------- 1 | let g:rails_gem_projections = { 2 | \ "carrierwave": { 3 | \ "app/uploaders/*_uploader.rb": { 4 | \ "command": "uploader", 5 | \ "template": "class %SUploader < CarrierWave::Uploader::Base\nend", 6 | \ "test": [ 7 | \ "spec/uploaders/%s_uploader_spec.rb" 8 | \ ] 9 | \ }}, 10 | \ "resque": { 11 | \ "app/jobs/*_job.rb": { 12 | \ "command": "job", 13 | \ "template": "class %SJob\n@queue = ''\nend", 14 | \ "test": [ 15 | \ "spec/jobs/%s_job_spec.rb" 16 | \ ] 17 | \ }} 18 | \ } 19 | -------------------------------------------------------------------------------- /nvim/plugin_settings/ruby.vim: -------------------------------------------------------------------------------- 1 | let g:rubycomplete_rails = 1 2 | let g:rubycomplete_buffer_loading = 1 3 | let g:rubycomplete_classes_in_global = 1 4 | -------------------------------------------------------------------------------- /nvim/plugin_settings/slime.vim: -------------------------------------------------------------------------------- 1 | let g:slime_target = 'tmux' 2 | let g:slime_paste_file = tempname() 3 | -------------------------------------------------------------------------------- /nvim/plugin_settings/snipmate.vim: -------------------------------------------------------------------------------- 1 | let g:snipMate = {} 2 | let g:snipMate.scope_aliases = {} 3 | let g:snipMate.scope_aliases.haml = 'javascript' 4 | let g:snipMate.scope_aliases.jade = 'javascript' 5 | let g:snipMate.scope_aliases.markdown = 'html' 6 | let g:snipMate.scope_aliases.javascript = 'javascript.d3,javascript-jquery' 7 | -------------------------------------------------------------------------------- /nvim/plugin_settings/switch.vim: -------------------------------------------------------------------------------- 1 | let g:switch_mapping = "c~" 2 | -------------------------------------------------------------------------------- /nvim/plugin_settings/syntastic.vim: -------------------------------------------------------------------------------- 1 | let g:syntastic_enable_signs = 1 2 | let g:syntastic_auto_loc_list = 0 3 | let g:syntastic_aggregate_errors = 1 4 | let g:syntastic_always_populate_loc_list = 1 5 | 6 | let g:syntastic_javascript_checkers=['eshint'] 7 | -------------------------------------------------------------------------------- /nvim/plugin_settings/table.vim: -------------------------------------------------------------------------------- 1 | fun! s:isAtStartOfLine(mapping) 2 | let text_before_cursor = getline('.')[0 : col('.')-1] 3 | let mapping_pattern = '\V' . escape(a:mapping, '\') 4 | let comment_pattern = '\V' . escape(substitute(&l:commentstring, '%s.*$', '', ''), '\') 5 | return (text_before_cursor =~? '^' . ('\v(' . comment_pattern . '\v)?') . '\s*\v' . mapping_pattern . '\v$') 6 | endf 7 | 8 | inoreabbrev 9 | \ isAtStartOfLine('\|\|') ? 10 | \ ':TableModeEnable' : '' 11 | inoreabbrev __ 12 | \ isAtStartOfLine('__') ? 13 | \ ':silent! TableModeDisable' : '__' 14 | -------------------------------------------------------------------------------- /nvim/plugin_settings/tagbar.vim: -------------------------------------------------------------------------------- 1 | let g:tagbar_sort = 0 2 | let g:tagbar_indent = 0 3 | let g:tagbar_compact = 1 4 | let g:tagbar_autofocus = 1 5 | let g:tagbar_autoclose = 1 6 | -------------------------------------------------------------------------------- /nvim/plugin_settings/test.vim: -------------------------------------------------------------------------------- 1 | if has('nvim') 2 | let test#strategy = 'neovim' 3 | else 4 | let test#strategy = 'vimux' 5 | endif 6 | 7 | let test#ruby#rspec#options = { 8 | \ 'nearest': '--format doc', 9 | \ 'file': '--format doc', 10 | \ 'suite': '--format progress' 11 | \} 12 | 13 | let test#enabled_runners = ['viml#testify'] 14 | -------------------------------------------------------------------------------- /nvim/plugin_settings/ultisnips.vim: -------------------------------------------------------------------------------- 1 | " let g:UltiSnips = {} 2 | " let g:UltiSnips.ExpandTrigger = '' 3 | " let g:UltiSnips.JumpForwardTrigger = '' 4 | " let g:UltiSnips.JumpBackwardTrigger = '' 5 | " let g:UltiSnips.always_use_first_snippet = 1 6 | " let g:UltiSnips.Ultisnips_ft_filter = { 7 | " \ 'default' : {'filetypes': ['all', 'FILETYPE'] }, 8 | " \ 'jade': {'filetypes': ['all', 'css', 'javascript'] }, 9 | " \ 'haml': {'filetypes': ['all', 'haml', 'css', 'javascript'] }, 10 | " \ 'html': {'filetypes': ['all', 'html', 'css', 'javascript'] }, 11 | " \ 'eruby': {'filetypes': ['all', 'eruby', 'css', 'html', 'javascript'] } 12 | " \ } 13 | " let g:UltiSnips.snipmate_ft_filter = { 14 | " \ 'default': {'filetypes': ['_', 'FILETYPE'] }, 15 | " \ 'jade': {'filetypes': ['all', 'css', 'javascript'] }, 16 | " \ 'haml': {'filetypes': ['_', 'haml', 'css', 'javascript'] }, 17 | " \ 'html': {'filetypes': ['_', 'html', 'css', 'javascript'] }, 18 | " \ 'eruby': {'filetypes': ['_', 'eruby', 'css', 'html', 'javascript'] } 19 | " \ } 20 | 21 | let g:UltiSnipsExpandTrigger = '' 22 | let g:UltiSnipsJumpForwardTrigger = '' 23 | let g:UltiSnipsJumpBackwardTrigger = '' 24 | 25 | augroup UltiSnips 26 | au! 27 | 28 | autocmd FileType javascript UltiSnipsAddFiletypes html 29 | augroup END 30 | -------------------------------------------------------------------------------- /nvim/plugin_settings/vimtex.vim: -------------------------------------------------------------------------------- 1 | let g:vimtex_view_method = 'skim' 2 | -------------------------------------------------------------------------------- /nvim/plugin_settings/vimwiki.vim: -------------------------------------------------------------------------------- 1 | let g:vimwiki_global_ext = 0 2 | let g:vimwiki_table_mappings = 0 3 | let g:vimwiki_table_auto_fmt = 0 4 | 5 | let wiki = { 6 | \ 'path': '~/Dropbox/Documents/vimwiki', 7 | \ 'nested_syntaxes': {'ledger': 'ledger', 'sh': 'sh', 'bash': 'bash', 'ruby': 'ruby'}, 8 | \ 'ext': '.wiki', 9 | \} 10 | let g:vimwiki_list = [wiki] 11 | -------------------------------------------------------------------------------- /nvim/plugin_settings/vrc.vim: -------------------------------------------------------------------------------- 1 | let g:vrc_allow_get_request_body = 1 2 | let g:vrc_syntax_highlight_response = 1 3 | let g:vrc_response_default_content_type = 'application/json' 4 | let g:vrc_auto_format_response_enabled = 1 5 | -------------------------------------------------------------------------------- /nvim/spell/en.utf-8.add: -------------------------------------------------------------------------------- 1 | Admin 2 | mongodb 3 | refactor 4 | end 5 | plugin 6 | config 7 | wiki 8 | Dhruva 9 | Varun 10 | committer 11 | diff 12 | syntastic 13 | inline 14 | reliably 15 | macvim 16 | unicode 17 | zsh 18 | vimrc 19 | gvim 20 | Plugins 21 | colorscheme 22 | Ctrl 23 | vim 24 | http 25 | github 26 | autoload 27 | html 28 | quicktask 29 | Facebook 30 | facebook 31 | linkedin 32 | autocomplete 33 | Sagar 34 | metadata 35 | Tmuxification 36 | Tmux 37 | tmux 38 | Niharica 39 | ICICI 40 | App 41 | LOD 42 | published 43 | -------------------------------------------------------------------------------- /nvim/spell/en.utf-8.add.spl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dhruvasagar/dotfiles/35ea2424d8be2ee974baeb68a4e4be65bcae1c11/nvim/spell/en.utf-8.add.spl -------------------------------------------------------------------------------- /nvim/spell/en.utf-8.spl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dhruvasagar/dotfiles/35ea2424d8be2ee974baeb68a4e4be65bcae1c11/nvim/spell/en.utf-8.spl -------------------------------------------------------------------------------- /nvim/spell/en.utf-8.sug: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dhruvasagar/dotfiles/35ea2424d8be2ee974baeb68a4e4be65bcae1c11/nvim/spell/en.utf-8.sug -------------------------------------------------------------------------------- /nvim/syntax/tab.vim: -------------------------------------------------------------------------------- 1 | " Vim syntax file 2 | " Language: Guitar Tabs 3 | " Maintainer: Josh Hartigan 4 | " Latest Revision: 21 September 2014 5 | 6 | if exists("b:current_syntax") 7 | finish 8 | endif 9 | 10 | " Regex matches 11 | syn match SectionHeader /\v.+\:$/ 12 | 13 | syn match StringLetter /\v^[A-Za-z]\|/ 14 | 15 | syn match Empty /\v-/ 16 | 17 | syn match Number /x|\d\d?/ 18 | 19 | syn match SlideUp /\/\// 20 | syn match SlideDown /\\\\/ 21 | syn match HammerOn /h[^a-zA-Z]/ 22 | syn match PullOff /p\d[^a-zA-Z]/ 23 | syn match Bend /b\d[^a-zA-Z]/ 24 | syn match Vibrato /\dv\d\?-/ 25 | 26 | syn match TabComment /(.*)/ 27 | 28 | " Highlight types 29 | highlight link SlideUp Function 30 | highlight link SlideDown Function 31 | highlight link HammerOn Function 32 | highlight link PullOff Function 33 | highlight link Bend Function 34 | highlight link Vibrato Function 35 | 36 | highlight link Empty Comment 37 | 38 | highlight link Number Type 39 | 40 | highlight link SectionHeader PreProc 41 | 42 | highlight link StringLetter String 43 | 44 | highlight link TabComment Comment 45 | -------------------------------------------------------------------------------- /qutebrowser/autoconfig.yml: -------------------------------------------------------------------------------- 1 | # If a config.py file exists, this file is ignored unless it's explicitly loaded 2 | # via config.load_autoconfig(). For more information, see: 3 | # https://github.com/qutebrowser/qutebrowser/blob/master/doc/help/configuring.asciidoc#loading-autoconfigyml 4 | # DO NOT edit this file by hand, qutebrowser will overwrite it. 5 | # Instead, create a config.py - see :help for details. 6 | 7 | config_version: 2 8 | settings: 9 | colors.webpage.darkmode.enabled: 10 | global: false 11 | content.autoplay: 12 | global: false 13 | content.blocking.method: 14 | global: both 15 | content.desktop_capture: 16 | https://meet.google.com: true 17 | content.geolocation: 18 | https://www.google.com: true 19 | https://www.horizonblue.com: true 20 | content.media.audio_capture: 21 | https://meet.google.com: true 22 | content.media.audio_video_capture: 23 | https://meet.google.com: true 24 | content.media.video_capture: 25 | https://meet.google.com: true 26 | content.notifications.enabled: 27 | https://calendar.google.com: true 28 | https://lichess.org: true 29 | https://mail.google.com: true 30 | https://mail.protonmail.com: true 31 | https://meet.google.com: true 32 | https://www.chess.com: true 33 | https://www.facebook.com: true 34 | https://www.netflix.com: true 35 | https://www.producthunt.com: true 36 | https://www.reddit.com: true 37 | https://yourstory.com: true 38 | content.register_protocol_handler: 39 | https://calendar.google.com?cid=%25s: true 40 | https://mail.google.com?extsrc=mailto&url=%25s: true 41 | fonts.default_family: 42 | global: FiraCode Nerd Font 43 | fonts.default_size: 44 | global: 10pt 45 | qt.highdpi: 46 | global: true 47 | tabs.show: 48 | global: always 49 | zoom.default: 50 | global: '100' 51 | -------------------------------------------------------------------------------- /qutebrowser/bookmarks/urls: -------------------------------------------------------------------------------- 1 | https://www.youtube.com/ YouTube 2 | https://github.com/tunecore/Sip tunecore/Sip: TuneCore Sip Application 3 | https://github.com/tunecore/tc-www tunecore/tc-www: TuneCore web site 4 | https://www.worldometers.info/coronavirus/ Coronavirus Update (Live): 5,717,794 Cases and 352,983 Deaths from COVID-19 Virus Pandemic - Worldometer 5 | https://www.thewinstonatlyndhurst.com/ The Winston at Lyndhurst | Lyndhurst Apartments for Rent 6 | https://capturetheflag.withgoogle.com/challenges/reversing-beginner Google CTF 7 | https://workforce.intuit.com/app/payroll-employee-portal-ui/portal/paychecks Payroll Employee Portal Experience 8 | https://www.shawntabrizi.com/substrate-collectables-workshop/#/README Welcome 9 | https://play.rust-lang.org/ Rust Playground 10 | -------------------------------------------------------------------------------- /qutebrowser/config.py: -------------------------------------------------------------------------------- 1 | import dracula.draw 2 | from qutebrowser.api import interceptor 3 | 4 | # Load existing settings made via :set 5 | config.load_autoconfig() 6 | config.set("auto_save.session", True) 7 | # config.set('window.hide_decoration', True) 8 | config.set("fonts.web.size.default", 14) 9 | # config.set("colors.webpage.darkmode.enabled", True) 10 | 11 | config.bind(",m", "spawn mpv {url}") 12 | config.bind(",M", "hint links spawn mpv {hint-url}") 13 | 14 | config.bind(",pp", "spawn --userscript qute-pass --dmenu-invocation dmenu") 15 | config.bind( 16 | ",pu", "spawn --userscript qute-pass --dmenu-invocation dmenu --username-only" 17 | ) 18 | config.bind( 19 | ",pa", "spawn --userscript qute-pass --dmenu-invocation dmenu --password-only" 20 | ) 21 | config.bind(",po", "spawn --userscript qute-pass --dmenu-invocation dmenu --otp-only") 22 | 23 | dracula.draw.blood(c) 24 | 25 | 26 | def filter_yt(info: interceptor.Request): 27 | """Block the given request if necessary.""" 28 | url = info.request_url 29 | if ( 30 | url.host() == "www.youtube.com" 31 | and url.path() == "/get_video_info" 32 | and "&adformat=" in url.query() 33 | ): 34 | info.block() 35 | 36 | 37 | interceptor.register(filter_yt) 38 | -------------------------------------------------------------------------------- /qutebrowser/greasemonkey/youtube-adblock.user.js: -------------------------------------------------------------------------------- 1 | // ==UserScript== 2 | // @name Auto Skip YouTube Ads 3 | // @version 1.0.1 4 | // @description Speed up and skip YouTube ads automatically 5 | // @author jso8910 6 | // @match *://*.youtube.com/* 7 | // @exclude *://*.youtube.com/subscribe_embed?* 8 | // ==/UserScript== 9 | let main = new MutationObserver(() => { 10 | let ad = [...document.querySelectorAll(".ad-showing")][0]; 11 | if (ad) { 12 | let btn = document.querySelector( 13 | ".videoAdUiSkipButton,.ytp-ad-skip-button", 14 | ); 15 | if (btn) { 16 | btn.click(); 17 | } 18 | } 19 | }); 20 | 21 | main.observe( 22 | document.querySelector(".videoAdUiSkipButton,.ytp-ad-skip-button"), 23 | { attributes: true, characterData: true, childList: true }, 24 | ); 25 | -------------------------------------------------------------------------------- /qutebrowser/qsettings/QtProject.conf: -------------------------------------------------------------------------------- 1 | [FileDialog] 2 | history=file:///home/h4x0rdud3/Videos, file:///home/h4x0rdud3/Dropbox/Photos, file:///home/h4x0rdud3/Dropbox/Home Team Folder/Documents, file:///home/h4x0rdud3/Dropbox/Photos/YouTube, file:///home/h4x0rdud3 3 | lastVisited=file:///home/h4x0rdud3/Dropbox/Home Team Folder/Documents 4 | qtVersion=5.15.2 5 | shortcuts=file:, file:///home/h4x0rdud3 6 | sidebarWidth=99 7 | treeViewHeader=@ByteArray(\0\0\0\xff\0\0\0\0\0\0\0\x1\0\0\0\0\0\0\0\0\x1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x1\xf1\0\0\0\x4\x1\x1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x64\xff\xff\xff\xff\0\0\0\x81\0\0\0\0\0\0\0\x4\0\0\0\xe2\0\0\0\x1\0\0\0\0\0\0\0g\0\0\0\x1\0\0\0\0\0\0\0@\0\0\0\x1\0\0\0\0\0\0\0h\0\0\0\x1\0\0\0\0\0\0\x3\xe8\0\xff\xff\xff\xff) 8 | viewMode=Detail 9 | -------------------------------------------------------------------------------- /qutebrowser/quickmarks: -------------------------------------------------------------------------------- 1 | qutehub https://github.com/qutebrowser/qutebrowser 2 | timesheet https://docs.google.com/spreadsheets/d/1li8GgdVCvjFxIh0lMkYE5qGT6kO7NObWu3vxu1KKkgM/edit#gid=1325117406 3 | resume https://dhruvasagar.dev/ 4 | bescom https://bescomrural.nsoft.in/ 5 | blog https://dhruvasagar.com/ 6 | rwtf https://www.reddit.com/r/WTF/ 7 | rvim https://www.reddit.com/r/vim/ 8 | voffice https://imisstheoffice.eu/ 9 | tarkamail http://mail.tarkalabs.com 10 | -------------------------------------------------------------------------------- /setup: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | XDG_CONFIG_HOME=$XDG_CONFIG_HOME:=$HOME/.config 4 | 5 | rm -rf ~/.zshrc 6 | ln -s ~/dotfiles/zsh/zshrc ~/.zshrc 7 | . ~/.zshrc 8 | 9 | relink ~/dotfiles/vim ~/.vim 10 | relink ~/dotfiles/emacs ~/.emacs.d 11 | relink ~/dotfiles/weechat ~/.weechat 12 | relink ~/dotfiles/config/tmux.conf ~/.tmux.conf 13 | relink ~/dotfiles/qutebrowser ~/.qutebrowser 14 | relink ~/dotfiles/vim/tridactylrc ~/.tridactylrc 15 | relink ~/dotfiles/sshconfig ~/.ssh/config 16 | 17 | relink ~/dotfiles/nvim "${XDG_CONFIG_HOME}/nvim" 18 | relink ~/dotfiles/config/wezterm.lua ~/.wezterm.lua 19 | relink ~/dotfiles/config/kitty.conf "${XDG_CONFIG_HOME}/kitty/kitty.conf" 20 | relink ~/dotfiles/config/alacritty.yml "${XDG_CONFIG_HOME}/alacritty/alacritty.yml" 21 | 22 | platform=$(uname | awk '{print tolower($0)}') 23 | # shellcheck source=/dev/null 24 | [[ -f "setup_$platform" ]] && source "./setup_$platform" 25 | 26 | ./setup_git 27 | ./setup_vim 28 | ./setup_tmux 29 | ./setup_asdf 30 | ./setup_pass 31 | -------------------------------------------------------------------------------- /setup_arch: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | 4 | -------------------------------------------------------------------------------- /setup_asdf: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Install asdf 4 | if [[ ! -d ~/.asdf ]]; then 5 | git clone https://github.com/asdf-vm/asdf.git ~/.asdf 6 | source ~/.asdf/asdf.sh 7 | 8 | asdf plugin-add ruby 9 | asdf plugin-add rust 10 | asdf plugin-add golang 11 | asdf plugin-add nodejs 12 | asdf plugin-add python 13 | asdf plugin-add haskell 14 | fi 15 | -------------------------------------------------------------------------------- /setup_darwin: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | relink ~/dotfiles/hammerspoon ~/.hammerspoon 4 | relink ~/dotfiles/config/aerospace.toml ~/.aerospace.toml 5 | 6 | brew install zsh 7 | [[ ! $SHELL =~ "zsh" ]] && chsh -s "$(command -v zsh)" 8 | 9 | brew install jq 10 | brew install bat 11 | brew install fzf 12 | brew install gcc 13 | brew install hub 14 | brew install bash 15 | brew install htop 16 | brew install nmap 17 | brew install tmux 18 | brew install wget 19 | brew install awscli 20 | brew install ledger 21 | brew install ripgrep 22 | brew install weechat 23 | brew install reattach-to-user-namespace 24 | 25 | # gnu tools better than osx defaults 26 | brew install gawk 27 | brew install gnupg 28 | brew install gnutls 29 | brew install colima 30 | brew install gnu-sed 31 | brew install gnu-tar 32 | brew install coreutils 33 | brew install git-delta 34 | brew install moreutils 35 | brew install gnu-indent 36 | brew install --HEAD universal-ctags/universal-ctags/universal-ctags 37 | 38 | brew install --cask kap 39 | brew install --cask pika 40 | brew install --cask ngrok 41 | brew install --cask skype 42 | brew install --cask slack 43 | brew install --cask skitch 44 | brew install --cask dropbox 45 | brew install --cask keybase 46 | brew install --cask wezterm 47 | brew install --cask caffeine 48 | brew install --cask hammerspoon 49 | 50 | brew install --cask nikitabobko/tap/aerospace 51 | 52 | brew install --cask font-fira-sans # for Italics 53 | brew install --cask font-hack-nerd-font 54 | brew install --cask font-fira-code-nerd-font 55 | 56 | brew install --cask firefox 57 | brew install --cask qutebrowser 58 | -------------------------------------------------------------------------------- /setup_debian: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | sudo apt-get install jq \ 4 | bat \ 5 | fzf \ 6 | zsh \ 7 | htop \ 8 | nmap \ 9 | tmux \ 10 | ngrok \ 11 | awscli \ 12 | docker \ 13 | ledger \ 14 | dropbox \ 15 | ripgrep \ 16 | weechat \ 17 | caffeine \ 18 | build-essential 19 | 20 | if [ $+commands[snap] ]; then 21 | sudo snap install ngrok 22 | 23 | snap install hub --classic 24 | sudo snap install slack --classic 25 | sudo snap install skype --classic 26 | sudo snap install keybase --edge 27 | fi 28 | 29 | # Install dependencies for VIM 30 | sudo apt-get install libxt-dev \ 31 | libx11-dev \ 32 | libxpm-dev \ 33 | python-dev \ 34 | python3-dev \ 35 | libncurses-dev 36 | 37 | # Install dependencies for TMUX 38 | sudo apt install -y automake \ 39 | bison \ 40 | pkg-config \ 41 | libevent-dev \ 42 | libncurses5-dev 43 | 44 | # Install dependencies for `scrcpy` 45 | sudo apt install ffmpeg libsdl2-2.0-0 adb wget \ 46 | gcc git pkg-config meson ninja-build libsdl2-dev \ 47 | libavcodec-dev libavdevice-dev libavformat-dev libavutil-dev \ 48 | libswresample-dev libusb-1.0-0 libusb-1.0-0-dev 49 | 50 | [[ ! $SHELL =~ "zsh" ]] && chsh -s $(which zsh) 51 | -------------------------------------------------------------------------------- /setup_git: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | relink ~/dotfiles/git/config ~/.gitconfig 4 | relink ~/dotfiles/git/ignore ~/.gitignore 5 | # relink ~/dotfiles/git/template ~/.git_template 6 | relink ~/dotfiles/git/attributes ~/.gitattributes 7 | relink ~/dotfiles/git/commit_template ~/.gitcommittemplate 8 | -------------------------------------------------------------------------------- /setup_linux: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | relink ~/dotfiles/config/xprofile ~/.xprofile 4 | relink ~/dotfiles/config/i3 "${XDG_CONFIG_HOME}/i3" 5 | 6 | base_os=$(cat /etc/os-release | grep -i id_like | sed 's/[^=]*=//') 7 | 8 | [[ -f "setup_${base_os}" ]] && source "./setup_${base_os}" 9 | -------------------------------------------------------------------------------- /setup_nvim: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [[ ! -d ~/src/oss/neovim ]]; then 4 | git clone git@github.com:neovim/neovim.git ~/src/oss/neovim 5 | cd ~/src/oss/neovim 6 | 7 | ~/dotfiles/bin/buildnvim 8 | 9 | nvim +"Lazy install --fast" +qall 10 | fi 11 | -------------------------------------------------------------------------------- /setup_pass: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [[ ! -d ~/src/dhruvasagar/password-store ]]; then 4 | git clone git@github.com:dhruvasagar/password-store.git \ 5 | ~/src/dhruvasagar/password-store 6 | fi 7 | 8 | relink ~/src/dhruvasagar/password-store/gnupg ~/.gnupg 9 | relink ~/src/dhruvasagar/password-store ~/.password-store 10 | -------------------------------------------------------------------------------- /setup_scrcpy: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [[ ! -d ~/src/oss/scrcpy ]]; then 4 | git clone git@github.com:Genymobile/scrcpy.git 5 | cd ~/src/oss/scrcpy 6 | 7 | ~/dotfiles/bin/updatescrcpy 8 | fi 9 | -------------------------------------------------------------------------------- /setup_tmux: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Clone & build tmux 4 | if [[ ! -d ~/src/oss/tmux ]]; then 5 | git clone git@github.com:tmux/tmux.git ~/src/oss/tmux 6 | cd ~/src/oss/tmux 7 | 8 | # Compile & Install Tmux 9 | sh autogen.sh 10 | ./configure --enable-utf8proc && make 11 | sudo make install 12 | fi 13 | -------------------------------------------------------------------------------- /setup_vim: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Clone & build vim 4 | if [[ ! -d ~/src/oss/vim ]]; then 5 | git clone git@github.com:vim/vim.git ~/src/oss/vim 6 | cd ~/src/oss/vim 7 | 8 | # Compile and Install VIM 9 | ~/dotfiles/bin/buildvim 10 | 11 | # Install Packup 12 | git clone git@github.com:dhruvasagar/packup.git ~/.vim/pack/packup/opt/packup 13 | 14 | vim +PackupInstall +qall 15 | fi 16 | -------------------------------------------------------------------------------- /sshconfig: -------------------------------------------------------------------------------- 1 | Include /Users/dhruva/.colima/ssh_config 2 | 3 | Include configs/* 4 | IdentityFile ~/.ssh/id_rsa 5 | ServerAliveInterval 240 6 | # RemoteCommand TERM=xterm-256color $SHELL 7 | 8 | Host bitbucket.org 9 | HostName bitbucket.org 10 | User git 11 | IdentityFile ~/.ssh/bitbucket_tarkalabs 12 | IdentitiesOnly yes 13 | PreferredAuthentications publickey 14 | 15 | Host blog 16 | HostName dhruvasagar.com 17 | User dhruvasagar 18 | 19 | Host blog-tunnel 20 | HostName dhruvasagar.com 21 | User dhruvasagar 22 | RemoteForward 9022 localhost:22 23 | 24 | Host vicharak 25 | Hostname 192.168.1.150 26 | User vicharak 27 | 28 | Host blog-socks 29 | HostName dhruvasagar.com 30 | User dhruvasagar 31 | RequestTTY no 32 | DynamicForward 5000 33 | 34 | Host pi 35 | HostName 192.168.1.104 36 | User pi 37 | 38 | Host pi-ngrok 39 | HostName 0.tcp.ngrok.io 40 | Port 14350 41 | User pi 42 | 43 | Host pi-anywhere 44 | HostName dhruvasagar.com 45 | Port 9022 46 | User pi 47 | 48 | Host usbarmory 49 | HostName 10.0.0.1 50 | User root 51 | 52 | Host kali 53 | HostName 192.168.1.184 54 | User h4x0rdud3 55 | 56 | Host Desktop 57 | HostName 192.168.1.170 58 | User h4x0rdud3 59 | -------------------------------------------------------------------------------- /templates/cpp/file.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | using namespace std; 5 | 6 | void debugVector(vector nums) { 7 | cout << "vector: "; 8 | for (int n : nums) 9 | cout << n << " "; 10 | cout << endl; 11 | } 12 | 13 | void debugMap(map m) { 14 | cout << "map: "; 15 | auto it = m.begin(); 16 | while (it != m.end()) { 17 | cout << it->first << ": " << it->second << ", "; 18 | it++; 19 | } 20 | cout << endl; 21 | } 22 | 23 | void test_case() { 24 | 25 | } 26 | 27 | int main() { 28 | int T; 29 | cin >> T; 30 | for (int i = 1; i <= T; ++i) { 31 | printf("Case #%d: ", i); 32 | test_case(); 33 | } 34 | return 0; 35 | } 36 | -------------------------------------------------------------------------------- /templates/go/file.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "bufio" 5 | "fmt" 6 | "os" 7 | "time" 8 | ) 9 | 10 | func readInput() []string { 11 | lines := []string{} 12 | scanner := bufio.NewScanner(os.Stdin) 13 | for scanner.Scan() { 14 | lines = append(lines, scanner.Text()) 15 | } 16 | return lines 17 | } 18 | 19 | func part1(_lines []string) int { 20 | return 0 21 | } 22 | 23 | func part2(_lines []string) int { 24 | return 0 25 | } 26 | 27 | func main() { 28 | s := time.Now() 29 | lines := readInput() 30 | s1 := time.Now() 31 | fmt.Println(part1(lines)) 32 | e1 := time.Since(s1) 33 | s2 := time.Now() 34 | fmt.Println(part2(lines)) 35 | e2 := time.Since(s2) 36 | e := time.Since(s) 37 | fmt.Printf("Time for part1: %s, part2: %s, total: %s\n", e1, e2, e) 38 | } 39 | -------------------------------------------------------------------------------- /templates/hs/file.hs: -------------------------------------------------------------------------------- 1 | part1 :: [Int] -> Int 2 | part1 = undefined 3 | 4 | part2 :: [Int] -> Int 5 | part2 = undefined 6 | 7 | main :: IO () 8 | main = interact $ unlines . map show . sequence [part1, part2] . map read . lines 9 | -------------------------------------------------------------------------------- /templates/rb/file.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | def part1(lines) = 0 4 | def part2(lines) = 0 5 | def tdiff(s,e) = "#{(e - s) * 1000}ms" 6 | 7 | lines = ARGF.readlines 8 | s = Process.clock_gettime(Process::CLOCK_MONOTONIC) 9 | p part1 lines 10 | e1 = Process.clock_gettime(Process::CLOCK_MONOTONIC) 11 | p part2 lines 12 | e2 = Process.clock_gettime(Process::CLOCK_MONOTONIC) 13 | puts "Time taken part1: #{tdiff(s,e1)}, part2: #{tdiff(e1,e2)}, total: #{tdiff(s,e2)}" 14 | -------------------------------------------------------------------------------- /templates/rust/.gitignore: -------------------------------------------------------------------------------- 1 | target/ 2 | -------------------------------------------------------------------------------- /templates/rust/Cargo.lock: -------------------------------------------------------------------------------- 1 | # This file is automatically @generated by Cargo. 2 | # It is not intended for manual editing. 3 | [[package]] 4 | name = "rust" 5 | version = "0.1.0" 6 | -------------------------------------------------------------------------------- /templates/rust/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "{{name}}" 3 | version = "0.1.0" 4 | authors = ["Dhruva Sagar "] 5 | edition = "2021" 6 | 7 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 8 | 9 | [dependencies] 10 | -------------------------------------------------------------------------------- /templates/rust/src/main.rs: -------------------------------------------------------------------------------- 1 | use std::io; 2 | use std::time::Instant; 3 | 4 | fn read_input() -> Vec { 5 | use std::io::prelude::*; 6 | let stdin = io::stdin(); 7 | stdin.lock().lines().map(|x| x.unwrap()).collect() 8 | } 9 | 10 | fn part1(_lines: Vec) -> String { 11 | return "part1".into(); 12 | } 13 | 14 | fn part2(_lines: Vec) -> String { 15 | return "part2".into(); 16 | } 17 | 18 | fn main() { 19 | let s = Instant::now(); 20 | let lines = read_input(); 21 | let s1 = Instant::now(); 22 | println!("{}", part1(lines.clone())); 23 | let e1 = s1.elapsed(); 24 | let s2 = Instant::now(); 25 | println!("{}", part2(lines.clone())); 26 | let e2 = s2.elapsed(); 27 | let e = s.elapsed(); 28 | println!("Time for part1: {:?}, part2: {:?}, total: {:?}", e1, e2, e); 29 | } 30 | -------------------------------------------------------------------------------- /templates/shared/README.md: -------------------------------------------------------------------------------- 1 | # {{name}} 2 | -------------------------------------------------------------------------------- /templates/shared/input: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dhruvasagar/dotfiles/35ea2424d8be2ee974baeb68a4e4be65bcae1c11/templates/shared/input -------------------------------------------------------------------------------- /templates/shared/tinput: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dhruvasagar/dotfiles/35ea2424d8be2ee974baeb68a4e4be65bcae1c11/templates/shared/tinput -------------------------------------------------------------------------------- /templates/zig/file.zig: -------------------------------------------------------------------------------- 1 | const std = @import("std"); 2 | const time = std.time; 3 | const print = std.debug.print; 4 | 5 | pub fn main() !void { 6 | const s = time.microTimestamp(); 7 | const stdin = std.io.getStdIn().reader(); 8 | while (true) { 9 | var buf: [100]u8 = undefined; 10 | const line = try stdin.readUntilDelimiterOrEof(&buf, '\n'); 11 | if (line == null) break; 12 | } 13 | const e = time.microTimestamp(); 14 | print("Time taken: {s}\n", .{std.fmt.fmtDurationSigned(e - s)}); 15 | } 16 | -------------------------------------------------------------------------------- /vim/.gitignore: -------------------------------------------------------------------------------- 1 | *~ 2 | *swp 3 | *tmp 4 | *tags 5 | .netrwhist 6 | tmp/* 7 | pack/* 8 | undo/* 9 | snips/* 10 | backup/* 11 | bundle/* 12 | session/* 13 | sessions/* 14 | -------------------------------------------------------------------------------- /vim/README.md: -------------------------------------------------------------------------------- 1 | Installation: 2 | 3 | git clone git://github.com/dhruvasagar/dotvim.git ~/.vim 4 | 5 | Create symlinks: 6 | 7 | ln -s ~/.vim/vimrc ~/.vimrc 8 | ln -s ~/.vim/gvimrc ~/.gvimrc 9 | -------------------------------------------------------------------------------- /vim/UltiSnips/jsx.snippets: -------------------------------------------------------------------------------- 1 | extends html 2 | 3 | snippet h5 "XHTML
" w 4 |
$0
5 | endsnippet 6 | 7 | snippet div. "
with className" w! 8 | 9 | $0 10 |
11 | endsnippet 12 | 13 | snippet div# "
with ID & className" w! 14 | 15 | $0 16 |
17 | endsnippet 18 | 19 | snippet span "" w 20 | $0 21 | endsnippet 22 | 23 | snippet span. " with className" w 24 | $0 25 | endsnippet 26 | 27 | snippet . "className" w 28 | className="$0" 29 | endsnippet 30 | # vim:ft=snippets: 31 | -------------------------------------------------------------------------------- /vim/UltiSnips/python.snippets: -------------------------------------------------------------------------------- 1 | snippet code 2 | code.interact(local=dict(globals(), **locals())) 3 | endsnippet 4 | -------------------------------------------------------------------------------- /vim/after/plugin/obsession.vim: -------------------------------------------------------------------------------- 1 | if exists(':Obsession') 2 | silent! packadd vim-prosession 3 | endif 4 | -------------------------------------------------------------------------------- /vim/after/plugin/sandwich.vim: -------------------------------------------------------------------------------- 1 | let g:sandwich#recipes = deepcopy(g:sandwich#default_recipes) 2 | let g:sandwich#recipes += [ 3 | \ {'buns': ["( ", " )"], 'nesting': 1, 'match_syntax': 1, 'input': ['('] }, 4 | \ {'buns': ["[ ", " ]"], 'nesting': 1, 'match_syntax': 1, 'input': ['['] }, 5 | \ {'buns': ["{ ", " }"], 'nesting': 1, 'match_syntax': 1, 'input': ['{'] }, 6 | \ ] 7 | -------------------------------------------------------------------------------- /vim/autocmd.vim: -------------------------------------------------------------------------------- 1 | augroup vimrcEx "{{{1 2 | au! 3 | 4 | " Automatically load .vimrc changes 5 | autocmd BufWritePost $MYVIMRC nested source $MYVIMRC 6 | augroup END 7 | 8 | augroup Plugins "{{{1 9 | au! 10 | 11 | autocmd BufWritePost plugs.vim source % | filetype plugin indent on 12 | " autocmd BufWritePost neo_bundles.vim source % | filetype plugin indent on 13 | augroup END 14 | 15 | augroup EditJump "{{{1 16 | au! 17 | 18 | " When editing a file, always jump to the last known cursor position. 19 | " Don't do it when the position is invalid or when inside an event handler 20 | " (happens when dropping a file on gvim). 21 | autocmd BufReadPost * 22 | \ if line("'\"") > 0 && line("'\"") <= line("$") | 23 | \ exe "normal g`\"" | 24 | \ endif 25 | augroup END 26 | 27 | augroup SetTitleString "{{{1 28 | au! 29 | 30 | autocmd BufEnter * call functions#SetTitleString() 31 | augroup END 32 | 33 | augroup CursorLine "{{{1 34 | au! 35 | 36 | autocmd BufEnter,WinEnter * setl cursorline 37 | autocmd BufLeave,WinLeave * setl nocursorline 38 | augroup END 39 | 40 | let g:LargeFile = 70000 41 | function! LargeFile() 42 | set ft= 43 | endfunction 44 | augroup LargeFiles "{{{1 45 | au! 46 | 47 | autocmd BufRead * let f = getfsize(expand('')) | if f > g:LargeFile || f == -2 | call LargeFile() | endif 48 | augroup END 49 | 50 | augroup Terminal "{{{1 51 | au! 52 | 53 | if has('nvim') 54 | autocmd TermOpen * setl nolist 55 | else 56 | autocmd TerminalOpen * setl nolist 57 | end 58 | augroup END 59 | 60 | augroup CronTab "{{{1 61 | au! 62 | 63 | autocmd BufWritePost ~/dotfiles/crontab !updatecron 64 | augroup END 65 | -------------------------------------------------------------------------------- /vim/autoload/functions.vim: -------------------------------------------------------------------------------- 1 | " Title String for tabs {{{1 2 | function! functions#SetTitleString() 3 | set titlestring=%f\ %m 4 | set titlestring+=\ -\ [%{split(substitute(getcwd(),$HOME,'~',''),'/')[-1]}] 5 | endfunction 6 | 7 | 8 | " Fugitive {{{1 9 | function! functions#GitExecInPath(cmd, ...) "{{{2 10 | if a:0 11 | let path = a:1 12 | elseif exists('b:git_dir') 13 | let path = b:git_dir 14 | let path = fnamemodify(path, ':h') 15 | else 16 | let path = FugitiveExtractGitDir('.') 17 | let path = fnamemodify(path, ':h') 18 | endif 19 | 20 | return system('cd ' . fnameescape(path) . '; ' . a:cmd) 21 | endfunction 22 | 23 | function! functions#TableizeMarkdown() range 24 | let line = a:firstline 25 | while line < a:lastline 26 | " First subheading 27 | if getline(line) =~# '^##' 28 | break 29 | endif 30 | let line += 1 31 | endwhile 32 | 33 | let lines = getline(line, a:lastline) 34 | let columns = [] 35 | let column = [] 36 | for line in lines 37 | if empty(line) | continue | endif 38 | 39 | if !empty(column) && line =~# '^##' " Column Header 40 | call add(columns, column) 41 | let column = [] 42 | endif 43 | 44 | call add(column, line) 45 | endfor 46 | call add(columns, column) " last column 47 | 48 | let rows = [] 49 | for icol in range(len(columns)) 50 | let row = [] 51 | for irow in range(len(columns)) 52 | if irow < len(columns) && icol < len(columns[irow]) 53 | let val = substitute(columns[irow][icol], '^##\|^- ', '', '') 54 | call add(row, val) 55 | else 56 | call add(row, '') 57 | endif 58 | endfor 59 | call add(rows, row) 60 | endfor 61 | 62 | exec ':' . a:firstline . ',' . a:lastline 'delete' 63 | 64 | let lines = map(rows, {_, row -> '|' . join(row, '|') . '|'}) 65 | call insert(lines, '', 1) 66 | call append(a:firstline - 1, lines) 67 | call tablemode#table#AddBorder(a:firstline + 1) 68 | call tablemode#table#Realign(a:firstline) 69 | endfunction 70 | -------------------------------------------------------------------------------- /vim/coc-settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "suggest.autoTrigger": "trigger", 3 | "suggest.minTriggerInputLength": 2, 4 | "solargraph.useBundler": true, 5 | "suggest.enablePreview": true, 6 | "rust-analyzer.procMacro.enable": true, 7 | "rust-analyzer.checkOnSave.extraArgs": [ 8 | "--target-dir", "/tmp/rust-analyzer-check" 9 | ], 10 | "languageserver": { 11 | "haskell": { 12 | "command": "haskell-language-server-wrapper", 13 | "args": ["--lsp"], 14 | "rootPatterns": [ 15 | "*.cabal", 16 | "stack.yaml", 17 | "cabal.project", 18 | "package.yaml" 19 | ], 20 | "filetypes": [ 21 | "hs", 22 | "lhs", 23 | "haskell" 24 | ], 25 | "initializationOptions": { 26 | "languageServerHaskell": { 27 | } 28 | } 29 | }, 30 | "elmLS": { 31 | "command": "elm-language-server", 32 | "filetypes": ["elm"], 33 | "rootPatterns": ["elm.json"] 34 | } 35 | }, 36 | "codeLens.enable": true 37 | } 38 | -------------------------------------------------------------------------------- /vim/commands.vim: -------------------------------------------------------------------------------- 1 | function! s:makeTags() abort 2 | if executable('ctags') 3 | !ctags -R --execlude=.git 4 | elseif executable('ptags') 5 | !ptags 6 | endif 7 | endfunction 8 | 9 | command! MakeTags call s:makeTags() 10 | -------------------------------------------------------------------------------- /vim/ftdetect/tab.vim: -------------------------------------------------------------------------------- 1 | " Guitar Tab 2 | autocmd BufNewFile,BufReadPost *.tab set filetype=tab 3 | -------------------------------------------------------------------------------- /vim/ftplugin/cucumber/custom.vim: -------------------------------------------------------------------------------- 1 | compiler cucumber 2 | setl makeprg=cucumber\ \"%:p\" 3 | -------------------------------------------------------------------------------- /vim/ftplugin/git/custom.vim: -------------------------------------------------------------------------------- 1 | set foldlevel=9 2 | -------------------------------------------------------------------------------- /vim/ftplugin/go/custom.vim: -------------------------------------------------------------------------------- 1 | let g:go_highlight_types = 1 2 | let g:go_highlight_fields = 1 3 | let g:go_doc_popup_window = 1 4 | let g:go_highlight_functions = 1 5 | let g:go_highlight_operators = 1 6 | let g:go_highlight_extra_types = 1 7 | let g:go_highlight_generate_tags = 1 8 | let g:go_highlight_format_strings = 1 9 | let g:go_highlight_function_calls = 1 10 | -------------------------------------------------------------------------------- /vim/ftplugin/haml/custom.vim: -------------------------------------------------------------------------------- 1 | setl foldmethod=indent 2 | -------------------------------------------------------------------------------- /vim/ftplugin/markdown/custom.vim: -------------------------------------------------------------------------------- 1 | setl textwidth=78 2 | let g:markdown_folding = 1 3 | let g:markdown_fenced_languages = [ 4 | \ 'css', 5 | \ 'erb=eruby', 6 | \ 'javascript', 7 | \ 'js=javascript', 8 | \ 'tsx=typescript', 9 | \ 'json=javascript', 10 | \ 'ruby', 11 | \ 'sass', 12 | \ 'xml', 13 | \ 'html', 14 | \ 'zsh', 15 | \ 'bash', 16 | \ 'sh', 17 | \ 'sql', 18 | \ 'go', 19 | \ 'vim', 20 | \ 'testify', 21 | \ 'python', 22 | \ ] 23 | -------------------------------------------------------------------------------- /vim/ftplugin/ruby/custom.vim: -------------------------------------------------------------------------------- 1 | setl foldmethod=indent 2 | 3 | command! MakeTags !ctags -R --languages=ruby --exclude=.git --exclude=log . $(bundle list --paths) 4 | -------------------------------------------------------------------------------- /vim/ftplugin/sshconfig/custom.vim: -------------------------------------------------------------------------------- 1 | set foldmethod=marker 2 | -------------------------------------------------------------------------------- /vim/ftplugin/vim/custom.vim: -------------------------------------------------------------------------------- 1 | let g:vimsyn_folding = 'af' 2 | setl foldmethod=syntax 3 | -------------------------------------------------------------------------------- /vim/ftplugin/vimwiki/custom.vim: -------------------------------------------------------------------------------- 1 | setl nowrap 2 | setl concealcursor=nc 3 | -------------------------------------------------------------------------------- /vim/ftplugin/xml/custom.vim: -------------------------------------------------------------------------------- 1 | setl foldmethod=indent 2 | setl equalprg=xmllint\ --format\ --recover\ - 3 | -------------------------------------------------------------------------------- /vim/ftplugin/yaml/custom.vim: -------------------------------------------------------------------------------- 1 | setl foldmethod=indent 2 | -------------------------------------------------------------------------------- /vim/gvimrc: -------------------------------------------------------------------------------- 1 | " Removing all gui components like Menu, Toolbar, Scrollbars 2 | set guioptions-=m 3 | set guioptions-=T 4 | set guioptions-=r 5 | set guioptions-=L 6 | 7 | set guifont=FiraCode\ Nerd\ Font\ 11 8 | 9 | set guitablabel=%t%m 10 | -------------------------------------------------------------------------------- /vim/init.vim: -------------------------------------------------------------------------------- 1 | let g:vim_home = expand('~/.config/nvim/') 2 | 3 | execute 'source' g:vim_home.'/vimrc' 4 | -------------------------------------------------------------------------------- /vim/mappings.vim: -------------------------------------------------------------------------------- 1 | " List of available normal mode mappings for future use : 2 | " 3 | " * cq, cu, cd, cm, c, c<, c>, c. 4 | " 5 | " * dq, dr, dy, du, dx, dc, dm, d<, d>, d. 6 | " 7 | " * gy, gz 8 | " 9 | " * yq, yr, yu, yx, yc, ym 10 | " 11 | " * zq, zy, zp 12 | 13 | " Use repeat operator with visual selection {{{1 14 | xnoremap . :normal! . 15 | 16 | " To make Y inline with other capitals {{{1 17 | nnoremap Y y$ 18 | 19 | " Q to :q a window {{{1 20 | " nmap Q empty(maparg('q', 'n')) ? ':q' : 'q' 21 | nnoremap Q :echo "Use :q instead" 22 | 23 | " Dispatch {{{1 24 | nnoremap d :Dispatch 25 | 26 | " Gundo {{{1 27 | " nnoremap U :GundoToggle 28 | nnoremap U :MundoToggle 29 | 30 | " Tabular {{{1 31 | nnoremap z/ ':Tabular/'.nr2char(getchar()).'' 32 | xnoremap z/ ':Tabular/'.nr2char(getchar()).'' 33 | nnoremap z// :Tabular/ 34 | xnoremap z// :Tabular/ 35 | 36 | " Use ` when ' {{{1 37 | nnoremap ' ` 38 | 39 | " Test {{{1 40 | nnoremap cl :TestLast 41 | nnoremap cf :TestFile 42 | nnoremap ca :TestSuite 43 | nnoremap cc :TestNearest 44 | 45 | " Remap Esc in terminal for NeoVim 46 | if exists(':tnoremap') 47 | tnoremap 48 | endif 49 | 50 | nnoremap g< vap:Twrite bottom-left 51 | xnoremap g< :Twrite bottom-left 52 | nnoremap g> vap:Twrite bottom-right 53 | xnoremap g> :Twrite bottom-right 54 | 55 | nnoremap <, :SidewaysLeft 56 | nnoremap >, :SidewaysRight 57 | 58 | nnoremap go :Goyo 59 | 60 | cnoremap 61 | 62 | nnoremap :FzfFiles 63 | nnoremap :FzfRg 64 | 65 | nnoremap c- :.!toilet -w 200 -f small 66 | nnoremap c+ :.!toilet -w 200 -f standard 67 | nnoremap cb :.!toilet -w 200 -f term -F border 68 | -------------------------------------------------------------------------------- /vim/plugin/browse.vim: -------------------------------------------------------------------------------- 1 | function! s:Browse(bang) range 2 | if exists('b:git_dir') 3 | let path = b:git_dir 4 | else 5 | let path = fugitive#extract_git_dir(expand('%:p')) 6 | endif 7 | 8 | " Get working directory name 9 | if empty(path) 10 | let path = expand('%:p:h') 11 | else 12 | let path = fnamemodify(path, ':h:t') 13 | endif 14 | 15 | " Get path relative to working directory 16 | let path = fnamemodify(expand('%:p'), ':s?.*' . path . '/??') 17 | 18 | let name_with_lnum = path . ':' 19 | if a:lastline == a:firstline 20 | let name_with_lnum .= a:firstline 21 | else 22 | let name_with_lnum .= a:firstline . '-' . a:lastline 23 | endif 24 | 25 | if a:bang 26 | let @+ = name_with_lnum 27 | echomsg @+ . ' Copied to clipboard' 28 | else 29 | echomsg name_with_lnum 30 | end 31 | endfunction 32 | 33 | command! -bang -range Browse ,call s:Browse(0) 34 | -------------------------------------------------------------------------------- /vim/plugin/bufdo.vim: -------------------------------------------------------------------------------- 1 | function! s:BufDo(command) 2 | let curbuff = bufnr('%') 3 | execute 'bufdo' a:command 4 | execute 'buffer' curbuff 5 | endfunction 6 | 7 | command! -bar -nargs=+ -complete=command Bufdo call s:BufDo() 8 | -------------------------------------------------------------------------------- /vim/plugin/cdpath.vim: -------------------------------------------------------------------------------- 1 | function! s:CdComplete(ArgLead, CmdLine, CursorPos) 2 | let pattern = empty(a:ArgLead) ? '*/' : '*' . a:ArgLead . '*/' 3 | return map(globpath(&cdpath, pattern, 1, 1), 'fnamemodify(v:val, ":h:t")') 4 | endfunction 5 | 6 | command! -bar -nargs=1 -complete=customlist,s:CdComplete Cd cd 7 | command! -bar -nargs=1 -complete=customlist,s:CdComplete Lcd lcd 8 | -------------------------------------------------------------------------------- /vim/plugin/codejam.vim: -------------------------------------------------------------------------------- 1 | if exists('g:loaded_codejam') 2 | finish 3 | endif 4 | let g:loaded_codejam = 1 5 | 6 | let g:codejam_template = { 7 | \ 'ruby': [ 8 | \ '#!/usr/bin/env ruby', 9 | \ '', 10 | \ 'def log(msg, i)', 11 | \ ' puts "Case ##{i+1}: #{msg}"', 12 | \ 'end', 13 | \ '' 14 | \ ], 15 | \ 'go': [ 16 | \ 'package main', 17 | \ '', 18 | \ 'import "fmt"', 19 | \ '', 20 | \ 'func main() {', 21 | \ '', 22 | \ '}' 23 | \ ] 24 | \} 25 | 26 | function! s:CodejamTemplate(...) 27 | let b:codejam_ft = a:0 && !empty(a:1) ? a:1 : 'ruby' 28 | exec 'setf' b:codejam_ft 29 | new 30 | call setline(1, get(g:codejam_template, b:codejam_ft, '')) 31 | normal! G 32 | endfunction 33 | 34 | command! -nargs=? CJNew call s:CodejamTemplate() 35 | -------------------------------------------------------------------------------- /vim/plugin/dash.vim: -------------------------------------------------------------------------------- 1 | if exists('g:loaded_dash') 2 | finish 3 | endif 4 | let g:loaded_dash = 1 5 | 6 | function! s:Dash(search) 7 | exec 'silent !open "dash://' . join(split(a:search), ':') . '"' 8 | redraw! 9 | endfunction 10 | 11 | command! -bar -nargs=+ Dash call s:Dash() 12 | nnoremap dx :Dash =&filetype 13 | -------------------------------------------------------------------------------- /vim/plugin/dotedit.vim: -------------------------------------------------------------------------------- 1 | function! s:DotComplete(ArgLead, CmdLine, CursorPos) abort 2 | let paths = globpath(expand('~/dotfiles'), '**/'.a:ArgLead.'*', 1, 1) 3 | for ppath in ['packup', 'backup'] 4 | let paths = filter(paths, 'v:val !~# "'.ppath.'"') 5 | endfor 6 | return paths 7 | endfunction 8 | 9 | function! s:DotEdit(cmd, fname) abort 10 | exec a:cmd a:fname 11 | endfunction 12 | 13 | command! -bar -nargs=1 -complete=customlist,s:DotComplete Dedit call s:DotEdit('edit', ) 14 | command! -bar -nargs=1 -complete=customlist,s:DotComplete Dsplit call s:DotEdit('split', ) 15 | command! -bar -nargs=1 -complete=customlist,s:DotComplete Dvsplit call s:DotEdit('vsplit', ) 16 | command! -bar -nargs=1 -complete=customlist,s:DotComplete Dtabedit call s:DotEdit('tabedit', ) 17 | -------------------------------------------------------------------------------- /vim/plugin/edit.vim: -------------------------------------------------------------------------------- 1 | function! s:Edit(cmd, fname) 2 | let fname_lnum = split(a:fname, ':') 3 | if len(fname_lnum) == 1 4 | exe a:cmd fname_lnum[0] 5 | else 6 | exe a:cmd '+'.fname_lnum[1] fname_lnum[0] 7 | endif 8 | endfunction 9 | 10 | command! -nargs=1 -complete=file Edit call s:Edit('edit', ) 11 | command! -nargs=1 -complete=file Esplit call s:Edit('split', ) 12 | command! -nargs=1 -complete=file Evsplit call s:Edit('vsplit', ) 13 | command! -nargs=1 -complete=file Etabedit call s:Edit('tabe', ) 14 | -------------------------------------------------------------------------------- /vim/plugin/encrypt.vim: -------------------------------------------------------------------------------- 1 | if exists('g:loaded_encrypt') 2 | finish 3 | endif 4 | let g:loaded_encrypt = 1 5 | 6 | if !exists('g:encrypt_credentials_file') 7 | let g:encrypt_credentials_file = expand('~/Dropbox/Documents/encryption-keys.txt') 8 | endif 9 | 10 | function! s:BackupCreds(pass) abort 11 | let fname = expand('%:p') 12 | let credline = printf("%s : %s", fname, a:pass) 13 | exec 'split' g:encrypt_credentials_file 14 | " Delete the line if it already exists 15 | exec 'global#^'.fnameescape(fname).'#d' 16 | call append(line('$'), credline) 17 | write 18 | quit 19 | endfunction 20 | 21 | function s:Encrypt() abort 22 | set cryptmethod=blowfish2 23 | let pass = inputsecret("Enter password: ") 24 | exec 'set key='.pass 25 | write 26 | call s:BackupCreds(pass) 27 | endfunction 28 | 29 | command! Encrypt call s:Encrypt() 30 | -------------------------------------------------------------------------------- /vim/plugin/extract.vim: -------------------------------------------------------------------------------- 1 | function! s:Extract(bang,cmd,fname) range abort 2 | let extn = expand('%:e') 3 | if empty(extn) 4 | let l:fname = a:fname 5 | else 6 | let l:fname = a:fname . '.' . extn 7 | endif 8 | let [first, last] = [a:firstline, a:lastline] 9 | let range = first.",".last 10 | let spaces = matchstr(getline(first),"^ *") 11 | let buf = @@ 12 | silent exe range."yank" 13 | let partial = @@ 14 | let @@ = buf 15 | let old_ai = &ai 16 | try 17 | let &ai = 0 18 | silent exe "norm! :".range."change\".spaces.a:fname."\.\" 19 | finally 20 | let &ai = old_ai 21 | endtry 22 | execute a:cmd . ' ' . expand('%:p:h') . '/' . l:fname 23 | let @@ = partial 24 | silent put 25 | 0delete 26 | let @@ = buf 27 | if !empty(spaces) 28 | silent! exe '%substitute/^' . spaces . '//' 29 | endif 30 | endfunction 31 | 32 | command! -bar -nargs=1 -range SExtract :,call s:Extract(0,"split",) 33 | command! -bar -nargs=1 -range VExtract :,call s:Extract(0,"vsplit",) 34 | command! -bar -nargs=1 -range TExtract :,call s:Extract(0,"tabnew",) 35 | -------------------------------------------------------------------------------- /vim/plugin/fugitive_extra.vim: -------------------------------------------------------------------------------- 1 | function! s:close_gstatus() 2 | for l:winnr in range(1, winnr('$')) 3 | if !empty(getwinvar(l:winnr, 'fugitive_status')) 4 | execute l:winnr.'close' 5 | endif 6 | endfor 7 | endfunction 8 | command! GstatusClose call s:close_gstatus() 9 | 10 | " Commands & Mappings {{{1 11 | command! -bar -nargs=* Gpurr Git pull --rebase 12 | command! -bar Gpnp Git pull | Git push 13 | command! -bar Gprp Gpurr | Git push 14 | command! -bar Gush Git push origin head 15 | 16 | nnoremap gsl :Glog 17 | nnoremap gsd :Gdiff 18 | nnoremap gse :Gedit 19 | nnoremap gsb :Git blame 20 | nnoremap gsw :Gwrite 21 | nnoremap gsC :Git commit 22 | nnoremap gst :Git 23 | nnoremap gsq :GstatusClose 24 | nnoremap gscd :Gcdpwd 25 | nnoremap gsld :Glcdpwd 26 | nnoremap gsps :Git push 27 | nnoremap gspl :Git pull 28 | -------------------------------------------------------------------------------- /vim/plugin/hard_ass.vim: -------------------------------------------------------------------------------- 1 | let s:hard_ass = 1 2 | 3 | function! s:ToggleHardAss() abort 4 | if s:hard_ass 5 | map 6 | map 7 | map 8 | map 9 | 10 | imap 11 | imap 12 | imap 13 | imap 14 | else 15 | unmap 16 | unmap 17 | unmap 18 | unmap 19 | 20 | iunmap 21 | iunmap 22 | iunmap 23 | iunmap 24 | 25 | let s:hard_ass = 0 26 | endif 27 | endfunction 28 | 29 | call s:ToggleHardAss() 30 | nnoremap h :call ToggleHardAss() 31 | -------------------------------------------------------------------------------- /vim/plugin/includeexpr.vim: -------------------------------------------------------------------------------- 1 | function! IncludeExpr() 2 | if v:fname =~? '^this\.' 3 | return substitute(v:fname, '^this\.', '', 'g') 4 | endif 5 | if !exists('g:Abolish') || empty(g:Abolish) | return | endif 6 | return findfile(g:Abolish.snakecase(v:fname)) 7 | endfunction 8 | set includeexpr=IncludeExpr() 9 | -------------------------------------------------------------------------------- /vim/plugin/neatfoldtext.vim: -------------------------------------------------------------------------------- 1 | function! NeatFoldText() "{{{1 2 | let line = ' ' . substitute(getline(v:foldstart), '^\s*"\?\s*\|\s*"\?\s*{{' . '{\d*\s*', '', 'g') . ' ' 3 | let lines_count = v:foldend - v:foldstart + 1 4 | let lines_count_text = '| ' . printf("%10s", lines_count . ' lines') . ' |' 5 | let foldchar = matchstr(&fillchars, 'fold:\zs.') 6 | let foldtextstart = strpart('+' . repeat(foldchar, v:foldlevel*2) . line, 0, (winwidth(0)*2)/3) 7 | let foldtextend = lines_count_text . repeat(foldchar, 8) 8 | let foldtextlength = strlen(substitute(foldtextstart . foldtextend, '.', 'x', 'g')) + &foldcolumn 9 | return foldtextstart . repeat(foldchar, winwidth(0)-foldtextlength) . foldtextend 10 | endfunction 11 | set foldtext=NeatFoldText() 12 | -------------------------------------------------------------------------------- /vim/plugin/scratch.vim: -------------------------------------------------------------------------------- 1 | if exists('g:loaded_scratch') 2 | finish 3 | endif 4 | let g:loaded_scratch = 1 5 | 6 | function! s:ScratchEdit(cmd, options) 7 | exe a:cmd tempname() 8 | setl buftype=nofile bufhidden=wipe nobuflisted 9 | if !empty(a:options) | exe 'setl' a:options | endif 10 | endfunction 11 | 12 | let s:filetype_extensions = { 13 | \ 'ruby': 'rb', 14 | \ 'python': 'py', 15 | \ 'javascript': 'js', 16 | \} 17 | 18 | function! s:ScratchFile(cmd, ft) 19 | let extn = get(s:filetype_extensions, a:ft, a:ft) 20 | exec a:cmd 'scratch.'.extn 21 | endfunction 22 | 23 | command! -bar -nargs=* Sedit call s:ScratchEdit('edit', ) 24 | command! -bar -nargs=* Ssplit call s:ScratchEdit('split', ) 25 | command! -bar -nargs=* Svsplit call s:ScratchEdit('vsplit', ) 26 | command! -bar -nargs=* Stabedit call s:ScratchEdit('tabe', ) 27 | 28 | command! -bar -nargs=1 -complete=filetype Sfedit call s:ScratchFile('edit', ) 29 | command! -bar -nargs=1 -complete=filetype Sfsplit call s:ScratchFile('split', ) 30 | command! -bar -nargs=1 -complete=filetype Sfvsplit call s:ScratchFile('vsplit', ) 31 | command! -bar -nargs=1 -complete=filetype Sftabedit call s:ScratchFile('tabe', ) 32 | -------------------------------------------------------------------------------- /vim/plugin/search.vim: -------------------------------------------------------------------------------- 1 | function! s:Vword() 2 | return getline('.')[col("'<")-1:col("'>")-1] 3 | endfunction 4 | 5 | function! s:search(type, ...) 6 | let sel_save = &selection 7 | let &selection = 'inclusive' 8 | let reg_save = @@ 9 | 10 | if a:0 11 | silent exe 'normal! gvy' 12 | elseif a:type == 'line' 13 | silent exe "normal! '[V']y" 14 | else 15 | silent exe "normal! `[v`]y" 16 | endif 17 | 18 | silent! exec ":grep '" . @@ . "'" getcwd() 19 | redraw! 20 | echo ":grep '" . @@ . "'" getcwd() 21 | 22 | let &selection = sel_save 23 | let @@ = reg_save 24 | endfunction 25 | 26 | nnoremap g/ :set opfunc=searchg@ 27 | xnoremap g/ :call search(visualmode(), 1) 28 | 29 | xnoremap * /\v<=Vword()> 30 | xnoremap g* /\v=Vword() 31 | 32 | xnoremap # o?\v<=Vword()> 33 | xnoremap g# o?\v=Vword() 34 | -------------------------------------------------------------------------------- /vim/plugin/statusline.vim: -------------------------------------------------------------------------------- 1 | function! s:StatusLineClearVars() 2 | unlet! b:statusline_git_flag 3 | unlet! b:statusline_file_name 4 | unlet! b:statusline_pwd_git_flag 5 | if exists('b:statusline_pwd') && fnamemodify(getcwd(), ':t') !=# b:statusline_pwd 6 | unlet b:statusline_pwd 7 | endif 8 | endfunction 9 | 10 | function! StatusLinePWD() 11 | if !exists('b:statusline_pwd') 12 | let b:statusline_pwd = fnamemodify(getcwd(), ':t') 13 | endif 14 | return b:statusline_pwd 15 | endfunction 16 | 17 | function! StatusLineGitFlag() 18 | if !exists('b:statusline_git_flag') 19 | if !file_readable(expand('%')) 20 | let b:statusline_git_flag = '' 21 | else 22 | let b:statusline_git_flag = functions#GitExecInPath('git status --porcelain ' . expand('%') . " 2>/dev/null | awk '{print $1}'")[:-2] 23 | endif 24 | endif 25 | return b:statusline_git_flag 26 | endfunction 27 | 28 | function! StatusLinePWDGitFlag() 29 | if !exists('b:statusline_pwd_git_flag') 30 | let b:statusline_pwd_git_flag = functions#GitExecInPath("git status --porcelain 2>/dev/null | head -1 | awk '{print $1}'", getcwd())[:-2] 31 | if !empty(b:statusline_pwd_git_flag) 32 | let b:statusline_pwd_git_flag .= ' ' 33 | endif 34 | endif 35 | return b:statusline_pwd_git_flag 36 | endfunction 37 | 38 | function! StatusLineFileName() 39 | let pre = '' 40 | let pat = '://' 41 | let name = expand('%:~:.') 42 | if name =~# pat 43 | let pre = name[:stridx(name, pat) + len(pat)-1] . '...' 44 | let name = name[stridx(name, pat) + len(pat):] 45 | elseif empty(name) && &filetype ==# 'netrw' 46 | let name = fnamemodify(b:netrw_curdir, ':~:.') 47 | endif 48 | let name = simplify(name) 49 | let ratio = winwidth(0) / len(name) 50 | if ratio <= 2 && ratio > 1 51 | let name = pathshorten(name) 52 | elseif ratio <= 1 53 | let name = fnamemodify(name, ':t') 54 | endif 55 | return pre . name 56 | endfunction 57 | 58 | augroup StatusLine 59 | au! 60 | 61 | autocmd WinEnter,CursorHold * call StatusLineClearVars() 62 | augroup END 63 | 64 | function! StatusLineALE() abort 65 | if !exists(':ALE*') 66 | return '' 67 | endif 68 | let l:s = [] 69 | let ale = ale#statusline#Count(bufnr('%')) 70 | if ale['error'] > 0 71 | call add(l:s, 'E: ' . ale['error']) 72 | endif 73 | if ale['warning'] > 0 74 | call add(l:s, 'W: ' . ale['warning']) 75 | endif 76 | if ale['total'] > 0 77 | call add(l:s, 'T: ' . ale['total']) 78 | endif 79 | if !empty(l:s) 80 | return '[ALE '.join(l:s, ',').']' 81 | endif 82 | return '' 83 | endfunction 84 | 85 | set statusline=%(\ %5*%{zoom#statusline()}%*\ \|%) 86 | set statusline+=%(\ %{fugitive#Head()}\ \|%) 87 | set statusline+=%(\ %{StatusLinePWD()}\ \|\ %) 88 | set statusline+=%(%r%m\ %) 89 | 90 | set statusline+=%2*%(%{StatusLineALE()}\ %)%* 91 | set statusline+=%1*%{StatusLineFileName()}\ %* 92 | 93 | set statusline+=%4*%(%{dotoo#clock#summary()}\ %)%* 94 | set statusline+=%<%= 95 | set statusline+=%(%{&filetype}\ \|\ %) 96 | set statusline+=%(%3p%%\ \|\ %) 97 | set statusline+=%3l(%L):%-3c 98 | -------------------------------------------------------------------------------- /vim/plugin/sync_dotoo_files.vim: -------------------------------------------------------------------------------- 1 | function! s:SyncFiles() 2 | :!~/dotfiles/bin/rsync_dotoo_files 3 | endfunction 4 | 5 | command! SyncDotooFiles call s:SyncFiles() 6 | -------------------------------------------------------------------------------- /vim/plugin/tabline.vim: -------------------------------------------------------------------------------- 1 | " Based on : http://www.offensivethinking.org/data/dotfiles/vimrc 2 | function! MyTabLine() 3 | let s = '' 4 | for i in range(tabpagenr('$')) 5 | let tabnr = i + 1 " range() starts at 0 6 | let winnr = tabpagewinnr(tabnr) 7 | let buflist = tabpagebuflist(tabnr) 8 | let bufnr = buflist[winnr - 1] 9 | let bufname = fnamemodify(bufname(bufnr), ':t') 10 | 11 | let s .= '%' . tabnr . 'T' 12 | let s .= (tabnr == tabpagenr() ? '%#TabLineSel#' : '%#TabLine#') 13 | let s .= ' ' . tabnr 14 | 15 | let n = tabpagewinnr(tabnr,'$') 16 | if n > 1 | let s .= ':' . n | endif 17 | 18 | let s .= empty(bufname) ? ' [No Name] ' : ' ' . bufname . ' ' 19 | 20 | let bufmodified = getbufvar(bufnr, "&mod") 21 | if bufmodified | let s .= '+ ' | endif 22 | endfor 23 | let s .= '%#TabLineFill#' 24 | return s 25 | endfunction 26 | set tabline=%!MyTabLine() 27 | -------------------------------------------------------------------------------- /vim/plugin/underheadline.vim: -------------------------------------------------------------------------------- 1 | let g:underheadline_char = '-' 2 | 3 | function! s:UnderHeadline() 4 | let cur = [line('.'), col('.')] 5 | exec 'normal! yypwv$r' . g:underheadline_char 6 | call cursor(cur) 7 | endfunction 8 | 9 | command! UnderHeadline call s:UnderHeadline() 10 | nnoremap uh :UnderHeadline 11 | -------------------------------------------------------------------------------- /vim/plugin/view.vim: -------------------------------------------------------------------------------- 1 | function! s:View(cmd) 2 | redir => output 3 | silent execute a:cmd 4 | redir END 5 | Ssplit " depends on Scratch.vim 6 | call setline(1, split(output, '\n')) 7 | endfunction 8 | 9 | command! -bar -nargs=1 -complete=command View call s:View() 10 | -------------------------------------------------------------------------------- /vim/plugin/vinegar.vim: -------------------------------------------------------------------------------- 1 | if exists('g:loaded_vinegar') 2 | finish 3 | endif 4 | let g:loaded_vinegar = 1 5 | 6 | function! s:vinegar() 7 | let fname = expand('%:t') 8 | edit %:p:h 9 | normal! gg 10 | call search('\<'.fname.'\>') 11 | endfunction 12 | nnoremap - :call vinegar() 13 | -------------------------------------------------------------------------------- /vim/plugin_settings/ale.vim: -------------------------------------------------------------------------------- 1 | let g:ale_lint_on_text_changed = 'never' 2 | let g:ale_lint_on_insert_leave = 0 3 | let g:ale_lint_on_enter = 0 4 | 5 | let g:ale_echo_msg_error_str = 'E' 6 | let g:ale_echo_msg_warning_str = 'W' 7 | let g:ale_echo_msg_format = '[%linter%] %s [%severity%]' 8 | let g:ale_fix_on_save = 1 9 | 10 | let g:ale_fixers = { 11 | \ 'haskell': ['hindent'], 12 | \ 'rust': ['rustfmt'], 13 | \ 'typescript': ['prettier'], 14 | \ 'typescriptreact': ['prettier'], 15 | \} 16 | -------------------------------------------------------------------------------- /vim/plugin_settings/bundler.vim: -------------------------------------------------------------------------------- 1 | augroup Bundler 2 | au! 3 | 4 | autocmd User Bundler if &makeprg !~# 'bundle' | setl makeprg^=bundle\ exec\ | endif 5 | augroup END 6 | -------------------------------------------------------------------------------- /vim/plugin_settings/coc.vim: -------------------------------------------------------------------------------- 1 | " Use `[g` and `]g` to navigate diagnostics 2 | nmap [g (coc-diagnostic-prev) 3 | nmap ]g (coc-diagnostic-next) 4 | 5 | " GoTo code navigation. 6 | nmap gd (coc-definition) 7 | nmap gy (coc-type-definition) 8 | nmap gi (coc-implementation) 9 | nmap gr (coc-references) 10 | 11 | function! s:show_documentation() abort 12 | if !CocAction('doHover') 13 | normal! K 14 | endif 15 | endfunction 16 | 17 | " Use K to show documentation in preview window. 18 | nnoremap K :call show_documentation() 19 | 20 | " Introduce function text object 21 | " NOTE: Requires 'textDocument.documentSymbol' support from the language server. 22 | xmap if (coc-funcobj-i) 23 | xmap af (coc-funcobj-a) 24 | omap if (coc-funcobj-i) 25 | omap af (coc-funcobj-a) 26 | 27 | let g:coc_global_extensions = [ 28 | \ 'coc-sh', 29 | \ 'coc-css', 30 | \ 'coc-sql', 31 | \ 'coc-java', 32 | \ 'coc-json', 33 | \ 'coc-yaml', 34 | \ 'coc-vimlsp', 35 | \ 'coc-graphql', 36 | \ 'coc-swagger', 37 | \ 'coc-tsserver', 38 | \ 'coc-solargraph', 39 | \ 'coc-rust-analyzer', 40 | \ ] 41 | -------------------------------------------------------------------------------- /vim/plugin_settings/ctrlp.vim: -------------------------------------------------------------------------------- 1 | let g:ctrlp_cache_dir = $HOME . '/.cache/ctrlp' 2 | let g:ctrlp_extensions = ['tag', 'buffertag'] 3 | let g:ctrlp_show_hidden = 1 4 | let g:ctrlp_custom_ignore = 'node_modules' 5 | 6 | if executable('ag') 7 | let g:ctrlp_user_command = 'ag %s -l --nocolor -g ""' 8 | elseif executable('rg') 9 | let g:ctrlp_user_command = 'rg %s --files --color=never --glob ""' 10 | else 11 | let g:ctrlp_user_command = ['.git', 12 | \ 'cd %s && git ls-files . -co --exclude-standard', 13 | \ 'find %s -type f' ] 14 | endif 15 | -------------------------------------------------------------------------------- /vim/plugin_settings/dotoo.vim: -------------------------------------------------------------------------------- 1 | let g:dotoo#agenda#files=['~/Dropbox/Documents/dotoo-files/**/*.dotoo'] 2 | let g:dotoo#capture#refile=expand('~/Dropbox/Documents/dotoo-files/refile.dotoo') 3 | let g:dotoo_begin_src_languages=['sh', 'vim', 'json', 'javascript', 'ruby', 'ledger', 'go', 'typescript'] 4 | 5 | nnoremap ww :edit ~/Dropbox/Documents/dotoo-files/notes.dotoo 6 | -------------------------------------------------------------------------------- /vim/plugin_settings/flog.vim: -------------------------------------------------------------------------------- 1 | augroup myfloggroup 2 | autocmd FileType floggraph nmap q FlogQuit 3 | augroup END 4 | -------------------------------------------------------------------------------- /vim/plugin_settings/fzf.vim: -------------------------------------------------------------------------------- 1 | let g:fzf_command_prefix = 'Fzf' 2 | let g:fzf_preview_window='right:60%' 3 | let g:fzf_layout = { 'window': { 'width': 0.9, 'height': 0.6 } } 4 | -------------------------------------------------------------------------------- /vim/plugin_settings/gist.vim: -------------------------------------------------------------------------------- 1 | let g:gist_show_privates = 0 2 | let g:gist_detect_filetype = 1 3 | let g:gist_open_browser_after_post = 1 4 | -------------------------------------------------------------------------------- /vim/plugin_settings/gitv.vim: -------------------------------------------------------------------------------- 1 | let g:Gitv_WipeAllOnClose = 1 2 | let g:Gitv_DoNotMapCtrlKey = 1 3 | let g:Gitv_OpenPreviewOnLaunch = 1 4 | let g:Gitv_TruncateCommitSubjects = 1 5 | -------------------------------------------------------------------------------- /vim/plugin_settings/go.vim: -------------------------------------------------------------------------------- 1 | let g:go_template_autocreate = 0 2 | -------------------------------------------------------------------------------- /vim/plugin_settings/hexokinase.vim: -------------------------------------------------------------------------------- 1 | let g:Hexokinase_highlighters = [ 'backgroundfull' ] 2 | let g:Hexokinase_optOutPatterns = [ 'colour_names' ] 3 | -------------------------------------------------------------------------------- /vim/plugin_settings/indentLine.vim: -------------------------------------------------------------------------------- 1 | let g:indentLine_char = '|' 2 | -------------------------------------------------------------------------------- /vim/plugin_settings/indentguides.vim: -------------------------------------------------------------------------------- 1 | let g:indent_guides_guide_size=1 2 | -------------------------------------------------------------------------------- /vim/plugin_settings/javascript.vim: -------------------------------------------------------------------------------- 1 | let g:javascript_conceal = 1 2 | let g:javascript_plugin_flow = 1 3 | let g:javascript_plugin_jsdoc = 1 4 | let g:javascript_enable_domhtmlcss = 1 5 | 6 | let g:javascript_conceal_function = "ƒ" 7 | let g:javascript_conceal_null = "ø" 8 | let g:javascript_conceal_this = "@" 9 | let g:javascript_conceal_return = "⇚" 10 | let g:javascript_conceal_undefined = "¿" 11 | let g:javascript_conceal_NaN = "ℕ" 12 | let g:javascript_conceal_prototype = "¶" 13 | let g:javascript_conceal_static = "•" 14 | let g:javascript_conceal_super = "Ω" 15 | let g:javascript_conceal_arrow_function = "⇒" 16 | -------------------------------------------------------------------------------- /vim/plugin_settings/jekyll.vim: -------------------------------------------------------------------------------- 1 | let g:jekyll_path = "~/src/dhruvasagar.com" 2 | 3 | nnoremap jb :JekyllBuild 4 | nnoremap jn :JekyllPost 5 | nnoremap jl :JekyllList 6 | -------------------------------------------------------------------------------- /vim/plugin_settings/jsx.vim: -------------------------------------------------------------------------------- 1 | let g:jsx_ext_required = 0 2 | -------------------------------------------------------------------------------- /vim/plugin_settings/langclient.vim: -------------------------------------------------------------------------------- 1 | " let g:LanguageClient_serverCommands = { 2 | " \ 'rust': ['rustup', 'run', 'nightly', 'rls'], 3 | " \ 'javascript': ['javascript-typescript-stdio'], 4 | " \ 'javascript.jsx': ['javascript-typescript-stdio'], 5 | " \ 'typescript': ['javascript-typescript-stdio'], 6 | " \ } 7 | " let g:LanguageClient_diagnosticsList = "Disabled" 8 | 9 | " function! LC_maps() 10 | " if has_key(g:LanguageClient_serverCommands, &filetype) 11 | " nnoremap K :call LanguageClient#textDocument_hover() 12 | " nnoremap :call LanguageClient#textDocument_definition() 13 | " nnoremap :call LanguageClient#textDocument_rename() 14 | " endif 15 | " endfunction 16 | 17 | " augroup LanguageClient 18 | " au! 19 | 20 | " autocmd FileType * call LC_maps() 21 | " augroup END 22 | -------------------------------------------------------------------------------- /vim/plugin_settings/netrw.vim: -------------------------------------------------------------------------------- 1 | let g:netrw_banner=0 2 | 3 | -------------------------------------------------------------------------------- /vim/plugin_settings/nuake.vim: -------------------------------------------------------------------------------- 1 | nnoremap :Nuake 2 | inoremap :Nuake 3 | tnoremap :Nuake 4 | -------------------------------------------------------------------------------- /vim/plugin_settings/prosession.vim: -------------------------------------------------------------------------------- 1 | let g:prosession_tmux_title = 1 2 | -------------------------------------------------------------------------------- /vim/plugin_settings/quickrun.vim: -------------------------------------------------------------------------------- 1 | let g:quickrun_config = {} 2 | let g:quickrun_config.clojure = { 3 | \ 'command': 'clojure' 4 | \ } 5 | let g:quickrun_config.javascript = { 6 | \ 'command': 'node', 7 | \ } 8 | -------------------------------------------------------------------------------- /vim/plugin_settings/rails.vim: -------------------------------------------------------------------------------- 1 | let g:rails_gem_projections = { 2 | \ "carrierwave": { 3 | \ "app/uploaders/*_uploader.rb": { 4 | \ "command": "uploader", 5 | \ "template": "class %SUploader < CarrierWave::Uploader::Base\nend", 6 | \ "test": [ 7 | \ "spec/uploaders/%s_uploader_spec.rb" 8 | \ ] 9 | \ }}, 10 | \ "resque": { 11 | \ "app/jobs/*_job.rb": { 12 | \ "command": "job", 13 | \ "template": "class %SJob\n@queue = ''\nend", 14 | \ "test": [ 15 | \ "spec/jobs/%s_job_spec.rb" 16 | \ ] 17 | \ }} 18 | \ } 19 | -------------------------------------------------------------------------------- /vim/plugin_settings/ruby.vim: -------------------------------------------------------------------------------- 1 | let g:rubycomplete_rails = 1 2 | let g:rubycomplete_buffer_loading = 1 3 | let g:rubycomplete_classes_in_global = 1 4 | -------------------------------------------------------------------------------- /vim/plugin_settings/slime.vim: -------------------------------------------------------------------------------- 1 | let g:slime_target = 'tmux' 2 | let g:slime_paste_file = tempname() 3 | -------------------------------------------------------------------------------- /vim/plugin_settings/snipmate.vim: -------------------------------------------------------------------------------- 1 | let g:snipMate = {} 2 | let g:snipMate.scope_aliases = {} 3 | let g:snipMate.scope_aliases.haml = 'javascript' 4 | let g:snipMate.scope_aliases.jade = 'javascript' 5 | let g:snipMate.scope_aliases.markdown = 'html' 6 | let g:snipMate.scope_aliases.javascript = 'javascript.d3,javascript-jquery' 7 | -------------------------------------------------------------------------------- /vim/plugin_settings/switch.vim: -------------------------------------------------------------------------------- 1 | let g:switch_mapping = "c~" 2 | -------------------------------------------------------------------------------- /vim/plugin_settings/syntastic.vim: -------------------------------------------------------------------------------- 1 | let g:syntastic_enable_signs = 1 2 | let g:syntastic_auto_loc_list = 0 3 | let g:syntastic_aggregate_errors = 1 4 | let g:syntastic_always_populate_loc_list = 1 5 | 6 | let g:syntastic_javascript_checkers=['eshint'] 7 | -------------------------------------------------------------------------------- /vim/plugin_settings/table.vim: -------------------------------------------------------------------------------- 1 | fun! s:isAtStartOfLine(mapping) 2 | let text_before_cursor = getline('.')[0 : col('.')-1] 3 | let mapping_pattern = '\V' . escape(a:mapping, '\') 4 | let comment_pattern = '\V' . escape(substitute(&l:commentstring, '%s.*$', '', ''), '\') 5 | return (text_before_cursor =~? '^' . ('\v(' . comment_pattern . '\v)?') . '\s*\v' . mapping_pattern . '\v$') 6 | endf 7 | 8 | inoreabbrev 9 | \ isAtStartOfLine('\|\|') ? 10 | \ ':TableModeEnable' : '' 11 | inoreabbrev __ 12 | \ isAtStartOfLine('__') ? 13 | \ ':silent! TableModeDisable' : '__' 14 | -------------------------------------------------------------------------------- /vim/plugin_settings/tagbar.vim: -------------------------------------------------------------------------------- 1 | let g:tagbar_sort = 0 2 | let g:tagbar_indent = 0 3 | let g:tagbar_compact = 1 4 | let g:tagbar_autofocus = 1 5 | let g:tagbar_autoclose = 1 6 | -------------------------------------------------------------------------------- /vim/plugin_settings/test.vim: -------------------------------------------------------------------------------- 1 | if has('nvim') 2 | " let test#strategy = 'neoterm' 3 | let test#strategy = 'neovim' 4 | else 5 | let test#strategy = 'vimux' 6 | endif 7 | 8 | let test#ruby#rspec#options = { 9 | \ 'nearest': '--format doc', 10 | \ 'file': '--format doc', 11 | \ 'suite': '--format progress' 12 | \} 13 | 14 | let test#enabled_runners = ['viml#testify'] 15 | -------------------------------------------------------------------------------- /vim/plugin_settings/ultisnips.vim: -------------------------------------------------------------------------------- 1 | " let g:UltiSnips = {} 2 | " let g:UltiSnips.ExpandTrigger = '' 3 | " let g:UltiSnips.JumpForwardTrigger = '' 4 | " let g:UltiSnips.JumpBackwardTrigger = '' 5 | " let g:UltiSnips.always_use_first_snippet = 1 6 | " let g:UltiSnips.Ultisnips_ft_filter = { 7 | " \ 'default' : {'filetypes': ['all', 'FILETYPE'] }, 8 | " \ 'jade': {'filetypes': ['all', 'css', 'javascript'] }, 9 | " \ 'haml': {'filetypes': ['all', 'haml', 'css', 'javascript'] }, 10 | " \ 'html': {'filetypes': ['all', 'html', 'css', 'javascript'] }, 11 | " \ 'eruby': {'filetypes': ['all', 'eruby', 'css', 'html', 'javascript'] } 12 | " \ } 13 | " let g:UltiSnips.snipmate_ft_filter = { 14 | " \ 'default': {'filetypes': ['_', 'FILETYPE'] }, 15 | " \ 'jade': {'filetypes': ['all', 'css', 'javascript'] }, 16 | " \ 'haml': {'filetypes': ['_', 'haml', 'css', 'javascript'] }, 17 | " \ 'html': {'filetypes': ['_', 'html', 'css', 'javascript'] }, 18 | " \ 'eruby': {'filetypes': ['_', 'eruby', 'css', 'html', 'javascript'] } 19 | " \ } 20 | 21 | let g:UltiSnipsExpandTrigger = '' 22 | let g:UltiSnipsJumpForwardTrigger = '' 23 | let g:UltiSnipsJumpBackwardTrigger = '' 24 | 25 | augroup UltiSnips 26 | au! 27 | 28 | autocmd FileType javascript UltiSnipsAddFiletypes html 29 | augroup END 30 | -------------------------------------------------------------------------------- /vim/plugin_settings/vimwiki.vim: -------------------------------------------------------------------------------- 1 | let g:vimwiki_global_ext = 0 2 | let g:vimwiki_table_mappings = 0 3 | let g:vimwiki_table_auto_fmt = 0 4 | 5 | let wiki = { 6 | \ 'path': '~/Dropbox/Documents/vimwiki', 7 | \ 'nested_syntaxes': {'ledger': 'ledger', 'sh': 'sh', 'bash': 'bash', 'ruby': 'ruby', 'golang': 'go'}, 8 | \ 'ext': '.wiki', 9 | \} 10 | let g:vimwiki_list = [wiki] 11 | -------------------------------------------------------------------------------- /vim/plugin_settings/vrc.vim: -------------------------------------------------------------------------------- 1 | let g:vrc_allow_get_request_body = 1 2 | let g:vrc_syntax_highlight_response = 1 3 | let g:vrc_response_default_content_type = 'application/json' 4 | -------------------------------------------------------------------------------- /vim/spell/en.utf-8.add: -------------------------------------------------------------------------------- 1 | Admin 2 | mongodb 3 | refactor 4 | end 5 | plugin 6 | config 7 | wiki 8 | Dhruva 9 | Varun 10 | committer 11 | diff 12 | syntastic 13 | inline 14 | reliably 15 | macvim 16 | unicode 17 | zsh 18 | vimrc 19 | gvim 20 | Plugins 21 | colorscheme 22 | Ctrl 23 | vim 24 | http 25 | github 26 | autoload 27 | html 28 | quicktask 29 | Facebook 30 | facebook 31 | linkedin 32 | autocomplete 33 | Sagar 34 | metadata 35 | Tmuxification 36 | Tmux 37 | tmux 38 | Niharica 39 | ICICI 40 | App 41 | LOD 42 | -------------------------------------------------------------------------------- /vim/spell/en.utf-8.add.spl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dhruvasagar/dotfiles/35ea2424d8be2ee974baeb68a4e4be65bcae1c11/vim/spell/en.utf-8.add.spl -------------------------------------------------------------------------------- /vim/spell/en.utf-8.spl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dhruvasagar/dotfiles/35ea2424d8be2ee974baeb68a4e4be65bcae1c11/vim/spell/en.utf-8.spl -------------------------------------------------------------------------------- /vim/spell/en.utf-8.sug: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dhruvasagar/dotfiles/35ea2424d8be2ee974baeb68a4e4be65bcae1c11/vim/spell/en.utf-8.sug -------------------------------------------------------------------------------- /vim/syntax/tab.vim: -------------------------------------------------------------------------------- 1 | " Vim syntax file 2 | " Language: Guitar Tabs 3 | " Maintainer: Josh Hartigan 4 | " Latest Revision: 21 September 2014 5 | 6 | if exists("b:current_syntax") 7 | finish 8 | endif 9 | 10 | " Regex matches 11 | syn match SectionHeader /\v.+\:$/ 12 | 13 | syn match StringLetter /\v^[A-Za-z]\|/ 14 | 15 | syn match Empty /\v-/ 16 | 17 | syn match Number /x|\d\d?/ 18 | 19 | syn match SlideUp /\/\// 20 | syn match SlideDown /\\\\/ 21 | syn match HammerOn /h[^a-zA-Z]/ 22 | syn match PullOff /p\d[^a-zA-Z]/ 23 | syn match Bend /b\d[^a-zA-Z]/ 24 | syn match Vibrato /\dv\d\?-/ 25 | 26 | syn match TabComment /(.*)/ 27 | 28 | " Highlight types 29 | highlight link SlideUp Function 30 | highlight link SlideDown Function 31 | highlight link HammerOn Function 32 | highlight link PullOff Function 33 | highlight link Bend Function 34 | highlight link Vibrato Function 35 | 36 | highlight link Empty Comment 37 | 38 | highlight link Number Type 39 | 40 | highlight link SectionHeader PreProc 41 | 42 | highlight link StringLetter String 43 | 44 | highlight link TabComment Comment 45 | -------------------------------------------------------------------------------- /vim/tridactylrc: -------------------------------------------------------------------------------- 1 | set searchurls.r https://old.reddit.com/r/%s 2 | set searchurls.w https://en.wikipedia.org/w/index.php?search=%s 3 | set searchurls.wd https://en.wiktionary.org/wiki/?search=%s 4 | 5 | set yankto both 6 | set putfrom selection 7 | 8 | autocmd DocStart github.com mode ignore 9 | autocmd DocStart nitrotype.com mode ignore 10 | autocmd DocStart mail.google.com mode ignore 11 | autocmd DocStart cstimer.net mode ignore 12 | -------------------------------------------------------------------------------- /vim/vimpagerrc: -------------------------------------------------------------------------------- 1 | set rtp+=~/src/vim_plugins/vim-railscasts-theme 2 | color railscasts 3 | 4 | " vim:ft=vim 5 | -------------------------------------------------------------------------------- /vim/vimrc: -------------------------------------------------------------------------------- 1 | let g:vim_home = get(g:, 'vim_home', expand('~/.vim/')) 2 | 3 | " NeoBundle {{{1 4 | exec 'source' g:vim_home.'/packs.vim' 5 | 6 | " Load all vim configs {{{1 7 | let config_list = [ 8 | \ 'config.vim', 9 | \ 'autocmd.vim', 10 | \ 'commands.vim', 11 | \ 'mappings.vim', 12 | \ 'plugin_settings/*.vim' 13 | \] 14 | for files in config_list 15 | for f in glob(g:vim_home.files, 1, 1) 16 | exec 'source' f 17 | endfor 18 | endfor 19 | 20 | " Set at the end to work around 'exrc' 21 | set secure 22 | -------------------------------------------------------------------------------- /weechat/.gitignore: -------------------------------------------------------------------------------- 1 | *.log 2 | logs/* 3 | script/* 4 | slack.cache 5 | -------------------------------------------------------------------------------- /weechat/alias.conf: -------------------------------------------------------------------------------- 1 | # 2 | # weechat -- alias.conf 3 | # 4 | # WARNING: It is NOT recommended to edit this file by hand, 5 | # especially if WeeChat is running. 6 | # 7 | # Use commands like /set or /fset to change settings in WeeChat. 8 | # 9 | # For more info, see: https://weechat.org/doc/weechat/quickstart/ 10 | # 11 | 12 | config_version = 2 13 | 14 | [cmd] 15 | aaway = "allserv /away" 16 | ame = "allchan /me" 17 | amsg = "allchan /msg *" 18 | anick = "allserv /nick" 19 | bye = "quit" 20 | c = "buffer clear" 21 | chat = "dcc chat" 22 | cl = "buffer clear" 23 | close = "buffer close" 24 | exit = "quit" 25 | ig = "ignore" 26 | j = "join" 27 | k = "kick" 28 | kb = "kickban" 29 | leave = "part" 30 | m = "msg" 31 | mub = "unban *" 32 | n = "names" 33 | q = "query" 34 | redraw = "window refresh" 35 | say = "msg *" 36 | signoff = "quit" 37 | t = "topic" 38 | ub = "unban" 39 | umode = "mode $nick" 40 | v = "command core version" 41 | w = "who" 42 | wc = "window merge" 43 | wi = "whois" 44 | wii = "whois $1 $1" 45 | ww = "whowas" 46 | 47 | [completion] 48 | -------------------------------------------------------------------------------- /weechat/aspell.conf: -------------------------------------------------------------------------------- 1 | # 2 | # weechat -- aspell.conf 3 | # 4 | # WARNING: It is NOT recommended to edit this file by hand, 5 | # especially if WeeChat is running. 6 | # 7 | # Use /set or similar command to change settings in WeeChat. 8 | # 9 | # For more info, see: https://weechat.org/doc/quickstart 10 | # 11 | 12 | [color] 13 | misspelled = lightred 14 | suggestion = default 15 | suggestion_delimiter_dict = cyan 16 | suggestion_delimiter_word = cyan 17 | 18 | [check] 19 | commands = "ame,amsg,away,command,cycle,kick,kickban,me,msg,notice,part,query,quit,topic" 20 | default_dict = "" 21 | during_search = off 22 | enabled = on 23 | real_time = off 24 | suggestions = -1 25 | word_min_length = 2 26 | 27 | [dict] 28 | 29 | [look] 30 | suggestion_delimiter_dict = " / " 31 | suggestion_delimiter_word = "," 32 | 33 | [option] 34 | -------------------------------------------------------------------------------- /weechat/buffers.conf: -------------------------------------------------------------------------------- 1 | # 2 | # weechat -- buffers.conf 3 | # 4 | 5 | [color] 6 | current_bg = red 7 | current_fg = lightcyan 8 | default_bg = default 9 | default_fg = default 10 | hotlist_highlight_bg = default 11 | hotlist_highlight_fg = magenta 12 | hotlist_low_bg = default 13 | hotlist_low_fg = white 14 | hotlist_message_bg = default 15 | hotlist_message_fg = yellow 16 | hotlist_private_bg = default 17 | hotlist_private_fg = lightgreen 18 | none_channel_bg = default 19 | none_channel_fg = default 20 | number = lightgreen 21 | number_char = lightgreen 22 | prefix_bufname = default 23 | queries_default_bg = default 24 | queries_default_fg = default 25 | queries_highlight_bg = default 26 | queries_highlight_fg = default 27 | queries_message_bg = default 28 | queries_message_fg = default 29 | suffix_bufname = default 30 | whitelist_default_bg = default 31 | whitelist_default_fg = default 32 | whitelist_highlight_bg = default 33 | whitelist_highlight_fg = default 34 | whitelist_low_bg = default 35 | whitelist_low_fg = default 36 | whitelist_message_bg = default 37 | whitelist_message_fg = default 38 | whitelist_private_bg = default 39 | whitelist_private_fg = default 40 | 41 | [look] 42 | core_to_front = off 43 | detach = 0 44 | detach_buffer_immediately = "" 45 | detach_display_window_number = off 46 | detach_displayed_buffers = on 47 | detach_free_content = off 48 | detach_query = off 49 | hide_merged_buffers = none 50 | hotlist_counter = off 51 | immune_detach_buffers = "" 52 | indenting = off 53 | indenting_number = on 54 | jump_prev_next_visited_buffer = off 55 | mark_inactive = off 56 | mouse_move_buffer = on 57 | mouse_wheel = on 58 | name_crop_suffix = "+" 59 | name_size_max = 0 60 | number_char = "." 61 | prefix = off 62 | prefix_bufname = "" 63 | prefix_empty = on 64 | prefix_for_query = "" 65 | short_names = on 66 | show_lag = off 67 | show_number = on 68 | sort = number 69 | suffix_bufname = "" 70 | toggle_bar = on 71 | whitelist_buffers = "" 72 | -------------------------------------------------------------------------------- /weechat/buflist.conf: -------------------------------------------------------------------------------- 1 | # 2 | # weechat -- buflist.conf 3 | # 4 | # WARNING: It is NOT recommended to edit this file by hand, 5 | # especially if WeeChat is running. 6 | # 7 | # Use commands like /set or /fset to change settings in WeeChat. 8 | # 9 | # For more info, see: https://weechat.org/doc/weechat/quickstart/ 10 | # 11 | 12 | [look] 13 | add_newline = on 14 | auto_scroll = 50 15 | display_conditions = "${buffer.hidden}==0" 16 | enabled = off 17 | mouse_jump_visited_buffer = off 18 | mouse_move_buffer = on 19 | mouse_wheel = on 20 | nick_prefix = off 21 | nick_prefix_empty = on 22 | signals_refresh = "" 23 | sort = "number,-active" 24 | use_items = 1 25 | 26 | [format] 27 | buffer = "${format_number}${indent}${format_nick_prefix}${color_hotlist}${format_name}" 28 | buffer_current = "${color:,blue}${format_buffer}" 29 | hotlist = " ${color:green}(${hotlist}${color:green})" 30 | hotlist_highlight = "${color:magenta}" 31 | hotlist_low = "${color:white}" 32 | hotlist_message = "${color:brown}" 33 | hotlist_none = "${color:default}" 34 | hotlist_private = "${color:green}" 35 | hotlist_separator = "${color:default}," 36 | indent = " " 37 | lag = " ${color:green}[${color:brown}${lag}${color:green}]" 38 | name = "${name}" 39 | nick_prefix = "${color_nick_prefix}${nick_prefix}" 40 | number = "${color:green}${number}${if:${number_displayed}?.: }" 41 | tls_version = " ${color:default}(${if:${tls_version}==TLS1.3?${color:green}:${if:${tls_version}==TLS1.2?${color:yellow}:${color:red}}}${translate:${tls_version}}${color:default})" 42 | -------------------------------------------------------------------------------- /weechat/charset.conf: -------------------------------------------------------------------------------- 1 | # 2 | # weechat -- charset.conf 3 | # 4 | # WARNING: It is NOT recommended to edit this file by hand, 5 | # especially if WeeChat is running. 6 | # 7 | # Use commands like /set or /fset to change settings in WeeChat. 8 | # 9 | # For more info, see: https://weechat.org/doc/weechat/quickstart/ 10 | # 11 | 12 | [default] 13 | decode = "iso-8859-1" 14 | encode = "" 15 | 16 | [decode] 17 | 18 | [encode] 19 | -------------------------------------------------------------------------------- /weechat/exec.conf: -------------------------------------------------------------------------------- 1 | # 2 | # weechat -- exec.conf 3 | # 4 | # WARNING: It is NOT recommended to edit this file by hand, 5 | # especially if WeeChat is running. 6 | # 7 | # Use commands like /set or /fset to change settings in WeeChat. 8 | # 9 | # For more info, see: https://weechat.org/doc/weechat/quickstart/ 10 | # 11 | 12 | [command] 13 | default_options = "" 14 | purge_delay = 0 15 | shell = "${env:SHELL}" 16 | 17 | [color] 18 | flag_finished = lightred 19 | flag_running = lightgreen 20 | -------------------------------------------------------------------------------- /weechat/fifo.conf: -------------------------------------------------------------------------------- 1 | # 2 | # weechat -- fifo.conf 3 | # 4 | # WARNING: It is NOT recommended to edit this file by hand, 5 | # especially if WeeChat is running. 6 | # 7 | # Use commands like /set or /fset to change settings in WeeChat. 8 | # 9 | # For more info, see: https://weechat.org/doc/weechat/quickstart/ 10 | # 11 | 12 | [file] 13 | enabled = on 14 | path = "%h/weechat_fifo" 15 | -------------------------------------------------------------------------------- /weechat/fset.conf: -------------------------------------------------------------------------------- 1 | # 2 | # weechat -- fset.conf 3 | # 4 | # WARNING: It is NOT recommended to edit this file by hand, 5 | # especially if WeeChat is running. 6 | # 7 | # Use commands like /set or /fset to change settings in WeeChat. 8 | # 9 | # For more info, see: https://weechat.org/doc/weechat/quickstart/ 10 | # 11 | 12 | [look] 13 | auto_refresh = "*" 14 | auto_unmark = off 15 | condition_catch_set = "${count} >= 1" 16 | export_help_default = on 17 | format_number = 1 18 | marked_string = "*" 19 | scroll_horizontal = 10 20 | show_plugins_desc = off 21 | sort = "~name" 22 | unmarked_string = " " 23 | use_color_value = off 24 | use_keys = on 25 | use_mute = off 26 | 27 | [format] 28 | export_help = "# ${description2}" 29 | export_option = "/set ${name} ${quoted_value}" 30 | export_option_null = "/unset ${name}" 31 | option1 = "" 32 | option2 = "${marked} ${name} ${type} ${value2}${newline} ${empty_name} ${_default_value}${color:darkgray} -- ${min}..${max}${newline} ${empty_name} ${description}" 33 | 34 | [color] 35 | allowed_values = default 36 | allowed_values_selected = white 37 | color_name = 246 38 | color_name_selected = default 39 | default_value = default 40 | default_value_selected = white 41 | description = default 42 | description_selected = white 43 | file = default 44 | file_changed = brown 45 | file_changed_selected = yellow 46 | file_selected = white 47 | help_default_value = white 48 | help_description = default 49 | help_name = white 50 | help_quotes = darkgray 51 | help_values = default 52 | index = cyan 53 | index_selected = lightcyan 54 | line_marked_bg1 = default 55 | line_marked_bg2 = default 56 | line_selected_bg1 = blue 57 | line_selected_bg2 = red 58 | marked = brown 59 | marked_selected = yellow 60 | max = default 61 | max_selected = white 62 | min = default 63 | min_selected = white 64 | name = default 65 | name_changed = brown 66 | name_changed_selected = yellow 67 | name_selected = white 68 | option = default 69 | option_changed = brown 70 | option_changed_selected = yellow 71 | option_selected = white 72 | parent_name = default 73 | parent_name_selected = white 74 | parent_value = cyan 75 | parent_value_selected = lightcyan 76 | quotes = darkgray 77 | quotes_changed = default 78 | quotes_changed_selected = white 79 | quotes_selected = default 80 | section = default 81 | section_changed = brown 82 | section_changed_selected = yellow 83 | section_selected = white 84 | string_values = default 85 | string_values_selected = white 86 | title_count_options = cyan 87 | title_current_option = lightcyan 88 | title_filter = yellow 89 | title_marked_options = lightgreen 90 | title_sort = white 91 | type = green 92 | type_selected = lightgreen 93 | unmarked = default 94 | unmarked_selected = white 95 | value = cyan 96 | value_changed = brown 97 | value_changed_selected = yellow 98 | value_selected = lightcyan 99 | value_undef = magenta 100 | value_undef_selected = lightmagenta 101 | -------------------------------------------------------------------------------- /weechat/guile.conf: -------------------------------------------------------------------------------- 1 | # 2 | # weechat -- guile.conf 3 | # 4 | # WARNING: It is NOT recommended to edit this file by hand, 5 | # especially if WeeChat is running. 6 | # 7 | # Use commands like /set or /fset to change settings in WeeChat. 8 | # 9 | # For more info, see: https://weechat.org/doc/quickstart 10 | # 11 | 12 | [look] 13 | check_license = off 14 | eval_keep_context = on 15 | -------------------------------------------------------------------------------- /weechat/logger.conf: -------------------------------------------------------------------------------- 1 | # 2 | # weechat -- logger.conf 3 | # 4 | # WARNING: It is NOT recommended to edit this file by hand, 5 | # especially if WeeChat is running. 6 | # 7 | # Use commands like /set or /fset to change settings in WeeChat. 8 | # 9 | # For more info, see: https://weechat.org/doc/weechat/quickstart/ 10 | # 11 | 12 | [look] 13 | backlog = 20 14 | backlog_conditions = "" 15 | 16 | [color] 17 | backlog_end = darkgray 18 | backlog_line = darkgray 19 | 20 | [file] 21 | auto_log = on 22 | color_lines = off 23 | flush_delay = 120 24 | fsync = off 25 | info_lines = off 26 | log_conditions = "" 27 | mask = "$plugin.$name.weechatlog" 28 | name_lower_case = on 29 | nick_prefix = "" 30 | nick_suffix = "" 31 | path = "%h/logs/" 32 | replacement_char = "_" 33 | rotation_compression_level = 20 34 | rotation_compression_type = none 35 | rotation_size_max = "0" 36 | time_format = "%Y-%m-%d %H:%M:%S" 37 | 38 | [level] 39 | 40 | [mask] 41 | -------------------------------------------------------------------------------- /weechat/lua.conf: -------------------------------------------------------------------------------- 1 | # 2 | # weechat -- lua.conf 3 | # 4 | # WARNING: It is NOT recommended to edit this file by hand, 5 | # especially if WeeChat is running. 6 | # 7 | # Use commands like /set or /fset to change settings in WeeChat. 8 | # 9 | # For more info, see: https://weechat.org/doc/weechat/quickstart/ 10 | # 11 | 12 | [look] 13 | check_license = off 14 | eval_keep_context = on 15 | -------------------------------------------------------------------------------- /weechat/matrix.conf: -------------------------------------------------------------------------------- 1 | # 2 | # weechat -- matrix.conf 3 | # 4 | # WARNING: It is NOT recommended to edit this file by hand, 5 | # especially if WeeChat is running. 6 | # 7 | # Use commands like /set or /fset to change settings in WeeChat. 8 | # 9 | # For more info, see: https://weechat.org/doc/quickstart/ 10 | # 11 | 12 | [network] 13 | autoreconnect_delay_growing = 2 14 | autoreconnect_delay_max = 600 15 | debug_buffer = off 16 | debug_category = all 17 | debug_level = error 18 | fetch_backlog_on_pgup = on 19 | lag_min_show = 500 20 | lag_reconnect = 90 21 | lazy_load_room_users = off 22 | max_backlog_sync_events = 10 23 | max_initial_sync_events = 30 24 | max_nicklist_users = 5000 25 | print_unconfirmed_messages = on 26 | read_markers_conditions = "${markers_enabled}" 27 | resending_ignores_devices = on 28 | typing_notice_conditions = "${typing_enabled}" 29 | 30 | [look] 31 | bar_item_typing_notice_prefix = "Typing: " 32 | busy_sign = "⏳" 33 | code_block_margin = 2 34 | code_blocks = on 35 | disconnect_sign = "❌" 36 | encrypted_room_sign = "🔐" 37 | encryption_warning_sign = "⚠️ " 38 | human_buffer_names = off 39 | markdown_input = on 40 | max_typing_notice_item_length = 50 41 | new_channel_position = none 42 | pygments_style = "native" 43 | quote_wrap = 67 44 | redactions = strikethrough 45 | server_buffer = merge_with_core 46 | 47 | [color] 48 | error_message_bg = default 49 | error_message_fg = darkgray 50 | nick_prefixes = "admin=lightgreen;mod=lightgreen;power=yellow" 51 | quote_bg = default 52 | quote_fg = lightgreen 53 | unconfirmed_message_bg = default 54 | unconfirmed_message_fg = darkgray 55 | untagged_code_bg = default 56 | untagged_code_fg = blue 57 | 58 | [server] 59 | matrix_org.autoconnect = on 60 | matrix_org.address = "matrix.org" 61 | matrix_org.port = 443 62 | matrix_org.proxy = "" 63 | matrix_org.ssl_verify = on 64 | matrix_org.username = "dhruvasagar" 65 | matrix_org.password = "${sec.data.matrix}" 66 | matrix_org.device_name = "Weechat Matrix" 67 | matrix_org.autoreconnect_delay = 10 68 | matrix_org.sso_helper_listening_port = 0 69 | -------------------------------------------------------------------------------- /weechat/matrix/matrix_org/@dhruvasagar:matrix.org_UYUGHDLKHG.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dhruvasagar/dotfiles/35ea2424d8be2ee974baeb68a4e4be65bcae1c11/weechat/matrix/matrix_org/@dhruvasagar:matrix.org_UYUGHDLKHG.db -------------------------------------------------------------------------------- /weechat/matrix/matrix_org/dhruvasagar.device_id: -------------------------------------------------------------------------------- 1 | UYUGHDLKHG -------------------------------------------------------------------------------- /weechat/perl.conf: -------------------------------------------------------------------------------- 1 | # 2 | # weechat -- perl.conf 3 | # 4 | # WARNING: It is NOT recommended to edit this file by hand, 5 | # especially if WeeChat is running. 6 | # 7 | # Use commands like /set or /fset to change settings in WeeChat. 8 | # 9 | # For more info, see: https://weechat.org/doc/weechat/quickstart/ 10 | # 11 | 12 | [look] 13 | check_license = off 14 | eval_keep_context = on 15 | -------------------------------------------------------------------------------- /weechat/perl/autoload/colorize_lines.pl: -------------------------------------------------------------------------------- 1 | ../colorize_lines.pl -------------------------------------------------------------------------------- /weechat/perl/autoload/highmon.pl: -------------------------------------------------------------------------------- 1 | ../highmon.pl -------------------------------------------------------------------------------- /weechat/python.conf: -------------------------------------------------------------------------------- 1 | # 2 | # weechat -- python.conf 3 | # 4 | # WARNING: It is NOT recommended to edit this file by hand, 5 | # especially if WeeChat is running. 6 | # 7 | # Use commands like /set or /fset to change settings in WeeChat. 8 | # 9 | # For more info, see: https://weechat.org/doc/weechat/quickstart/ 10 | # 11 | 12 | [look] 13 | check_license = off 14 | eval_keep_context = on 15 | -------------------------------------------------------------------------------- /weechat/python/autoload/go.py: -------------------------------------------------------------------------------- 1 | ../go.py -------------------------------------------------------------------------------- /weechat/python/autoload/matrix.py: -------------------------------------------------------------------------------- 1 | ../matrix.py -------------------------------------------------------------------------------- /weechat/python/autoload/notification_center.py: -------------------------------------------------------------------------------- 1 | ../notification_center.py -------------------------------------------------------------------------------- /weechat/python/matrix: -------------------------------------------------------------------------------- 1 | /Users/dhruva/src/oss/weechat-matrix/matrix -------------------------------------------------------------------------------- /weechat/python/matrix.py: -------------------------------------------------------------------------------- 1 | /Users/dhruva/src/oss/weechat-matrix/main.py -------------------------------------------------------------------------------- /weechat/python/wee_slack.py: -------------------------------------------------------------------------------- 1 | /Users/dhruvasagar/src/oss/wee-slack/wee_slack.py -------------------------------------------------------------------------------- /weechat/relay.conf: -------------------------------------------------------------------------------- 1 | # 2 | # weechat -- relay.conf 3 | # 4 | # WARNING: It is NOT recommended to edit this file by hand, 5 | # especially if WeeChat is running. 6 | # 7 | # Use commands like /set or /fset to change settings in WeeChat. 8 | # 9 | # For more info, see: https://weechat.org/doc/weechat/quickstart/ 10 | # 11 | 12 | config_version = 2 13 | 14 | [look] 15 | auto_open_buffer = "on" 16 | display_clients = "irc,weechat" 17 | raw_messages = 256 18 | raw_messages_max_length = 4096 19 | 20 | [color] 21 | client = cyan 22 | status_active = lightblue 23 | status_auth_failed = lightred 24 | status_authenticating = yellow 25 | status_connecting = yellow 26 | status_disconnected = lightred 27 | text = default 28 | text_bg = default 29 | text_selected = white 30 | 31 | [network] 32 | allow_empty_password = off 33 | allowed_ips = "" 34 | auth_timeout = 60 35 | bind_address = "" 36 | clients_purge_delay = 0 37 | commands = "*,!quit" 38 | compression = 20 39 | ipv6 = on 40 | max_clients = 5 41 | nonce_size = 16 42 | password = "" 43 | password_hash_algo = "*" 44 | password_hash_iterations = 100000 45 | time_window = 5 46 | tls_cert_key = "%h/ssl/relay.pem" 47 | tls_priorities = "NORMAL:-VERS-SSL3.0" 48 | totp_secret = "" 49 | totp_window = 0 50 | websocket_allowed_origins = "" 51 | 52 | [irc] 53 | backlog_max_minutes = 1440 54 | backlog_max_number = 256 55 | backlog_since_last_disconnect = on 56 | backlog_since_last_message = off 57 | backlog_tags = "irc_privmsg" 58 | backlog_time_format = "[%H:%M] " 59 | 60 | [api] 61 | remote_get_lines = 1000 62 | 63 | [port] 64 | 65 | [path] 66 | 67 | [remote] 68 | -------------------------------------------------------------------------------- /weechat/rmodifier.conf: -------------------------------------------------------------------------------- 1 | # 2 | # rmodifier.conf -- weechat v0.4.2 3 | # 4 | 5 | [look] 6 | hide_char = "*" 7 | 8 | [modifier] 9 | command_auth = "history_add,input_text_display,irc_command_auth;^(/(msg|quote) +nickserv +(id|identify|register|ghost \S+|release \S+) +)(.*);1,4*" 10 | message_auth = "irc_message_auth;^(.*(id|identify|register|ghost \S+|release \S+) +)(.*);1,3*" 11 | oper = "history_add,input_text_display;^(/oper +\S+ +)(.*);1,2*" 12 | quote_pass = "history_add,input_text_display;^(/quote pass +)(.*);1,2*" 13 | secure = "history_add,input_text_display;^(/secure +(passphrase|decrypt|set \S+) +)(.*);1,3*" 14 | server = "history_add,input_text_display;^(/(server|connect) .*-(sasl_)?password=)(\S+)(.*);1,4*,5" 15 | set_pass = "history_add;^(/set +\S*password\S* +)(.*);1,2*" 16 | -------------------------------------------------------------------------------- /weechat/ruby.conf: -------------------------------------------------------------------------------- 1 | # 2 | # weechat -- ruby.conf 3 | # 4 | # WARNING: It is NOT recommended to edit this file by hand, 5 | # especially if WeeChat is running. 6 | # 7 | # Use commands like /set or /fset to change settings in WeeChat. 8 | # 9 | # For more info, see: https://weechat.org/doc/weechat/quickstart/ 10 | # 11 | 12 | [look] 13 | check_license = off 14 | eval_keep_context = on 15 | -------------------------------------------------------------------------------- /weechat/script.conf: -------------------------------------------------------------------------------- 1 | # 2 | # weechat -- script.conf 3 | # 4 | # WARNING: It is NOT recommended to edit this file by hand, 5 | # especially if WeeChat is running. 6 | # 7 | # Use commands like /set or /fset to change settings in WeeChat. 8 | # 9 | # For more info, see: https://weechat.org/doc/weechat/quickstart/ 10 | # 11 | 12 | [look] 13 | columns = "%s %n %V %v %u | %d | %t" 14 | diff_color = on 15 | diff_command = "auto" 16 | display_source = on 17 | quiet_actions = on 18 | sort = "p,n" 19 | translate_description = on 20 | use_keys = on 21 | 22 | [color] 23 | status_autoloaded = cyan 24 | status_held = white 25 | status_installed = lightcyan 26 | status_obsolete = lightmagenta 27 | status_popular = yellow 28 | status_running = lightgreen 29 | status_unknown = lightred 30 | text = default 31 | text_bg = default 32 | text_bg_selected = red 33 | text_date = default 34 | text_date_selected = white 35 | text_delimiters = darkgray 36 | text_description = default 37 | text_description_selected = white 38 | text_extension = default 39 | text_extension_selected = white 40 | text_name = cyan 41 | text_name_selected = lightcyan 42 | text_selected = white 43 | text_tags = brown 44 | text_tags_selected = yellow 45 | text_version = magenta 46 | text_version_loaded = default 47 | text_version_loaded_selected = white 48 | text_version_selected = lightmagenta 49 | 50 | [scripts] 51 | autoload = on 52 | cache_expire = 60 53 | download_enabled = on 54 | download_timeout = 30 55 | hold = "" 56 | path = "%h/script" 57 | url = "http://www.weechat.org/files/plugins.xml.gz" 58 | -------------------------------------------------------------------------------- /weechat/sec.conf: -------------------------------------------------------------------------------- 1 | # 2 | # weechat -- sec.conf 3 | # 4 | # WARNING: It is NOT recommended to edit this file by hand, 5 | # especially if WeeChat is running. 6 | # 7 | # Use commands like /set or /fset to change settings in WeeChat. 8 | # 9 | # For more info, see: https://weechat.org/doc/weechat/quickstart/ 10 | # 11 | 12 | [crypt] 13 | cipher = aes256 14 | hash_algo = sha256 15 | passphrase_command = "" 16 | salt = on 17 | 18 | [data] 19 | __passphrase__ = on 20 | slack_token = "50DAC1F559981BA7543958F73F4C835981C3DBB5D496298B061512E965ADF85196437B6E16AD94F901B62A4203AAE66320C86DED259F6EDA1AEFCC5EE20E13043562A1049C7EB77F290EB5C4F3C53ECCC34C09E412D42C3C881D8B630DFDA43C468D80C49A04C5790A3640D15CDD30F82A6A5A" 21 | libera_password = "C56CA6AEEDFDA32C9896CF94A0E1EA22781F95A386C4E72034B8BDB024074265611634EE7C652F39C37C15006757CD" 22 | freenode_password = "4F78E25C0EEA8BF6DB06DEFBE4D9A6F5283BAA0E3298FF44C78ACBEA6774661B8A796CB61B4BCB02D8F41533B1D8576A3B9913" 23 | matrix = "0170E369481298F5261670984C5903EF8CB83E12E9EF82E77990C1C6A9C3186FB396E43A1C9A69386AA451B30CED34" 24 | -------------------------------------------------------------------------------- /weechat/spell.conf: -------------------------------------------------------------------------------- 1 | # 2 | # weechat -- spell.conf 3 | # 4 | # WARNING: It is NOT recommended to edit this file by hand, 5 | # especially if WeeChat is running. 6 | # 7 | # Use commands like /set or /fset to change settings in WeeChat. 8 | # 9 | # For more info, see: https://weechat.org/doc/weechat/quickstart/ 10 | # 11 | 12 | [color] 13 | misspelled = lightred 14 | suggestion = default 15 | suggestion_delimiter_dict = cyan 16 | suggestion_delimiter_word = cyan 17 | 18 | [check] 19 | commands = "away,command,cycle,kick,kickban,me,msg,notice,part,query,quit,topic" 20 | default_dict = "" 21 | during_search = off 22 | enabled = off 23 | real_time = off 24 | suggestions = -1 25 | word_min_length = 2 26 | 27 | [dict] 28 | 29 | [look] 30 | suggestion_delimiter_dict = " / " 31 | suggestion_delimiter_word = "," 32 | 33 | [option] 34 | -------------------------------------------------------------------------------- /weechat/tcl.conf: -------------------------------------------------------------------------------- 1 | # 2 | # weechat -- tcl.conf 3 | # 4 | # WARNING: It is NOT recommended to edit this file by hand, 5 | # especially if WeeChat is running. 6 | # 7 | # Use commands like /set or /fset to change settings in WeeChat. 8 | # 9 | # For more info, see: https://weechat.org/doc/weechat/quickstart/ 10 | # 11 | 12 | [look] 13 | check_license = off 14 | eval_keep_context = on 15 | -------------------------------------------------------------------------------- /weechat/trigger.conf: -------------------------------------------------------------------------------- 1 | # 2 | # weechat -- trigger.conf 3 | # 4 | # WARNING: It is NOT recommended to edit this file by hand, 5 | # especially if WeeChat is running. 6 | # 7 | # Use commands like /set or /fset to change settings in WeeChat. 8 | # 9 | # For more info, see: https://weechat.org/doc/weechat/quickstart/ 10 | # 11 | 12 | [look] 13 | enabled = on 14 | monitor_strip_colors = off 15 | 16 | [color] 17 | flag_command = lightgreen 18 | flag_conditions = yellow 19 | flag_post_action = lightblue 20 | flag_regex = lightcyan 21 | flag_return_code = lightmagenta 22 | identifier = cyan 23 | regex = white 24 | replace = cyan 25 | 26 | [trigger] 27 | beep.arguments = "" 28 | beep.command = "/print -beep" 29 | beep.conditions = "${tg_highlight} || ${tg_msg_pv}" 30 | beep.enabled = off 31 | beep.hook = print 32 | beep.post_action = none 33 | beep.regex = "" 34 | beep.return_code = ok 35 | cmd_pass.arguments = "5000|input_text_display;5000|history_add;5000|irc_command_auth" 36 | cmd_pass.command = "" 37 | cmd_pass.conditions = "" 38 | cmd_pass.enabled = on 39 | cmd_pass.hook = modifier 40 | cmd_pass.post_action = none 41 | cmd_pass.regex = "==^((/(msg|quote) +nickserv +(id|identify|register|ghost +\S+|release +\S+|regain +\S+) +)|/oper +\S+ +|/quote +pass +|/set +\S*password\S* +|/secure +(passphrase|decrypt|set +\S+) +)(.*)==$1$.*+" 42 | cmd_pass.return_code = ok 43 | msg_auth.arguments = "5000|irc_message_auth" 44 | msg_auth.command = "" 45 | msg_auth.conditions = "" 46 | msg_auth.enabled = on 47 | msg_auth.hook = modifier 48 | msg_auth.post_action = none 49 | msg_auth.regex = "==^(.*(id|identify|register|ghost +\S+|release +\S+) +)(.*)==$1$.*+" 50 | msg_auth.return_code = ok 51 | server_pass.arguments = "5000|input_text_display;5000|history_add" 52 | server_pass.command = "" 53 | server_pass.conditions = "" 54 | server_pass.enabled = on 55 | server_pass.hook = modifier 56 | server_pass.post_action = none 57 | server_pass.regex = "==^(/(server|connect) .*-(sasl_)?password=)(\S+)(.*)==$1$.*4$5" 58 | server_pass.return_code = ok 59 | -------------------------------------------------------------------------------- /weechat/typing.conf: -------------------------------------------------------------------------------- 1 | # 2 | # weechat -- typing.conf 3 | # 4 | # WARNING: It is NOT recommended to edit this file by hand, 5 | # especially if WeeChat is running. 6 | # 7 | # Use commands like /set or /fset to change settings in WeeChat. 8 | # 9 | # For more info, see: https://weechat.org/doc/weechat/quickstart/ 10 | # 11 | 12 | [look] 13 | delay_purge_paused = 30 14 | delay_purge_typing = 6 15 | delay_set_paused = 10 16 | enabled_nicks = off 17 | enabled_self = off 18 | input_min_chars = 4 19 | item_max_length = 0 20 | -------------------------------------------------------------------------------- /weechat/xfer.conf: -------------------------------------------------------------------------------- 1 | # 2 | # weechat -- xfer.conf 3 | # 4 | # WARNING: It is NOT recommended to edit this file by hand, 5 | # especially if WeeChat is running. 6 | # 7 | # Use commands like /set or /fset to change settings in WeeChat. 8 | # 9 | # For more info, see: https://weechat.org/doc/weechat/quickstart/ 10 | # 11 | 12 | [look] 13 | auto_open_buffer = on 14 | progress_bar_size = 20 15 | pv_tags = "notify_private" 16 | 17 | [color] 18 | status_aborted = lightred 19 | status_active = lightblue 20 | status_connecting = yellow 21 | status_done = lightgreen 22 | status_failed = lightred 23 | status_waiting = lightcyan 24 | text = default 25 | text_bg = default 26 | text_selected = white 27 | 28 | [network] 29 | blocksize = 65536 30 | fast_send = on 31 | own_ip = "" 32 | port_range = "" 33 | send_ack = on 34 | speed_limit_recv = 0 35 | speed_limit_send = 0 36 | timeout = 300 37 | 38 | [file] 39 | auto_accept_chats = off 40 | auto_accept_files = off 41 | auto_accept_nicks = "" 42 | auto_check_crc32 = off 43 | auto_rename = on 44 | auto_resume = on 45 | convert_spaces = on 46 | download_path = "%h/xfer" 47 | download_temporary_suffix = ".part" 48 | upload_path = "~" 49 | use_nick_in_filename = on 50 | -------------------------------------------------------------------------------- /zsh/aliases: -------------------------------------------------------------------------------- 1 | # vim: ft=zsh 2 | 3 | if [[ "$OSTYPE" == darwin* ]]; then 4 | alias o='open' 5 | else 6 | alias o='xdg-open' 7 | 8 | if [ $+commands[xclip] ]; then 9 | alias pbcopy='xclip -selection clipboard -in' 10 | alias pbpaste='xclip -selection clipboard -out' 11 | fi 12 | fi 13 | alias pbc='pbcopy' 14 | alias pbp='pbpaste' 15 | 16 | if [ $+commands[curl] ]; then 17 | alias get='curl --continue-at - --location --progress-bar --remote-name --remote-time' 18 | elif [ $+commands[wget] ]; then 19 | alias get='wget --continue --progress=bar --timestamping' 20 | fi 21 | 22 | if [ $+commands[python3] ]; then 23 | alias http-serve='python3 -m http.server' 24 | else 25 | alias http-serve='python -m SimpleHTTPServer' 26 | fi 27 | 28 | # Colorify 29 | if [[ "$OSTYPE" == darwin* ]]; then 30 | alias l='ls --color=auto -1tA' 31 | alias ls='ls --color=auto' 32 | alias ll='ls -lth --color=auto' 33 | else 34 | alias l='ls --color=auto -1tA' 35 | alias ls='ls --color=auto --group-directories-first' 36 | alias ll='ls -lthN --color=auto --group-directories-first' 37 | fi 38 | alias grep='grep --color=auto --exclude-dir={.bzr,CVS,.git,.hg,.svn} --exclude-dir={.bundle,node_modules}' 39 | 40 | alias vimgit="git -c pager.color=false -c pager.log='vim -R -' -c pager.show='vim -R -' -c pager.diff='vim -R -'" 41 | 42 | alias d='docker' 43 | alias da='docker attach --detach-keys="ctrl-c"' 44 | alias dc='docker-compose' 45 | 46 | alias yt='youtube-dl --add-metadata -ic' # Download video 47 | alias yta='youtube-dl --add-metadata -xic' # Download audio 48 | 49 | alias diffdir='diff -rq' 50 | 51 | alias ledger="ledger -f ~/Dropbox/Documents/ledger/personal.dat" 52 | alias lb="ledger bal -R" 53 | alias lbn='ledger -R -X $ --current bal assets liabilities' 54 | 55 | alias bat='bat --plain' 56 | alias k='kubectl' 57 | -------------------------------------------------------------------------------- /zsh/benchmark: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | echo "Benchmarking vanila zsh" 4 | docker build -q \ 5 | -f benchmarks/Dockerfile-zsh \ 6 | -t bench-zsh . \ 7 | && docker run --rm -t bench-zsh 8 | 9 | echo "Benchmarking my zsh" 10 | docker build -q \ 11 | -f benchmarks/Dockerfile-myzsh \ 12 | -t bench-myzsh . \ 13 | && docker run --rm -t bench-myzsh 14 | 15 | echo "Benchmarking prezto" 16 | docker build -q \ 17 | -f benchmarks/Dockerfile-prezto \ 18 | -t bench-prezto . \ 19 | && docker run --rm -t bench-prezto 20 | 21 | echo "Benchmarking ohmyzsh" 22 | docker build -q \ 23 | -f benchmarks/Dockerfile-ohmyzsh \ 24 | -t bench-ohmyzsh . \ 25 | && docker run --rm -t bench-ohmyzsh 26 | -------------------------------------------------------------------------------- /zsh/benchmarks/Dockerfile-myzsh: -------------------------------------------------------------------------------- 1 | # vim: ft=Dockerfile 2 | 3 | FROM alpine 4 | 5 | LABEL maintainer="Dhruva Sagar " 6 | 7 | RUN apk update --no-cache && apk add --no-cache zsh 8 | 9 | RUN sed -i -e "s/bin\/ash/bin\/zsh/" /etc/passwd 10 | 11 | RUN mkdir -p /root/dotfiles/zsh 12 | COPY . /root/dotfiles/zsh/ 13 | 14 | RUN ln -s /root/dotfiles/zsh/zshrc /root/.zshrc 15 | 16 | COPY benchmarks/timezsh / 17 | 18 | CMD "./timezsh" 19 | -------------------------------------------------------------------------------- /zsh/benchmarks/Dockerfile-ohmyzsh: -------------------------------------------------------------------------------- 1 | # vim: ft=Dockerfile 2 | 3 | FROM alpine 4 | 5 | LABEL maintainer="Dhruva Sagar " 6 | 7 | RUN apk update --no-cache && apk add --no-cache zsh git 8 | 9 | RUN sed -i -e "s/bin\/ash/bin\/zsh/" /etc/passwd 10 | 11 | COPY benchmarks . 12 | 13 | RUN ./install_ohmyzsh 14 | 15 | RUN rm -f /root/.zshrc 16 | RUN ln -s /zshrc /root/.zshrc 17 | 18 | CMD "./timezsh" 19 | -------------------------------------------------------------------------------- /zsh/benchmarks/Dockerfile-prezto: -------------------------------------------------------------------------------- 1 | # vim: ft=Dockerfile 2 | 3 | FROM alpine 4 | 5 | LABEL maintainer="Dhruva Sagar " 6 | 7 | RUN apk update --no-cache && apk add --no-cache zsh git 8 | 9 | RUN sed -i -e "s/bin\/ash/bin\/zsh/" /etc/passwd 10 | 11 | COPY benchmarks . 12 | 13 | RUN ./install_prezto 14 | 15 | RUN rm -f /root/.zpreztorc 16 | RUN ln -s /zpreztorc /root/.zpreztorc 17 | 18 | CMD "./timezsh" 19 | -------------------------------------------------------------------------------- /zsh/benchmarks/Dockerfile-zsh: -------------------------------------------------------------------------------- 1 | # vim: ft=Dockerfile 2 | 3 | FROM alpine 4 | 5 | LABEL maintainer="Dhruva Sagar " 6 | 7 | RUN apk update --no-cache && apk add --no-cache zsh 8 | 9 | RUN sed -i -e "s/bin\/ash/bin\/zsh/" /etc/passwd 10 | 11 | COPY benchmarks/timezsh / 12 | 13 | CMD "./timezsh" 14 | -------------------------------------------------------------------------------- /zsh/benchmarks/install_ohmyzsh: -------------------------------------------------------------------------------- 1 | #!/bin/zsh 2 | 3 | sh -c "$(wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)" 4 | -------------------------------------------------------------------------------- /zsh/benchmarks/install_prezto: -------------------------------------------------------------------------------- 1 | #!/bin/zsh 2 | 3 | git clone --recursive \ 4 | https://github.com/sorin-ionescu/prezto.git "${ZDOTDIR:-$HOME}/.zprezto" 5 | 6 | setopt EXTENDED_GLOB 7 | for rcfile in "${ZDOTDIR:-$HOME}"/.zprezto/runcoms/^README.md(.N); do 8 | ln -s "$rcfile" "${ZDOTDIR:-$HOME}/.${rcfile:t}" 9 | done 10 | -------------------------------------------------------------------------------- /zsh/benchmarks/timezsh: -------------------------------------------------------------------------------- 1 | #!/bin/zsh 2 | 3 | for i in $(seq 1 10) 4 | do 5 | time /bin/zsh -i -c exit 6 | done 7 | -------------------------------------------------------------------------------- /zsh/bindkeys: -------------------------------------------------------------------------------- 1 | # vim: ft=zsh 2 | 3 | autoload -Uz edit-command-line 4 | zle -N edit-command-line 5 | bindkey "^x^e" edit-command-line 6 | 7 | bindkey "^p" history-beginning-search-backward 8 | bindkey "^n" history-beginning-search-forward 9 | -------------------------------------------------------------------------------- /zsh/cdpath: -------------------------------------------------------------------------------- 1 | # vim: ft=zsh 2 | 3 | setopt autocd 4 | setopt autopushd 5 | 6 | if [ -d "$HOME/src" ]; then 7 | CDPATH=.:$HOME:$HOME/src 8 | CDPATH=$CDPATH:$HOME/src/go/src 9 | 10 | for dir in $(ls -d $HOME/src/*); do 11 | CDPATH=$CDPATH:$dir 12 | done 13 | fi 14 | 15 | CDPATH=$CDPATH:$HOME/.local/share/nvim/site/pack/packer/opt 16 | CDPATH=$CDPATH:$HOME/.local/share/nvim/site/pack/packer/start 17 | 18 | CDPATH=$CDPATH:$HOME/dotfiles/vim/pack/packup/opt 19 | CDPATH=$CDPATH:$HOME/dotfiles/vim/pack/packup/start 20 | 21 | export CDPATH 22 | -------------------------------------------------------------------------------- /zsh/compinit: -------------------------------------------------------------------------------- 1 | # vim: ft=zsh 2 | 3 | autoload -Uz compinit 4 | setopt extendedglob 5 | for dump in $HOME/.zcompdump(#qN.m1); do 6 | compinit 7 | if [[ -s "$dump" && (! -s "$dump.zwc" || "$dump" -nt "$dump.zwc") ]]; then 8 | zcompile "$dump" 9 | fi 10 | done 11 | unsetopt extendedglob 12 | compinit -C 13 | -------------------------------------------------------------------------------- /zsh/funcs: -------------------------------------------------------------------------------- 1 | # vim: ft=zsh 2 | 3 | relink() { 4 | src="$1" 5 | dst="$2" 6 | 7 | rm -rf "$dst" 8 | 9 | dir=$(dirname "$dst") 10 | [[ ! -d "$dir" ]] && mkdir -p "$dir" 11 | 12 | ln -s "$src" "$dst" 13 | } 14 | 15 | mkdcd () { 16 | [[ -n "$1" ]] && mkdir -p "$1" && builtin cd "$1" 17 | } 18 | 19 | slit () { 20 | awk "{ print ${(j:,:):-\$${^@}} }" 21 | } 22 | 23 | tssh () { 24 | ssh $1 -t 'tmux has-session && tmux attach -t dhruva || tmux new -s dhruva' 25 | } 26 | 27 | go-cover () { 28 | t="/tmp/go-cover.$$.tmp" 29 | go test -coverprofile=$t $@ && go tool cover -html=$t && unlink $t 30 | } 31 | 32 | timezsh() { 33 | shell=${1-$SHELL} 34 | for i in $(seq 1 10); do time $shell -i -c exit; done 35 | } 36 | 37 | profzsh() { 38 | shell=${1-$SHELL} 39 | ZPROF=true $shell -i -c exit 40 | } 41 | 42 | timevim() { 43 | for i in $(seq 1 10); do /usr/bin/time vim +qa; done 44 | } 45 | 46 | mac-cam() { 47 | ffplay -f avfoundation -framerate 30 -i "0" -fflags nobuffer -noborder -left 1120 -top 660 48 | } 49 | 50 | sloc () { 51 | git ls-files | grep "$1" | grep -v grep | xargs wc -l 52 | } 53 | 54 | docker-dev () { 55 | port="$1" 56 | project=${PWD##*/} 57 | if [ -z "$port" ]; then 58 | docker run -dt -v $PWD:/opt/projects --name $project debian:10 bash 59 | else 60 | docker run -dt -v $PWD:/opt/projects -p $port:$port --name $project debian:10 bash 61 | fi 62 | } 63 | 64 | # asdf () { 65 | # echo "ASDF not loaded! Loading now..." 66 | # unset -f asdf 67 | # if [ -d "$HOME/.asdf" ]; then 68 | # autoload -Uz bashcompinit 69 | # bashcompinit 70 | # . "$HOME/.asdf/asdf.sh" 71 | # . "$HOME/.asdf/completions/asdf.bash" 72 | # asdf "$@" 73 | # fi 74 | # } 75 | 76 | lcflow () { 77 | period=${1-"this month"} 78 | ledger --current --invert --real --wide -s -X $ -S "amount" -p "$period" reg income expenses 79 | } 80 | 81 | calc () { 82 | echo "$@" | bc -l 83 | } 84 | 85 | rmd () { 86 | pandoc $1 | lynx -stdin 87 | } 88 | 89 | stream() { 90 | streamlink --player mpv --player-args '--ontop' $1 best 91 | } 92 | 93 | kubectl() { 94 | if ! type __start_kubectl >/dev/null 2>&1; then 95 | source <(command kubectl completion zsh) 96 | fi 97 | 98 | command kubectl "$@" 99 | } 100 | -------------------------------------------------------------------------------- /zsh/hist: -------------------------------------------------------------------------------- 1 | # vim: ft=zsh 2 | 3 | SAVEHIST=1000 4 | HISTSIZE=5000 5 | HISTFILE=$HOME/.zhistory 6 | setopt extended_history # record timestamp of command in HISTFILE 7 | setopt hist_expire_dups_first # delete duplicates first when HISTFILE size exceeds HISTSIZE 8 | setopt hist_ignore_dups # ignore duplicated commands history list 9 | setopt hist_ignore_space # ignore commands that start with space 10 | setopt hist_verify # show command with history expansion to user before running it 11 | setopt inc_append_history # add commands to HISTFILE in order of execution 12 | setopt share_history # share command history data 13 | -------------------------------------------------------------------------------- /zsh/paths: -------------------------------------------------------------------------------- 1 | # vim: ft=zsh 2 | 3 | if [ -d "$HOME/Android/Sdk" ]; then 4 | PATH=$ANDROID_SDK_HOME/emulator:$PATH 5 | PATH=$ANDROID_SDK_HOME/platform-tools:$PATH 6 | fi 7 | 8 | platform=$(uname | awk '{print tolower($0)}') 9 | if [[ "$platform" == "darwin" ]]; then 10 | PATH=${HOMEBREW_PREFIX}/opt/gnu-sed/libexec/gnubin:$PATH 11 | # PATH=${HOMEBREW_PREFIX}/opt/coreutils/libexec/gnubin:$PATH 12 | PATH=${HOMEBREW_PREFIX}/opt/llvm/bin:$PATH 13 | 14 | MANPATH=${HOMEBREW_PREFIX}/opt/coreutils/libexec/gnuman:$MANPATH 15 | fi 16 | 17 | if [ -d "$HOME/.ghcup" ]; then 18 | source $HOME/.ghcup/env 19 | PATH=$HOME/.ghcup/bin:$PATH 20 | fi 21 | 22 | PATH=${HOMEBREW_PREFIX}/bin:${HOMEBREW_PREFIX}/sbin:$PATH 23 | PATH=$HOME/dotfiles/bin:$PATH 24 | PATH=$HOME/bin:$PATH 25 | 26 | [ -d "$HOME/.local/bin" ] && PATH=$HOME/.local/bin:$PATH 27 | 28 | [ -d "/opt/homebrew/opt/python@3.12" ] && PATH=/opt/homebrew/opt/python3/libexec/bin:$PATH 29 | 30 | export JAVA_HOME=$(/usr/libexec/java_home -v 8) 31 | 32 | export PATH 33 | export MANPATH 34 | -------------------------------------------------------------------------------- /zsh/plugin/dirsh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # GistID: 87c59acf3b53cf1911bc6e3a8055afbf 4 | 5 | _call_func () { 6 | declare -f -F "$1" && $1 7 | } 8 | 9 | typeset -A _dirsh_cache 10 | _dirsh_hook () { 11 | [ ${_dirsh_cache["$PWD"]} ] && [ ${_dirsh_cache["$PWD"]} = 1 ] && return 12 | if [ "$OLDPWD" != "$HOME" ] && [ -f "$OLDPWD/.zshrc" ]; then 13 | echo "dirsh: unloading" 14 | source "$OLDPWD/.zshrc" &>/dev/null 15 | _call_func "_unload" &>/dev/null 16 | unset -f _load 17 | unset -f _unload 18 | _dirsh_cache["$OLDPWD"]=0 19 | fi 20 | if [ "$PWD" != "$HOME" ] && [ -f "$PWD/.zshrc" ]; then 21 | echo "dirsh: loading .zshrc" 22 | source "$PWD/.zshrc" &>/dev/null 23 | _call_func "_load" &>/dev/null 24 | _dirsh_cache["$PWD"]=1 25 | fi 26 | } 27 | typeset -ag precmd_functions; 28 | if [[ -z ${precmd_functions[_dirsh_hook]} ]]; then 29 | precmd_functions+=_dirsh_hook 30 | fi 31 | -------------------------------------------------------------------------------- /zsh/pristine_prompt: -------------------------------------------------------------------------------- 1 | # vim: ft=zsh 2 | 3 | asdf-current-info() { 4 | if [ ! $+commands[asdf] ]; then 5 | return 6 | fi 7 | asdf current 2>&1 | awk '{print substr($1,1,2)":"$2","}' | tr '\n' ' ' | sed 's/,\s$/\n/' 8 | } 9 | 10 | git-change-summary() { 11 | if ! command git rev-parse 2>/dev/null; then 12 | return 13 | fi 14 | changes=$(git status --porcelain | head -1 2>/dev/null) 15 | if [ -n "$changes" ]; then 16 | if [ "${changes:0:1}" = "?" ]; then 17 | echo " %F{cyan}?%f" 18 | else 19 | echo " %F{red}✗%f" 20 | fi 21 | else 22 | echo " %F{green}✔%f" 23 | fi 24 | } 25 | 26 | git-info() { 27 | if ! command git rev-parse 2> /dev/null; then 28 | return 29 | fi 30 | ref=$(command git symbolic-ref HEAD 2>/dev/null) 31 | if [ -n "$ref" ]; then 32 | echo " on %F{magenta}${ref#refs/heads/}%f$(git-change-summary)" 33 | fi 34 | 35 | } 36 | 37 | setopt PROMPT_SUBST 38 | PROMPT='%F{blue}%n%f@%F{blue}%M%f in %F{green}%~%f$(git-info) 39 | %F{yellow}λ%f ' 40 | # RPROMPT='%F{red}$(asdf-current-info)' 41 | -------------------------------------------------------------------------------- /zsh/zshrc: -------------------------------------------------------------------------------- 1 | if [[ "$ZPROF" = true ]]; then 2 | zmodload zsh/zprof 3 | fi 4 | 5 | stty -ixon 6 | 7 | . ~/dotfiles/zsh/compinit 8 | 9 | bindkey -e 10 | 11 | export LC_ALL="en_US.UTF-8" 12 | export LANG="en_US.UTF-8" 13 | 14 | export EDITOR='vim' 15 | export VISUAL='vim' 16 | export TERMINAL='alacritty' 17 | export BROWSER='qutebrowser' 18 | 19 | # TERM with at least 256 colors (24 bit on supported terminals) 20 | # export TERM=alacritty 21 | export TERM=wezterm 22 | 23 | export REVIEW_BASE=master 24 | 25 | # Add cabal bins to PATH 26 | if [ -d ~/.cabal/bin ]; then 27 | export PATH=$HOME/.cabal/bin:$PATH 28 | fi 29 | 30 | # cassandra 31 | if [ -d "$HOME/cassandra" ]; then 32 | export CASSANDRA_HOME=~/cassandra 33 | export PATH=$CASSANDRA_HOME/bin:$PATH 34 | fi 35 | 36 | platform=$(uname | awk '{print tolower($0)}') 37 | if [[ "$platform" == "darwin" ]]; then 38 | ulimit -n 1024 39 | export ANDROID_HOME=$HOME/Library/Android/sdk 40 | export PATH=$PATH:$ANDROID_HOME/emulator 41 | export PATH=$PATH:$ANDROID_HOME/tools 42 | export PATH=$PATH:$ANDROID_HOME/tools/bin 43 | export PATH=$PATH:$ANDROID_HOME/platform-tools 44 | elif [ -d "$HOME/Android/Sdk" ]; then 45 | export ANDROID_SDK_HOME="$HOME/Android/Sdk" 46 | fi 47 | 48 | # The next line updates PATH for the Google Cloud SDK. 49 | if [ -f '/usr/local/Caskroom/google-cloud-sdk/latest/path.zsh.inc' ]; then 50 | source '/usr/local/Caskroom/google-cloud-sdk/latest/path.zsh.inc' 51 | fi 52 | 53 | # The next line enables shell command completion for gcloud. 54 | if [ -f '/usr/local/Caskroom/google-cloud-sdk/latest/completion.zsh.inc' ]; then 55 | source '/usr/local/Caskroom/google-cloud-sdk/latest/completion.zsh.inc' 56 | fi 57 | 58 | if [ -d "$HOME/.asdf" ]; then 59 | autoload -Uz bashcompinit 60 | bashcompinit 61 | . "$HOME/.asdf/asdf.sh" 62 | . "$HOME/.asdf/completions/asdf.bash" 63 | fi 64 | 65 | # go lang 66 | if [ $+commands[go] ]; then 67 | export GOBIN=$HOME/src/go/bin 68 | export GOPATH=$HOME/src/go 69 | export PATH=$GOBIN:/usr/local/go/bin:$PATH 70 | fi 71 | 72 | # rust lang 73 | if [ $+commands[cargo] ]; then 74 | export CARGO_PATH=$HOME/.cargo 75 | export CARGO_INSTALL_ROOT=$CARGO_PATH 76 | export PATH=$CARGO_PATH/bin:$PATH 77 | fi 78 | 79 | if [ -d "$HOME/Library/Preferences/org.dystroy.broot" ]; then 80 | source "$HOME/Library/Preferences/org.dystroy.broot/launcher/bash/br" 81 | fi 82 | 83 | # Setup history 84 | . ~/dotfiles/zsh/hist 85 | 86 | # Setup PATH 87 | . ~/dotfiles/zsh/paths 88 | 89 | # Setup zsh styles 90 | . ~/dotfiles/zsh/zstyles 91 | 92 | # Setup CDPATH for directory completion 93 | . ~/dotfiles/zsh/cdpath 94 | 95 | # Setup Prompt 96 | . ~/dotfiles/zsh/pristine_prompt 97 | 98 | # Setup functions 99 | . ~/dotfiles/zsh/funcs 100 | 101 | # Setup aliases 102 | . ~/dotfiles/zsh/aliases 103 | 104 | # Setup bindkeys 105 | . ~/dotfiles/zsh/bindkeys 106 | 107 | for f (~/dotfiles/zsh/plugin/*) source $f 108 | 109 | if [[ "$ZPROF" = true ]]; then 110 | zprof 111 | fi 112 | -------------------------------------------------------------------------------- /zsh/zstyles: -------------------------------------------------------------------------------- 1 | # vim: ft=zsh 2 | 3 | zstyle ':completion:*' menu select 4 | 5 | zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS} 6 | 7 | zstyle ':completion:*' verbose yes 8 | zstyle ':completion:*:descriptions' format "$fg[yellow]%B--- %d%b" 9 | zstyle ':completion:*:messages' format '%d' 10 | zstyle ':completion:*:warnings' format "$fg[red]No matches for:$reset_color %d" 11 | zstyle ':completion:*:corrections' format '%B%d (errors: %e)%b' 12 | zstyle ':completion:*' group-name '' 13 | --------------------------------------------------------------------------------