aboutsummaryrefslogtreecommitdiff
path: root/Scripts/.config
diff options
context:
space:
mode:
authorKumar Damani <damani.kumar@gmail.com>2019-04-26 18:25:11 +0000
committerKumar Damani <damani.kumar@gmail.com>2019-04-26 18:25:11 +0000
commita13339e0e99118870498ecfdea22292c7e267eb2 (patch)
tree127c8a7b88ca6b5eddc7ec567122ec129c72799a /Scripts/.config
dotfiles with stow structure
Diffstat (limited to 'Scripts/.config')
-rwxr-xr-xScripts/.config/Scripts/audio_alsa.sh24
-rwxr-xr-xScripts/.config/Scripts/clear.sh1
-rwxr-xr-xScripts/.config/Scripts/compiler39
-rwxr-xr-xScripts/.config/Scripts/configs12
-rwxr-xr-xScripts/.config/Scripts/decrypt.sh3
-rwxr-xr-xScripts/.config/Scripts/dmenuunicode18
-rwxr-xr-xScripts/.config/Scripts/drives1
-rwxr-xr-xScripts/.config/Scripts/extract.sh24
-rwxr-xr-xScripts/.config/Scripts/flash_win.sh13
-rwxr-xr-xScripts/.config/Scripts/folders6
-rwxr-xr-xScripts/.config/Scripts/get_email.sh13
-rwxr-xr-xScripts/.config/Scripts/getbib15
-rwxr-xr-xScripts/.config/Scripts/launch_polybar.sh20
-rwxr-xr-xScripts/.config/Scripts/lock.sh8
-rwxr-xr-xScripts/.config/Scripts/mount.sh19
-rwxr-xr-xScripts/.config/Scripts/opout11
-rwxr-xr-xScripts/.config/Scripts/scratch7
-rwxr-xr-xScripts/.config/Scripts/screen.sh24
-rwxr-xr-xScripts/.config/Scripts/screencast.sh7
-rwxr-xr-xScripts/.config/Scripts/screencast_alsa.sh28
-rwxr-xr-xScripts/.config/Scripts/screencast_pulse.sh27
-rwxr-xr-xScripts/.config/Scripts/shortcuts.py23
-rwxr-xr-xScripts/.config/Scripts/tmux_connect.sh9
-rwxr-xr-xScripts/.config/Scripts/unmount.sh2
-rwxr-xr-xScripts/.config/Scripts/vimrc165
25 files changed, 519 insertions, 0 deletions
diff --git a/Scripts/.config/Scripts/audio_alsa.sh b/Scripts/.config/Scripts/audio_alsa.sh
new file mode 100755
index 0000000..6d31fa7
--- /dev/null
+++ b/Scripts/.config/Scripts/audio_alsa.sh
@@ -0,0 +1,24 @@
+#!/bin/bash
+
+#This is the ffmpeg command that the screencast shortcut in i3 will run.
+
+#Picks a file name for the output file based on availability:
+
+if [[ -f ~/output.flac ]]
+ then
+ n=1
+ while [[ -f $HOME/output_$n.flac ]]
+ do
+ n=$((n+1))
+ done
+ filename="$HOME/output_$n.flac"
+ else
+ filename="$HOME/output.flac"
+fi
+
+#The actual ffmpeg command:
+
+ffmpeg -y \
+ -f alsa -ar 44100 -i hw:1 \
+ $filename
+
diff --git a/Scripts/.config/Scripts/clear.sh b/Scripts/.config/Scripts/clear.sh
new file mode 100755
index 0000000..af13a73
--- /dev/null
+++ b/Scripts/.config/Scripts/clear.sh
@@ -0,0 +1 @@
+find . -maxdepth 1 -regextype gnu-awk -regex "^.*\.(pyc|p yo|bak|swp|aux|log|lof|nav|out|snm|toc|bcf|run\.xml|synctex\.gz|blg|bbl)" -delete
diff --git a/Scripts/.config/Scripts/compiler b/Scripts/.config/Scripts/compiler
new file mode 100755
index 0000000..a9aad9b
--- /dev/null
+++ b/Scripts/.config/Scripts/compiler
@@ -0,0 +1,39 @@
+#!/bin/sh
+# This script will compile or run another finishing operation on a document. I
+# have this script run via vim.
+#
+# Compiles .tex. groff (.mom, .ms), .rmd, .md.
+# Opens .sent files as sent presentations.
+# Runs scripts based on extention or shebang
+
+file=$(readlink -f "$1")
+dir=$(dirname "$file")
+base="${file%.*}"
+
+cd "$dir" || exit
+
+# bibtex "$base" &&
+textype() { \
+ command="pdflatex"
+ ( sed 5q "$file" | grep -i -q 'xelatex' ) && command="xelatex"
+ $command --output-directory="$dir" "$base" &&
+ grep -i addbibresource "$file" >/dev/null &&
+ biber --input-directory "$dir" "$base" &&
+ $command --output-directory="$dir" "$base" &&
+ $command --output-directory="$dir" "$base"
+ }
+
+case "$file" in
+ *\.ms) refer -PS -e "$file" | groff -me -ms -kejpt -T pdf > "$base".pdf ;;
+ *\.mom) refer -PS -e "$file" | groff -mom -kejpt -T pdf > "$base".pdf ;;
+ *\.rmd) echo "require(rmarkdown); render('$file')" | R -q --vanilla ;;
+ *\.tex) textype "$file" ;;
+ *\.md) pandoc "$file" --pdf-engine=xelatex -o "$base".pdf ;;
+ *config.h) sudo make install ;;
+ *\.c) cc "$file" -o "$base" && "$base" ;;
+ *\.py) python "$file" ;;
+ *\.go) go run "$file" ;;
+ *\.sent) setsid sent "$file" 2>/dev/null & ;;
+ *) sed 1q "$file" | grep "^#!/" | sed "s/^#!//" | xargs -r -I % "$file" ;;
+esac
+
diff --git a/Scripts/.config/Scripts/configs b/Scripts/.config/Scripts/configs
new file mode 100755
index 0000000..7455ba0
--- /dev/null
+++ b/Scripts/.config/Scripts/configs
@@ -0,0 +1,12 @@
+cfb ~/.bashrc
+cfv ~/.config/Scripts/vimrc
+cfr ~/.config/vifm/vifmrc
+cfi ~/.config/i3/config
+cfm ~/.config/mutt/muttrc
+cff ~/.config/Scripts/folders
+cfc ~/.config/Scripts/configs
+cfT ~/.config/Scripts/tmux.conf
+cfa ~/.config/mutt/aliases
+cfp ~/.config/polybar/mybar
+cfs ~/.config/sxhkd/sxhkdrc
+cfB ~/.config/bspwm/bspwmrc
diff --git a/Scripts/.config/Scripts/decrypt.sh b/Scripts/.config/Scripts/decrypt.sh
new file mode 100755
index 0000000..c3a1c37
--- /dev/null
+++ b/Scripts/.config/Scripts/decrypt.sh
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+qpdf --password="$1" --decrypt "$2" "$3"
diff --git a/Scripts/.config/Scripts/dmenuunicode b/Scripts/.config/Scripts/dmenuunicode
new file mode 100755
index 0000000..0d34dad
--- /dev/null
+++ b/Scripts/.config/Scripts/dmenuunicode
@@ -0,0 +1,18 @@
+#!/bin/sh
+# Give dmenu list of all unicode characters to copy.
+# Shows the selected character in dunst if running.
+
+# Must have xclip installed to even show menu.
+xclip -h >/dev/null || exit
+
+chosen=$(grep -v "#" ~/.emoji | rofi -dmenu -i -lines 10)
+
+[ "$chosen" != "" ] || exit
+
+c=$(echo "$chosen" | sed "s/ .*//")
+echo "$c" | tr -d '\n' | xclip -selection clipboard
+notify-send "'$c' copied to clipboard." &
+
+s=$(echo "$chosen" | sed "s/.*; //" | awk '{print $1}')
+echo "$s" | tr -d '\n' | xclip
+notify-send "'$s' copied to primary." &
diff --git a/Scripts/.config/Scripts/drives b/Scripts/.config/Scripts/drives
new file mode 100755
index 0000000..3d898eb
--- /dev/null
+++ b/Scripts/.config/Scripts/drives
@@ -0,0 +1 @@
+newvol E580-18FF
diff --git a/Scripts/.config/Scripts/extract.sh b/Scripts/.config/Scripts/extract.sh
new file mode 100755
index 0000000..5b70a65
--- /dev/null
+++ b/Scripts/.config/Scripts/extract.sh
@@ -0,0 +1,24 @@
+if [ -f $1 ] ; then
+ # NAME=${1%.*}
+ # mkdir $NAME && cd $NAME
+ case $1 in
+ *.tar.bz2) tar xvjf ../$1 ;;
+ *.tar.gz) tar xvzf ../$1 ;;
+ *.tar.xz) tar xvJf ../$1 ;;
+ *.lzma) unlzma ../$1 ;;
+ *.bz2) bunzip2 ../$1 ;;
+ *.rar) unrar x -ad ../$1 ;;
+ *.gz) gunzip ../$1 ;;
+ *.tar) tar xvf ../$1 ;;
+ *.tbz2) tar xvjf ../$1 ;;
+ *.tgz) tar xvzf ../$1 ;;
+ *.zip) unzip ../$1 ;;
+ *.Z) uncompress ../$1 ;;
+ *.7z) 7z x ../$1 ;;
+ *.xz) unxz ../$1 ;;
+ *.exe) cabextract ../$1 ;;
+ *) echo "extract: '$1' - unknown archive method" ;;
+ esac
+else
+echo "$1 - file does not exist"
+ fi
diff --git a/Scripts/.config/Scripts/flash_win.sh b/Scripts/.config/Scripts/flash_win.sh
new file mode 100755
index 0000000..0bccca7
--- /dev/null
+++ b/Scripts/.config/Scripts/flash_win.sh
@@ -0,0 +1,13 @@
+#!/bin/bash
+
+#Flashes the active window.
+
+#Requires transset-df and a composite manager, like xcompmgr.
+
+transset-df -a -m 0
+sleep .1
+transset-df -a -x 1
+sleep .1
+transset-df -a -m 0
+sleep .1
+transset-df -a -x 1
diff --git a/Scripts/.config/Scripts/folders b/Scripts/.config/Scripts/folders
new file mode 100755
index 0000000..4452f45
--- /dev/null
+++ b/Scripts/.config/Scripts/folders
@@ -0,0 +1,6 @@
+h ~
+d ~/Documents
+D ~/Downloads
+s ~/.config/Scripts
+c ~/Dropbox/winter2019
+w ~/Downloads/wallpapers
diff --git a/Scripts/.config/Scripts/get_email.sh b/Scripts/.config/Scripts/get_email.sh
new file mode 100755
index 0000000..8807fd3
--- /dev/null
+++ b/Scripts/.config/Scripts/get_email.sh
@@ -0,0 +1,13 @@
+#!/usr/bin/env bash
+
+adddate() {
+ while IFS= read -r line; do
+ echo "$(date) $line"
+ done
+}
+
+#(date && offlineimap -o) >> ~/.offlineimap/email.log 2>&1
+# notify
+notify-send "Fetching Email..."
+#log
+(echo "============`date`============`offlineimap -o`") >> ~/.offlineimap/email.log 2>&1
diff --git a/Scripts/.config/Scripts/getbib b/Scripts/.config/Scripts/getbib
new file mode 100755
index 0000000..920357c
--- /dev/null
+++ b/Scripts/.config/Scripts/getbib
@@ -0,0 +1,15 @@
+#!/bin/sh
+[ -z "$1" ] && echo "Give either a pdf file or a DOI as an argument." && exit
+
+if [ -f "$1" ]; then
+ # Try to get DOI from pdfinfo or pdftotext output.
+ doi=$(pdfinfo "$1" | grep -io "doi:.*") ||
+ doi=$(pdftotext "$1" 2>/dev/null - | grep -io "doi:.*" -m 1) ||
+ exit 1
+else
+ doi="$1"
+fi
+
+# Check crossref.org for the bib citation.
+curl -s "http://api.crossref.org/works/$doi/transform/application/x-bibtex" -w "\\n"
+
diff --git a/Scripts/.config/Scripts/launch_polybar.sh b/Scripts/.config/Scripts/launch_polybar.sh
new file mode 100755
index 0000000..9ef7345
--- /dev/null
+++ b/Scripts/.config/Scripts/launch_polybar.sh
@@ -0,0 +1,20 @@
+#!/bin/bash
+#!/usr/bin/env sh
+
+# Terminate already running bar instances
+killall -q polybar
+
+# Wait until the processes have been shut down
+while pgrep -x polybar >/dev/null; do sleep 1; done
+
+# Launch in all monitors
+MONS=$(polybar -m | sed -e 's/:.*$//g')
+for MON in ${MONS[@]}
+do
+ #echo $MON
+ MONITOR=$MON polybar mybar -q -c ~/.config/polybar/mybar &
+ echo $MONITOR
+ #polybar example
+done
+
+echo "Bar launched..."
diff --git a/Scripts/.config/Scripts/lock.sh b/Scripts/.config/Scripts/lock.sh
new file mode 100755
index 0000000..b812302
--- /dev/null
+++ b/Scripts/.config/Scripts/lock.sh
@@ -0,0 +1,8 @@
+#!/bin/bash
+scrot /tmp/screen.png
+#convert /tmp/screen.png -scale 10% -scale 1000% /tmp/screen.png
+#convert /tmp/screen.png -paint 3 -modulate 80 /tmp/screen.png
+convert /tmp/screen.png -paint 3 /tmp/screen.png
+[[ -f ~/.config/$1/lock.png ]] && convert /tmp/screen.png ~/.config/$1/lock.png -gravity center -composite -matte /tmp/screen.png
+mocp -P
+i3lock -u -e -i /tmp/screen.png
diff --git a/Scripts/.config/Scripts/mount.sh b/Scripts/.config/Scripts/mount.sh
new file mode 100755
index 0000000..6937fa7
--- /dev/null
+++ b/Scripts/.config/Scripts/mount.sh
@@ -0,0 +1,19 @@
+#!/bin/bash
+
+for d in /dev/mmcblk*
+do
+
+while IFS=$'\t' read -r col1 col2
+do
+ if [[ $(blkid -o value -s UUID $d) == ${col2} ]]
+ then
+ #sudo mkdir /mnt/${col1}
+ #sudo mount -t vfat -o uid=kdam0,gid=users,fmask=113,dmask=002 $d /mnt/${col1}
+ echo $d
+ sudo mount -t vfat -o uid=kdam0 $d /mnt/${col1}
+ #sudo mount -t vfat $d /mnt/${col1}
+ fi
+done < /home/kdam0/.config/Scripts/drives
+
+done
+
diff --git a/Scripts/.config/Scripts/opout b/Scripts/.config/Scripts/opout
new file mode 100755
index 0000000..1517a67
--- /dev/null
+++ b/Scripts/.config/Scripts/opout
@@ -0,0 +1,11 @@
+#!/bin/sh
+# opout: "open output": A general handler for opening a file's intended output.
+# I find this useful especially running from vim.
+
+basename="${1%.*}"
+echo $basename
+
+case "$1" in
+ *.tex|*.md|*.rmd|*.ms|*.me|*.mom) setsid zathura "$basename".pdf >/dev/null 2>&1 & ;;
+ *.html) setsid "$BROWSER" --new-window "$basename".html >/dev/null 2>&1 & ;;
+esac
diff --git a/Scripts/.config/Scripts/scratch b/Scripts/.config/Scripts/scratch
new file mode 100755
index 0000000..a632a00
--- /dev/null
+++ b/Scripts/.config/Scripts/scratch
@@ -0,0 +1,7 @@
+#!/usr/bin/env bash
+id=$(xdotool search --class $1)
+
+if [ "$id" != "" ]
+ then
+ bspc node "$id" --flag hidden -f
+fi
diff --git a/Scripts/.config/Scripts/screen.sh b/Scripts/.config/Scripts/screen.sh
new file mode 100755
index 0000000..85edb46
--- /dev/null
+++ b/Scripts/.config/Scripts/screen.sh
@@ -0,0 +1,24 @@
+#!/bin/bash
+
+#Feed this script either:
+# "l" for laptop screen only,
+# "v" for vga screen only,
+# or "d" for dual vga/laptop.
+
+d() { if [[ $(xrandr -q | grep VGA-1\ con) ]]
+ then param $1
+ else echo "No VGA input detected."
+ fi ;}
+dual() { xrandr --output LVDS-1 --primary --auto --output VGA-1 --auto --left-of LVDS-1 ;}
+laptop() { xrandr --output LVDS-1 --primary --auto --output VGA-1 --off ;}
+vga() { xrandr --output VGA-1 --auto --output LVDS-1 --off ;}
+#mirror() { xrandr --addmode VGA1 $lapres && xrandr --output LVDS1 --mode $lapres --output VGA1 --mode $lapres ;}
+
+param() {
+case $1 in
+ d) dual ;;
+ v) vga ;;
+ l) laptop ;;
+ *) echo -e "Invalid parameter. Add one of the following:\n\"d\" for dualscreen laptop and VGA.\n\"l\" for laptop only\n\"v\" for VGA only." ;;
+esac ;}
+d $1
diff --git a/Scripts/.config/Scripts/screencast.sh b/Scripts/.config/Scripts/screencast.sh
new file mode 100755
index 0000000..59183c3
--- /dev/null
+++ b/Scripts/.config/Scripts/screencast.sh
@@ -0,0 +1,7 @@
+#! /bin/bash
+
+# record screen using this
+ffmpeg -video_size 1920x1080 -framerate 25 -f x11grab -i :0.0 output.mp4
+
+# merge audo using this
+#ffmpeg -i output.mp4 -itsoffset 0.0 -i aud2.m4a -codec copy -shortest output2.mp4
diff --git a/Scripts/.config/Scripts/screencast_alsa.sh b/Scripts/.config/Scripts/screencast_alsa.sh
new file mode 100755
index 0000000..d234689
--- /dev/null
+++ b/Scripts/.config/Scripts/screencast_alsa.sh
@@ -0,0 +1,28 @@
+#!/bin/bash
+
+#This is the ffmpeg command that the screencast shortcut in i3 will run.
+
+#Picks a file name for the output file based on availability:
+
+if [[ -f ~/output.mkv ]]
+ then
+ n=1
+ while [[ -f $HOME/output_$n.mkv ]]
+ do
+ n=$((n+1))
+ done
+ filename="$HOME/output_$n.mkv"
+ else
+ filename="$HOME/output.mkv"
+fi
+
+#The actual ffmpeg command:
+
+ffmpeg -y \
+-f x11grab \
+-s $(xdpyinfo | grep dimensions | awk '{print $2;}') \
+-i :0.0 \
+-thread_queue_size 1024 \
+ -f alsa -ar 44100 -i hw:1 \
+ -c:v libx264 -r 30 -c:a flac $filename
+ #-c:v ffvhuff -r 30 -c:a flac $filename
diff --git a/Scripts/.config/Scripts/screencast_pulse.sh b/Scripts/.config/Scripts/screencast_pulse.sh
new file mode 100755
index 0000000..4befd85
--- /dev/null
+++ b/Scripts/.config/Scripts/screencast_pulse.sh
@@ -0,0 +1,27 @@
+#!/bin/bash
+
+#This is the ffmpeg command that the screencast shortcut in i3 will run.
+
+#Picks a file name for the output file based on availability:
+
+if [[ -f ~/output.mkv ]]
+ then
+ n=1
+ while [[ -f $HOME/output_$n.mkv ]]
+ do
+ n=$((n+1))
+ done
+ filename="$HOME/output_$n.mkv"
+ else
+ filename="$HOME/output.mkv"
+fi
+
+#The actual ffmpeg command:
+
+ffmpeg -y \
+-f x11grab \
+-s $(xdpyinfo | grep dimensions | awk '{print $2;}') \
+-i :0.0 \
+ -f pulse -ac 1 -ar 44100 -i alsa_input.usb-Blue_Microphones_Yeti_Stereo_Microphone_REV8-00.analog-stereo \
+ -c:v libx264 -r 30 -c:a flac $filename
+ #-c:v ffvhuff -r 30 -c:a flac $filename
diff --git a/Scripts/.config/Scripts/shortcuts.py b/Scripts/.config/Scripts/shortcuts.py
new file mode 100755
index 0000000..24d6592
--- /dev/null
+++ b/Scripts/.config/Scripts/shortcuts.py
@@ -0,0 +1,23 @@
+import csv
+
+bash = ""
+
+with open("/home/kdam0/.bashrc") as bsh:
+ bash+=bsh.read()
+
+#First we open the list of folder shortcuts and go down each line adding each in the required syntax to each of the three configs:
+
+with open("/home/kdam0/.config/Scripts/folders") as fold:
+ for line in csv.reader(fold, dialect="excel-tab"):
+ #Adds the bash shortcuts:
+ bash+=("alias "+line[0]+"=\"cd "+line[1]+" && ls -a\"\n")
+
+#Goes thru the config file file and adds the shortcuts to both bash and ranger.
+
+with open("/home/kdam0/.config/Scripts/configs") as conf:
+ for line in csv.reader(conf, dialect="excel-tab"):
+ bash+=("alias "+line[0]+"=\"vim "+line[1]+"\"\n")
+
+
+with open("/home/kdam0/.bashrc","w") as outbash:
+ outbash.write(bash)
diff --git a/Scripts/.config/Scripts/tmux_connect.sh b/Scripts/.config/Scripts/tmux_connect.sh
new file mode 100755
index 0000000..d524c57
--- /dev/null
+++ b/Scripts/.config/Scripts/tmux_connect.sh
@@ -0,0 +1,9 @@
+#!/bin/bash
+
+# list existing tmux session in rofi
+sel=$(tmux ls -F '#S' | rofi -dmenu -p "pick a session")
+
+# if sel is empty, create new session
+
+# if sel not empty, attach to this session
+tmux attach -t $sel
diff --git a/Scripts/.config/Scripts/unmount.sh b/Scripts/.config/Scripts/unmount.sh
new file mode 100755
index 0000000..83b55dd
--- /dev/null
+++ b/Scripts/.config/Scripts/unmount.sh
@@ -0,0 +1,2 @@
+#!/bin/bash
+sudo umount /mnt/* 2> /dev/null
diff --git a/Scripts/.config/Scripts/vimrc b/Scripts/.config/Scripts/vimrc
new file mode 100755
index 0000000..45a4745
--- /dev/null
+++ b/Scripts/.config/Scripts/vimrc
@@ -0,0 +1,165 @@
+call plug#begin('~/.vim/plugged')
+ Plug 'junegunn/goyo.vim'
+ Plug '/usr/bin/fzf'
+ Plug 'junegunn/fzf.vim'
+ Plug 'itchyny/lightline.vim'
+ Plug 'dylanaraps/wal.vim'
+ Plug 'PotatoesMaster/i3-vim-syntax'
+ Plug 'LukeSmithxyz/vimling'
+ Plug 'vimwiki/vimwiki'
+ Plug 'scrooloose/nerdtree'
+ Plug 'digitaltoad/vim-pug'
+ Plug 'airblade/vim-gitgutter'
+call plug#end()
+
+" Some basics:
+ set nocompatible
+ filetype plugin on
+ syntax on
+ "colorscheme koehler
+ colorscheme wal
+ set encoding=utf-8
+ set number
+ " set relativenumber
+ let mapleader = ","
+
+" For saving view folds:
+ au BufWinLeave * mkview
+ " au BufWinEnter * silent loadview
+
+let g:vimwiki_ext2syntax = {'.Rmd': 'markdown', '.rmd': 'markdown','.md': 'markdown', '.markdown': 'markdown', '.mdown': 'markdown'} "Interpret .md files, etc. as .markdown
+
+" Spell-check set to F6:
+ map <F6> :setlocal spell! spelllang=en_ca<CR>
+
+
+" Goyo plugin makes text more readable when writing prose:
+ map <F10> :Goyo<CR>
+ inoremap <F10> <esc>:Goyo<CR>a
+
+
+" Enable Goyo by default for mutt writting
+ autocmd BufRead,BufNewFile /tmp/neomutt* let g:goyo_width=72
+ autocmd BufRead,BufNewFile /tmp/neomutt* :Goyo
+ " Goyo's width will be the line limit in mutt.
+
+" Enable autocompletion:
+ set wildmode=longest,list,full
+ set wildmenu
+
+" Automatically deletes all tralling whitespace on save.
+ autocmd BufWritePre * %s/\s\+$//e
+
+" When shortcut files are updated, renew bash and ranger configs with new
+" material:
+ autocmd BufWritePost ~/.config/Scripts/folders,~/.config/Scripts/configs !python ~/.config/Scripts/shortcuts.py
+
+" Runs a script that cleans out tex build files whenever I close out of a .tex file.
+ autocmd VimLeave *.tex !texclear
+
+"Copy selected text to system clipboard (requires gvim installed):
+ vnoremap <C-c> "+y
+
+" Disables automatic commenting on newline:
+ autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o
+
+" C-T for new tab
+ nnoremap <C-t> :tabnew<cr>
+
+" For normal mode when in terminals (in X I have caps mapped to esc, this replaces it when I don't have X)
+ inoremap jk <Esc>
+
+"Shortcutting split navigation, saving a keypress:
+ map <C-h> <C-w>h
+ map <C-j> <C-w>j
+ map <C-k> <C-w>k
+ map <C-l> <C-w>l
+
+" Splits open at the bottom and right, which is non-retarded, unlike vim defaults.
+ set splitbelow splitright
+
+"Replace all is aliased to S. Visual mode shortcut doesn't work yet for some
+"reason...
+ nnoremap S :%s//g<Left><Left>
+ vnoremap S noop
+ vnoremap S :s//g<Left><Left>
+
+ vnoremap K xkP`[V`]
+ vnoremap J xp`[V`]
+ vnoremap L >gv
+ vnoremap H <gv
+
+ nnoremap <Leader>n :bp<CR>
+ nnoremap <Leader>m :bn<CR>
+ nnoremap <Leader>w :bd<CR>
+
+ nmap <leader>, :w<cr>
+ set pastetoggle=<leader>v
+
+ map gn :bn<cr>
+ map gp :bp<cr>
+ map gd :bd<cr>
+
+" toggle line chars view
+ "set listchars=eol:¬,tab:>,trail:~,extends:>,precedes:<,space:␣
+ "set listchars=tab:│\ ,trail:·,extends:→
+ "set listchars=tab:»\ ,extends:›,precedes:‹,nbsp:·,trail:·
+ set listchars=tab:→\ ,eol:↲,nbsp:␣,trail:•,extends:⟩,precedes:⟨
+ noremap <Leader>l :set list!<CR>
+ set list
+
+" fzf hotkey
+ map <Leader>p :Files<CR>
+
+" lightline config
+ set noshowmode
+ set laststatus=2
+
+" colorscheme nord
+ let g:lightline = {
+ \ 'active': {
+ \ 'left': [['mode', 'paste' ], ['readonly', 'filename', 'modified']],
+ \ 'right': [['lineinfo'], ['percent'], ['fileformat', 'fileencoding']]
+ \ },
+ \ 'colorscheme': 'srcery_drk'
+ \ }
+
+" url from file
+ map <Leader>u :w<Home>silent <End> !urlscan<CR>
+
+" compile groff or tex docs
+ " map <Leader>c :! groff -ms -etpR % -Tps \| ps2pdf - %:r.pdf<cr>
+ map <leader>c :w! \| !compiler <c-r>%<CR><CR>
+
+" open pdfs html
+ map <leader>o :!opout <c-r>%<CR><CR>
+
+" open and edit the bib in a vsplit
+ map <leader>b :vsp<space>~/Dropbox/Latex/references.bib<CR>
+ map <leader>B :vsp<space>~/Dropbox/Latex/references.refer<CR>
+ " map <leader>r :vsp<space>$REFER<CR>
+
+" Navigating with guides
+ inoremap <Space><Tab> <Esc>/<++><Enter>"_c4l
+ vnoremap <Space><Tab> <Esc>/<++><Enter>"_c4l
+ map <Space><Tab> <Esc>/<++><Enter>"_c4l
+
+" Nerd tree
+ map <C-n> :NERDTreeToggle<CR>
+ autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
+
+" Git-gutter
+ set updatetime=100
+
+" Tab settings
+ set tabstop=4
+ set noexpandtab
+ autocmd Filetype css setlocal tabstop=2
+
+
+" Snippets
+ autocmd FileType bib inoremap ,a @article{<Enter>author<Space>=<Space>{<++>},<Enter>year<Space>=<Space>{<++>},<Enter>title<Space>=<Space>{<++>},<Enter>journal<Space>=<Space>{<++>},<Enter>volume<Space>=<Space>{<++>},<Enter>pages<Space>=<Space>{<++>},<Enter>}<Enter><++><Esc>8kA,<Esc>i
+ autocmd FileType bib inoremap ,b @book{<Enter>author<Space>=<Space>{<++>},<Enter>year<Space>=<Space>{<++>},<Enter>title<Space>=<Space>{<++>},<Enter>publisher<Space>=<Space>{<++>},<Enter>}<Enter><++><Esc>6kA,<Esc>i
+ autocmd FileType bib inoremap ,c @incollection{<Enter>author<Space>=<Space>{<++>},<Enter>title<Space>=<Space>{<++>},<Enter>booktitle<Space>=<Space>{<++>},<Enter>editor<Space>=<Space>{<++>},<Enter>year<Space>=<Space>{<++>},<Enter>publisher<Space>=<Space>{<++>},<Enter>}<Enter><++><Esc>8kA,<Esc>i
+ autocmd FileType bib inoremap ,o @online{<Enter>title<Space>=<Space>{<++>},<Enter>url<Space>=<Space>{<++>},<Enter>year<Space>=<Space>{<++>}<Enter>}<Enter><++><Esc>5kA,<Esc>i
+