Merge pull request #1 from LukeSmithxyz/master

Updates from original
This commit is contained in:
Ioannis Angelakopoulos 2019-01-06 16:27:10 +02:00 committed by GitHub
commit 5a8369755f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
31 changed files with 480 additions and 700 deletions

31
.bashrc
View File

@ -1,42 +1,33 @@
#!/bin/bash
# _ _
# | |__ __ _ ___| |__ _ __ ___
# | '_ \ / _` / __| '_ \| '__/ __|
# | |_) | (_| \__ \ | | | | | (__
# |_.__/ \__,_|___/_| |_|_| \___|
stty -ixon # Disable ctrl-s and ctrl-q.
shopt -s autocd #Allows you to cd into directory merely by typing the directory name.
HISTSIZE= HISTFILESIZE= # Infinite history.
export PS1="\[$(tput bold)\]\[$(tput setaf 1)\][\[$(tput setaf 3)\]\u\[$(tput setaf 2)\]@\[$(tput setaf 4)\]\h \[$(tput setaf 5)\]\W\[$(tput setaf 1)\]]\[$(tput setaf 7)\]\\$ \[$(tput sgr0)\]"
# Setting Bash prompt. Capitalizes username and host if root user (my root user uses this same config file).
if [ "$EUID" -ne 0 ]
then export PS1="\[$(tput bold)\]\[$(tput setaf 1)\][\[$(tput setaf 3)\]\u\[$(tput setaf 2)\]@\[$(tput setaf 4)\]\h \[$(tput setaf 5)\]\W\[$(tput setaf 1)\]]\[$(tput setaf 7)\]\\$ \[$(tput sgr0)\]"
else export PS1="\[$(tput bold)\]\[$(tput setaf 1)\][\[$(tput setaf 3)\]ROOT\[$(tput setaf 2)\]@\[$(tput setaf 4)\]$(hostname | awk '{print toupper($0)}') \[$(tput setaf 5)\]\W\[$(tput setaf 1)\]]\[$(tput setaf 7)\]\\$ \[$(tput sgr0)\]"
fi
export GPG_TTY=$(tty)
[ -f "$HOME/.shortcuts" ] && source "$HOME/.shortcuts" # Load shortcut aliases
# System Maintainence
alias mw="~/.config/mutt/mutt-wizard.sh"
alias muttwizard="~/.config/mutt/mutt-wizard.sh"
alias sdn="sudo shutdown now"
alias psref="gpg-connect-agent RELOADAGENT /bye" # Refresh gpg
alias gua="git remote | xargs -L1 git push --all"
# Some aliases
alias e="$EDITOR"
alias p="sudo pacman"
alias SS="sudo systemctl"
alias v="vim"
alias sv="sudo vim"
alias f="vifm"
alias r="ranger"
alias sr="sudo ranger"
alias ka="killall"
alias g="git"
alias trem="transmission-remote"
alias mkd="mkdir -pv"
alias ref="shortcuts && source ~/.bashrc" # Refresh shortcuts manually and reload bashrc
alias bw="wal -i ~/.config/wall.png" # Rerun pywal
alias ref="shortcuts >/dev/null ; source ~/.bashrc" # Refresh shortcuts manually and reload bashrc
alias mpv="mpv --input-ipc-server=/tmp/mpvsoc$(date +%s)"
alias x="sxiv -ft *"
alias lp="pacman -Qett --color=always | less"
# Adding color
alias ls='ls -hN --color=auto --group-directories-first'
@ -45,9 +36,11 @@ alias diff="diff --color=auto"
alias ccat="highlight --out-format=ansi" # Color cat - print file with syntax highlighting.
# Internet
alias yt="youtube-dl --add-metadata -ic" # Download video link
alias yt="youtube-dl --add-metadata -i" # Download video link
alias yta="yt -x -f bestaudio/best" # Download only audio
alias YT="youtube-viewer"
shdl() { curl -O $(curl -s http://sci-hub.tw/"$@" | grep location.href | grep -o http.*pdf) ;}
vf() { $EDITOR $(fzf) ;}
se() { du -a ~/.scripts/* ~/.config/* | awk '{print $2}' | fzf | xargs -r $EDITOR ;}
sv() { vcopy "$(du -a ~/.scripts/* ~/.config/* | awk '{print $2}' | fzf)" ;}
vf() { fzf | xargs -r -I % $EDITOR % ;}

View File

@ -14,7 +14,7 @@
# This config file will use environmental variables such as $BROWSER and $TERMINAL.
# You can set these variables in ~/.profile or ~/.bash_profile if you have it as below:
#
# export BROWSER="firefox"
# export FILE="ranger"
# export TERMINAL="st"
# #---Basic Definitions---# #
@ -32,21 +32,16 @@ set $hibernate sudo -A systemctl suspend
# #---Dropdown Windows---# #
# First I have a tmux window used for background scripts.
# I'll later bind this to mod+u.
for_window [instance="tmuxdd"] floating enable
for_window [instance="tmuxdd"] resize set 625 450
for_window [instance="tmuxdd"] move scratchpad
for_window [instance="tmuxdd"] border pixel 3
for_window [instance="tmuxdd"] sticky enable
# Then I have a window running R I use for basic arithmetic
# I'll later bind this to mod+a.
for_window [instance="dropdowncalc"] floating enable
for_window [instance="dropdowncalc"] resize set 800 300
for_window [instance="dropdowncalc"] move scratchpad
for_window [instance="dropdowncalc"] border pixel 2
for_window [instance="dropdowncalc"] sticky enable
# General dropdown window traits. The order can matter.
for_window [instance="dropdown_*"] floating enable
for_window [instance="dropdown_*"] move scratchpad
for_window [instance="dropdown_*"] sticky enable
for_window [instance="dropdown_*"] scratchpad show
for_window [instance="dropdown_tmuxdd"] resize set 625 450
for_window [instance="dropdown_dropdowncalc"] resize set 800 300
for_window [instance="dropdown_tmuxdd"] border pixel 3
for_window [instance="dropdown_dropdowncalc"] border pixel 2
for_window [instance="dropdown_*"] move position center
# #---Starting External Scripts---# #
# Setting the background:
@ -126,15 +121,15 @@ bindsym $mod+grave exec --no-startup-id dmenuunicode
##bindsym $mod+asciitilde
#STOP/HIDE EVERYTHING:
bindsym $mod+Shift+Delete exec --no-startup-id lmc truemute ; exec --no-startup-id lmc pause ; exec --no-startup-id pauseallmpv; workspace 0; exec $term -e htop ; exec $term -e ranger
bindsym $mod+Shift+Delete exec --no-startup-id lmc truemute ; exec --no-startup-id lmc pause ; exec --no-startup-id pauseallmpv; workspace 0; exec $term -e htop ; exec $term -e $FILE
# Show selection:
bindsym $mod+Insert exec --no-startup-id showclip
bindsym $mod+Pause exec --no-startup-id xcqr
# #---Letter Key Bindings---# #
bindsym $mod+q [con_id="__focused__" instance="^(?!dropdowncalc|tmuxdd).*$"] kill
bindsym $mod+Shift+q [con_id="__focused__" instance="^(?!dropdowncalc|tmuxdd).*$"] kill
bindsym $mod+q [con_id="__focused__" instance="^(?!dropdown_).*$"] kill
bindsym $mod+Shift+q [con_id="__focused__" instance="^(?!dropdown_).*$"] kill
bindsym $mod+w exec $term -e nmtui
bindsym $mod+Shift+w exec --no-startup-id $BROWSER
@ -328,8 +323,8 @@ bindsym $mod+bracketright exec --no-startup-id lmc forward 10
bindsym $mod+Shift+bracketright exec --no-startup-id lmc forward 120
# For screenshots and recording
bindsym Print exec --no-startup-id scrot
bindsym Shift+Print exec --no-startup-id scrot -u
bindsym Print exec --no-startup-id maim pic-full-"$(date '+%y%m%d-%H%M-%S').png"
bindsym Shift+Print exec --no-startup-id maimpick
bindsym $mod+Print exec --no-startup-id dmenurecord
bindsym $mod+Scroll_Lock exec --no-startup-id "killall screenkey || screenkey"
bindsym $mod+Delete exec $stoprec
@ -353,7 +348,7 @@ bindsym XF86PowerOff exec --no-startup-id prompt "Shutdown computer?" "$shutdow
bindsym XF86Calculator exec $term -e R -q --no-save
##bindsym XF86Sleep This binding is typically mapped by systemd automatically.
##bindsym XF86WakeUp exec
bindsym XF86Explorer exec $term -e ranger
bindsym XF86Explorer exec $term -e $FILE
##bindsym XF86Send exec
##bindsym XF86Xfer exec
bindsym XF86WWW exec --no-startup-id $BROWSER
@ -362,7 +357,7 @@ bindsym XF86ScreenSaver exec exec --no-startup-id lockscreen
##bindsym XF86RotateWindows exec
##bindsym XF86TaskPane exec
##bindsym XF86Favorites exec
bindsym XF86MyComputer exec $term -e ranger
bindsym XF86MyComputer exec $term -e $FILE
##bindsym XF86Back exec
##bindsym XF86Forward exec
bindsym XF86Eject exec --no-startup-id dmenuumount
@ -407,14 +402,16 @@ bindsym XF86Shop exec $BROWSER https://ebay.com
bindsym XF86MonBrightnessDown exec --no-startup-id xbacklight -dec 15
bindsym XF86MonBrightnessUp exec --no-startup-id xbacklight -inc 15
bindsym XF86AudioMedia exec --no-startup-id $term -e ncmpcpp
bindsym XF86Display exec --no-startup-id arandr
bindsym XF86Display exec --no-startup-id displayselect
#bindsym XF86KbdLightOnOff exec
#bindsym XF86KbdBrightnessDown exec
#bindsym XF86KbdBrightnessUp exec
##bindsym XF86Reply exec
##bindsym XF86MailForward exec
##bindsym XF86Save exec
bindsym XF86Documents exec $term -e ranger ~/Documents
bindsym XF86Documents exec $term -e $FILE ~/Documents
##bindsym XF86Battery exec
##bindsym XF86Bluetooth exec
bindsym XF86WLAN exec $netrefresh
exec --no-startup-id lukescripts

View File

@ -3,7 +3,7 @@ separator_block_width=15
markup=pango
[record]
command=cat ~/.recordingicon
command=cat /tmp/recordingicon
interval=once
signal=9
@ -28,6 +28,7 @@ signal=7
[weather]
interval=3600
signal=5
[mailbox]
label=📬

View File

@ -3,6 +3,6 @@ x-scheme-handler/magnet=transmission-remote.desktop;
x-scheme-handler/mailto=mutt.desktop;
text/plain=vim.desktop;
application/pdf=zathura.desktop;
image/png=feh.desktop;
image/jpeg=feh.desktop;
image/gif=gif.desktop;
image/png=sxiv.desktop;
image/jpeg=sxiv.desktop;
image/gif=sxiv.desktop;

216
.config/nvim/init.vim Normal file
View File

@ -0,0 +1,216 @@
" _
" __ _(_)_ __ ___ _ __ ___
" \ \ / / | '_ ` _ \| '__/ __|
" \ V /| | | | | | | | | (__
" \_/ |_|_| |_| |_|_| \___|
let mapleader =" "
call plug#begin('~/.vim/plugged')
Plug 'junegunn/goyo.vim'
Plug 'PotatoesMaster/i3-vim-syntax'
Plug 'jreybert/vimagit'
Plug 'LukeSmithxyz/vimling'
Plug 'vimwiki/vimwiki'
call plug#end()
" Some basics:
set nocompatible
filetype plugin on
syntax on
set encoding=utf-8
set number relativenumber
" Enable autocompletion:
set wildmode=longest,list,full
" Disables automatic commenting on newline:
autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o
" Goyo plugin makes text more readable when writing prose:
map <leader>f :Goyo \| set linebreak<CR>
" Spell-check set to <leader>o, 'o' for 'orthography':
map <leader>o :setlocal spell! spelllang=en_us<CR>
" Splits open at the bottom and right, which is non-retarded, unlike vim defaults.
set splitbelow splitright
" 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
" Check file in shellcheck:
map <leader>s :!clear && shellcheck %<CR>
" Open my bibliography file in split
map <leader>b :vsp<space>$BIB<CR>
map <leader>r :vsp<space>$REFER<CR>
" Replace all is aliased to S.
nnoremap S :%s//g<Left><Left>
" Compile document, be it groff/LaTeX/markdown/etc.
map <leader>c :w! \| !compiler <c-r>%<CR><CR>
" Open corresponding .pdf/.html or preview
map <leader>p :!opout <c-r>%<CR><CR>
" Runs a script that cleans out tex build files whenever I close out of a .tex file.
autocmd VimLeave *.tex !texclear %
" Ensure files are read as what I want:
let g:vimwiki_ext2syntax = {'.Rmd': 'markdown', '.rmd': 'markdown','.md': 'markdown', '.markdown': 'markdown', '.mdown': 'markdown'}
autocmd BufRead,BufNewFile /tmp/calcurse*,~/.calcurse/notes/* set filetype=markdown
autocmd BufRead,BufNewFile *.ms,*.me,*.mom,*.man set filetype=groff
autocmd BufRead,BufNewFile *.tex set filetype=tex
" Readmes autowrap text:
autocmd BufRead,BufNewFile *.md set tw=79
" Use urlscan to choose and open a url:
:noremap <leader>u :w<Home> !urlscan -r 'linkhandler {}'<CR>
:noremap ,, !urlscan -r 'linkhandler {}'<CR>
" Copy selected text to system clipboard (requires gvim/nvim/vim-x11 installed):
vnoremap <C-c> "+y
map <C-p> "+P
" Enable Goyo by default for mutt writting
" Goyo's width will be the line limit in mutt.
autocmd BufRead,BufNewFile /tmp/neomutt* let g:goyo_width=80
autocmd BufRead,BufNewFile /tmp/neomutt* :Goyo
" Automatically deletes all trailing whitespace on save.
autocmd BufWritePre * %s/\s\+$//e
" When shortcut files are updated, renew bash and ranger configs with new material:
autocmd BufWritePost ~/.bm* !shortcuts
" Run xrdb whenever Xdefaults or Xresources are updated.
autocmd BufWritePost ~/.Xresources,~/.Xdefaults !xrdb %
" Navigating with guides
inoremap <Space><Tab> <Esc>/<++><Enter>"_c4l
vnoremap <Space><Tab> <Esc>/<++><Enter>"_c4l
map <Space><Tab> <Esc>/<++><Enter>"_c4l
"____ _ _
"/ ___| _ __ (_)_ __ _ __ ___| |_ ___
"\___ \| '_ \| | '_ \| '_ \ / _ \ __/ __|
"___) | | | | | |_) | |_) | __/ |_\__ \
"|____/|_| |_|_| .__/| .__/ \___|\__|___/
"|_| |_|
"""LATEX
" Word count:
autocmd FileType tex map <leader><leader>o :w !detex \| wc -w<CR>
" Code snippets
autocmd FileType tex inoremap ,fr \begin{frame}<Enter>\frametitle{}<Enter><Enter><++><Enter><Enter>\end{frame}<Enter><Enter><++><Esc>6kf}i
autocmd FileType tex inoremap ,fi \begin{fitch}<Enter><Enter>\end{fitch}<Enter><Enter><++><Esc>3kA
autocmd FileType tex inoremap ,exe \begin{exe}<Enter>\ex<Space><Enter>\end{exe}<Enter><Enter><++><Esc>3kA
autocmd FileType tex inoremap ,em \emph{}<++><Esc>T{i
autocmd FileType tex inoremap ,bf \textbf{}<++><Esc>T{i
autocmd FileType tex vnoremap , <ESC>`<i\{<ESC>`>2la}<ESC>?\\{<Enter>a
autocmd FileType tex inoremap ,it \textit{}<++><Esc>T{i
autocmd FileType tex inoremap ,ct \textcite{}<++><Esc>T{i
autocmd FileType tex inoremap ,cp \parencite{}<++><Esc>T{i
autocmd FileType tex inoremap ,glos {\gll<Space><++><Space>\\<Enter><++><Space>\\<Enter>\trans{``<++>''}}<Esc>2k2bcw
autocmd FileType tex inoremap ,x \begin{xlist}<Enter>\ex<Space><Enter>\end{xlist}<Esc>kA<Space>
autocmd FileType tex inoremap ,ol \begin{enumerate}<Enter><Enter>\end{enumerate}<Enter><Enter><++><Esc>3kA\item<Space>
autocmd FileType tex inoremap ,ul \begin{itemize}<Enter><Enter>\end{itemize}<Enter><Enter><++><Esc>3kA\item<Space>
autocmd FileType tex inoremap ,li <Enter>\item<Space>
autocmd FileType tex inoremap ,ref \ref{}<Space><++><Esc>T{i
autocmd FileType tex inoremap ,tab \begin{tabular}<Enter><++><Enter>\end{tabular}<Enter><Enter><++><Esc>4kA{}<Esc>i
autocmd FileType tex inoremap ,ot \begin{tableau}<Enter>\inp{<++>}<Tab>\const{<++>}<Tab><++><Enter><++><Enter>\end{tableau}<Enter><Enter><++><Esc>5kA{}<Esc>i
autocmd FileType tex inoremap ,can \cand{}<Tab><++><Esc>T{i
autocmd FileType tex inoremap ,con \const{}<Tab><++><Esc>T{i
autocmd FileType tex inoremap ,v \vio{}<Tab><++><Esc>T{i
autocmd FileType tex inoremap ,a \href{}{<++>}<Space><++><Esc>2T{i
autocmd FileType tex inoremap ,sc \textsc{}<Space><++><Esc>T{i
autocmd FileType tex inoremap ,chap \chapter{}<Enter><Enter><++><Esc>2kf}i
autocmd FileType tex inoremap ,sec \section{}<Enter><Enter><++><Esc>2kf}i
autocmd FileType tex inoremap ,ssec \subsection{}<Enter><Enter><++><Esc>2kf}i
autocmd FileType tex inoremap ,sssec \subsubsection{}<Enter><Enter><++><Esc>2kf}i
autocmd FileType tex inoremap ,st <Esc>F{i*<Esc>f}i
autocmd FileType tex inoremap ,beg \begin{DELRN}<Enter><++><Enter>\end{DELRN}<Enter><Enter><++><Esc>4k0fR:MultipleCursorsFind<Space>DELRN<Enter>c
autocmd FileType tex inoremap ,up <Esc>/usepackage<Enter>o\usepackage{}<Esc>i
autocmd FileType tex nnoremap ,up /usepackage<Enter>o\usepackage{}<Esc>i
autocmd FileType tex inoremap ,tt \texttt{}<Space><++><Esc>T{i
autocmd FileType tex inoremap ,bt {\blindtext}
autocmd FileType tex inoremap ,nu $\varnothing$
autocmd FileType tex inoremap ,col \begin{columns}[T]<Enter>\begin{column}{.5\textwidth}<Enter><Enter>\end{column}<Enter>\begin{column}{.5\textwidth}<Enter><++><Enter>\end{column}<Enter>\end{columns}<Esc>5kA
autocmd FileType tex inoremap ,rn (\ref{})<++><Esc>F}i
"""HTML
autocmd FileType html inoremap ,b <b></b><Space><++><Esc>FbT>i
autocmd FileType html inoremap ,it <em></em><Space><++><Esc>FeT>i
autocmd FileType html inoremap ,1 <h1></h1><Enter><Enter><++><Esc>2kf<i
autocmd FileType html inoremap ,2 <h2></h2><Enter><Enter><++><Esc>2kf<i
autocmd FileType html inoremap ,3 <h3></h3><Enter><Enter><++><Esc>2kf<i
autocmd FileType html inoremap ,p <p></p><Enter><Enter><++><Esc>02kf>a
autocmd FileType html inoremap ,a <a<Space>href=""><++></a><Space><++><Esc>14hi
autocmd FileType html inoremap ,e <a<Space>target="_blank"<Space>href=""><++></a><Space><++><Esc>14hi
autocmd FileType html inoremap ,ul <ul><Enter><li></li><Enter></ul><Enter><Enter><++><Esc>03kf<i
autocmd FileType html inoremap ,li <Esc>o<li></li><Esc>F>a
autocmd FileType html inoremap ,ol <ol><Enter><li></li><Enter></ol><Enter><Enter><++><Esc>03kf<i
autocmd FileType html inoremap ,im <img src="" alt="<++>"><++><esc>Fcf"a
autocmd FileType html inoremap ,td <td></td><++><Esc>Fdcit
autocmd FileType html inoremap ,tr <tr></tr><Enter><++><Esc>kf<i
autocmd FileType html inoremap ,th <th></th><++><Esc>Fhcit
autocmd FileType html inoremap ,tab <table><Enter></table><Esc>O
autocmd FileType html inoremap ,gr <font color="green"></font><Esc>F>a
autocmd FileType html inoremap ,rd <font color="red"></font><Esc>F>a
autocmd FileType html inoremap ,yl <font color="yellow"></font><Esc>F>a
autocmd FileType html inoremap ,dt <dt></dt><Enter><dd><++></dd><Enter><++><esc>2kcit
autocmd FileType html inoremap ,dl <dl><Enter><Enter></dl><enter><enter><++><esc>3kcc
autocmd FileType html inoremap &<space> &amp;<space>
autocmd FileType html inoremap á &aacute;
autocmd FileType html inoremap é &eacute;
autocmd FileType html inoremap í &iacute;
autocmd FileType html inoremap ó &oacute;
autocmd FileType html inoremap ú &uacute;
autocmd FileType html inoremap ä &auml;
autocmd FileType html inoremap ë &euml;
autocmd FileType html inoremap ï &iuml;
autocmd FileType html inoremap ö &ouml;
autocmd FileType html inoremap ü &uuml;
autocmd FileType html inoremap ã &atilde;
autocmd FileType html inoremap &etilde;
autocmd FileType html inoremap ĩ &itilde;
autocmd FileType html inoremap õ &otilde;
autocmd FileType html inoremap ũ &utilde;
autocmd FileType html inoremap ñ &ntilde;
autocmd FileType html inoremap à &agrave;
autocmd FileType html inoremap è &egrave;
autocmd FileType html inoremap ì &igrave;
autocmd FileType html inoremap ò &ograve;
autocmd FileType html inoremap ù &ugrave;
""".bib
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
"MARKDOWN
autocmd Filetype markdown,rmd map <leader>w yiWi[<esc>Ea](<esc>pa)
autocmd Filetype markdown,rmd inoremap ,n ---<Enter><Enter>
autocmd Filetype markdown,rmd inoremap ,b ****<++><Esc>F*hi
autocmd Filetype markdown,rmd inoremap ,s ~~~~<++><Esc>F~hi
autocmd Filetype markdown,rmd inoremap ,e **<++><Esc>F*i
autocmd Filetype markdown,rmd inoremap ,h ====<Space><++><Esc>F=hi
autocmd Filetype markdown,rmd inoremap ,i ![](<++>)<++><Esc>F[a
autocmd Filetype markdown,rmd inoremap ,a [](<++>)<++><Esc>F[a
autocmd Filetype markdown,rmd inoremap ,1 #<Space><Enter><++><Esc>kA
autocmd Filetype markdown,rmd inoremap ,2 ##<Space><Enter><++><Esc>kA
autocmd Filetype markdown,rmd inoremap ,3 ###<Space><Enter><++><Esc>kA
autocmd Filetype markdown,rmd inoremap ,l --------<Enter>
autocmd Filetype rmd inoremap ,r ```{r}<CR>```<CR><CR><esc>2kO
autocmd Filetype rmd inoremap ,p ```{python}<CR>```<CR><CR><esc>2kO
autocmd Filetype rmd inoremap ,c ```<cr>```<cr><cr><esc>2kO
""".xml
autocmd FileType xml inoremap ,e <item><Enter><title><++></title><Enter><guid<space>isPermaLink="false"><++></guid><Enter><pubDate><Esc>:put<Space>=strftime('%a, %d %b %Y %H:%M:%S %z')<Enter>kJA</pubDate><Enter><link><++></link><Enter><description><![CDATA[<++>]]></description><Enter></item><Esc>?<title><enter>cit
autocmd FileType xml inoremap ,a <a href="<++>"><++></a><++><Esc>F"ci"

View File

@ -515,3 +515,6 @@ map Tn eval fm.open_console('shell eyeD3 -n "" ' + fm.thisfile.relative_path, po
#Downloading
map ytv console shell youtube-dl -ic%space
map yta console shell youtube-dl -xic%space
# Source shortcuts
source ~/.config/ranger/shortcuts.conf

View File

@ -101,6 +101,7 @@ ext s[wmf]c, has snes9x-gtk,X = snes9x-gtk "$1"
ext nes, has fceux, X = fceux "$1"
ext exe = wine "$1"
name ^[mM]akefile$ = make
ext asf, has mpv, X, flag f = mpv --input-ipc-server=/tmp/mpvsoc$(date +%s) -- "$@"
#--------------------------------------------
# Code
@ -117,9 +118,11 @@ ext php = php -- "$1"
#-------------------------------------------
mime ^video|audio, has gmplayer, X, flag f = gmplayer -- "$@"
mime ^video|audio, has smplayer, X, flag f = smplayer "$@"
mime ^video, has mpv, X, flag f = mpv -- "$@"
mime ^video, has mpv, X, flag f = mpv --fs -- "$@"
mime ^video, has mpv, X, flag f = mpv --loop -- "$@"
mime ^video, has mpv, X, flag f = mpv --input-ipc-server=/tmp/mpvsoc$(date +%s) -- "$@"
mime ^video, has mpv, X, flag f = mpv --input-ipc-server=/tmp/mpvsoc$(date +%s) --no-video -- "$@"
mime ^video, has mpv, X, flag f = mpv --input-ipc-server=/tmp/mpvsoc$(date +%s) --fs -- "$@"
mime ^video, has mpv, X, flag f = mpv --input-ipc-server=/tmp/mpvsoc$(date +%s) --loop -- "$@"
mime ^video, has mpv, X, flag f = mpv --input-ipc-server=/tmp/mpvsoc$(date +%s) --title="obs" --autofit=1050x700 -- "$@"
mime ^video, has mplayer2, X, flag f = mplayer2 -- "$@"
mime ^video, has mplayer2, X, flag f = mplayer2 -fs -- "$@"
mime ^video, has mplayer, X, flag f = mplayer -- "$@"
@ -132,16 +135,16 @@ mime ^video|audio, has totem, X, flag f = totem --fullscreen -- "$@"
#-------------------------------------------
mime ^audio|ogg$, terminal, has mplayer = mplayer -- "$@"
mime ^audio|ogg$, terminal, has mplayer2 = mplayer2 -- "$@"
mime ^audio|ogg$, terminal, has mpv = mpv --no-audio-display -- "$@"
mime ^audio|ogg$, terminal, has mpv = mpv --input-ipc-server=/tmp/mpvsoc$(date +%s) --no-audio-display -- "$@"
mime ^audio|ogg$ = tag "$@"
mime ^audio|ogg$, terminal, has mpv = mpv -- "$@"
mime ^audio|ogg$, terminal, has mpv = mpv --input-ipc-server=/tmp/mpvsoc$(date +%s) -- "$@"
ext midi?, terminal, has wildmidi = wildmidi -- "$@"
#--------------------------------------------
# Video without X:
#-------------------------------------------
mime ^video, terminal, !X, has mpv = mpv -- "$@"
mime ^video, terminal, !X, has mpv = mpv --input-ipc-server=/tmp/mpvsoc$(date +%s) -- "$@"
mime ^video, terminal, !X, has mplayer2 = mplayer2 -- "$@"
mime ^video, terminal, !X, has mplayer = mplayer -- "$@"
@ -164,6 +167,7 @@ ext pdf, has qpdfview, X, flag f = qpdfview "$@"
ext epub, has zathura, X, flag f = zathura -- "$@"
ext epub, has mupdf, X, flag f = mupdf "$@"
ext ps, has zathura, X, flag f = zathura -- "$@"
ext docx, has abiword, X, flag f = abiword "$@"
@ -184,14 +188,13 @@ ext djvu, has atril, X, flag f = atril -- "$@"
#-------------------------------------------
mime ^image/svg, has inkscape, X, flag f = inkscape -- "$@"
mime ^image/svg, has display, X, flag f = display -- "$@"
mime ^image/gif, has mpv, X, flag f = mpv --loop -- "$@"
mime ^image/gif, has viewnior, X, flag f = viewnior -- "$@"
mime ^image/gif, has qutebrowser, X, flag f = qutebrowser -- "$@"
ext xcf, X, flag f = gimp -- "$@"
mime ^image, has sxiv, X, flag f = sxiv -a -- "$@"
mime ^image, has feh, X, flag f = feh --scale-down --auto-zoom --image-bg black -- "$@"
mime ^image, has feh, X, flag f = feh --scale-down --auto-zoom -- "$@"
mime ^image, has sxiv, X, flag f = sxiv -- "$@"
mime ^image, has mirage, X, flag f = mirage -- "$@"
mime ^image, has ristretto, X, flag f = ristretto "$@"
mime ^image, has eog, X, flag f = eog -- "$@"
@ -225,8 +228,9 @@ label wallpaper, number 13, mime ^image, has feh, X = feh --bg-center "$1"
label wallpaper, number 14, mime ^image, has feh, X = feh --bg-fill "$1"
# Define the editor for non-text files + pager as last action
!mime ^text, !ext xml|json|csv|tex|py|pl|rb|js|sh|php = ask
label editor, !mime ^text, !ext xml|json|csv|tex|py|pl|rb|js|sh|php = $EDITOR -- "$@"
label pager, !mime ^text, !ext xml|json|csv|tex|py|pl|rb|js|sh|php = "$PAGER" -- "$@"
!mime ^text, !ext xml|json|csv|tex|py|pl|rb|js|sh|php|ms = ask
label editor, !mime ^text, !ext xml|json|csv|tex|py|pl|rb|js|sh|php|ms = $EDITOR -- "$@"
label pager, !mime ^text, !ext xml|json|csv|tex|py|pl|rb|js|sh|php|ms = "$PAGER" -- "$@"
ext blend, has blender, X, flag f = blender -- "$@"
ext ms = $EDITOR -- "$@"

View File

37
.config/sxiv/exec/key-handler Executable file
View File

@ -0,0 +1,37 @@
#!/bin/sh
while read file
do
fullpath="$(pwd)/$file"
case "$1" in
"w")
cp "$file" ~/.config/wall.png &&
feh --bg-scale "$HOME/.config/wall.png"
notify-send -i "$HOME/.config/wall.png" "Wallpaper changed." ;;
"c")
[ -z "$destdir" ] && destdir="$(sed "s/\s.*#.*$//;/^\s*$/d" ~/.bmdirs | awk '{print $2}' | dmenu -l 20 -i -p "Copy file(s) to where?" | sed "s|~|$HOME|g")"
[ -z "$destdir" ] && exit
cp "$file" "$destdir" && notify-send -i "$fullpath" "$file copied to $destdir." &
;;
"m")
[ -z "$destdir" ] && destdir="$(sed "s/\s.*#.*$//;/^\s*$/d" ~/.bmdirs | awk '{print $2}' | dmenu -l 20 -i -p "Move file(s) to where?" | sed "s|~|$HOME|g")"
[ -z "$destdir" ] && exit
cp "$file" "$destdir" && notify-send -i "$fullpath" "$file moved to $destdir." &
;;
"r")
convert -rotate 90 "$file" "$file" ;;
"R")
convert -rotate -90 "$file" "$file" ;;
"f")
convert -flop "$file" "$file" ;;
"y")
echo -n "$file" | xclip -selection clipboard &&
notify-send "$file copied to clipboard" & ;;
"Y")
echo -n "$fullpath" | xclip -selection clipboard &&
notify-send "$fullpath copied to clipboard" & ;;
"d")
[ "$(printf "No\\nYes" | dmenu -i -p "Really delete $file?")" = "Yes" ] && rm "$file" && notify-send "$file deleted." ;;
"G")
gimp "$file" & ;;
esac
done

View File

@ -0,0 +1,4 @@
[Desktop Entry]
Type=Application
Name=feh image viewer
Exec=/usr/bin/sxiv -a %u

View File

@ -2,16 +2,16 @@
# Profile file. Runs on login.
# Adds `~/.scripts` and all subdirectories to $PATH
export PATH="$(du "$HOME/.scripts/" | cut -f2 | tr '\n' ':')$PATH"
export PATH="$PATH:$(du "$HOME/.scripts/" | cut -f2 | tr '\n' ':')"
export EDITOR="vim"
export TERMINAL="st"
export BROWSER="firefox"
export READER="zathura"
export FILE="ranger"
export BIB="$HOME/Documents/LaTeX/uni.bib"
export REFER="$HOME/.referbib"
# PIX is here I have LARBS keep icons. Subject to change, hence a variable.
export PIX="$HOME/.scripts/pix"
export SUDO_ASKPASS="$HOME/.scripts/tools/dmenupass"
export PIX="$HOME/.pix/"
# less/man colors
export LESS=-R
@ -25,10 +25,10 @@ export LESS_TERMCAP_ue=$'\E[0m' # reset underline
[ ! -f ~/.shortcuts ] && shortcuts >/dev/null 2>&1
[ -f ~/.bashrc ] && source "$HOME/.bashrc"
echo "$0" | grep "bash$" >/dev/null && [ -f ~/.bashrc ] && source "$HOME/.bashrc"
# Start graphical server if i3 not already running.
[ "$(tty)" = "/dev/tty1" ] && ! pgrep -x i3 >/dev/null && exec startx
# Switch escape and caps and use wal colors if tty:
# Switch escape and caps if tty:
sudo -n loadkeys ~/.scripts/ttymaps.kmap 2>/dev/null

View File

@ -12,292 +12,76 @@ export PATH="$(du $HOME/.scripts/ | cut -f2 | tr '\n' ':')$PATH"
For modules used in i3blocks.
### `i3battery`
i3blocks module. Shows available power remaining with icon indicating battery
status. Colors indicate different levels of charge.
### `i3mail`
i3blocks module for use with mutt-wizard. Shows unread mail and if
`mailsync.sh` is running.
### `i3mpd`
i3blocks module. Shows current song; if paused, name will be grayed and italic.
### `i3mpdupdate`
A daemon running by default that will update the i3mpd block on mpd change.
### `i3pacman`
i3blocks module. Detects new installable upgrades. Only works if you use
cronjobs to automatically sync repositories.
### `i3torrent`
i3blocks module. Shows torrents idle (⌛️), downloading (⬇️) or
finished (🌱).
### `i3volume`
i3blocks module. Shows volume percentage or mute notification.
### `i3weather`
i3blocks module. Gets weather forcast from wttr.in and returns today's
precipitation chance (☔), daily low (❄️) and daily high (☀️).
### `i3wifi`
A modified version of the i3blocks wifi module. Clicked, it brings up wifi-menu
and also appears when there is no wifi connection.
### `popupdate`
Called by clicking on the update icon if there are new packages. Spawns a `yay`
upgrade of the main Arch repos and AUR packages, updates the i3blocks module
once complete.
### `popweather`
The script called by clicking on the i3 weather module. Brings up the forecast
from `http://wttr.in` and will close on <Enter>.
- `battery` -- i3blocks module. Shows available power remaining with icon indicating battery status. Colors indicate different levels of charge.
- `clock` -- Shows time and date. If clicked, brings up calender or coming calcuse events.
- `cpu` -- Shows CPU temperature. If clicked, shows most processor-intensive processes.
- `help` -- Module which appears as a question mark. Brings up readme if clicked.
- `internet` -- Shows whether machine is connected to wifi and ethernet. If clicked, brings up `nmtui`.
- `mailbox` -- i3blocks module for use with mutt-wizard. Shows unread mail and if `mailsync.sh` is running.
- `mem` -- Shows memory usage. If clicked, shows most memory-intensive processes.
- `music` -- i3blocks module. Shows current song; if paused, name will be grayed and italic.
- `mpdupdate` -- A daemon running by default that will update the i3mpd block on mpd change.
- `news` -- Shows unread newsboat articles. Brings up newsboat or refreshes RSS feeds.
- `pacpackages` -- i3blocks module. Detects new installable upgrades. Only works if you use cronjobs to automatically sync repositories.
- `popupgrade` -- Called by clicking on the update icon if there are new packages. Spawns a `yay` upgrade of the main Arch repos and AUR packages, updates the i3blocks module once complete.
- `torrent` -- i3blocks module. Shows torrents idle (⌛️), downloading (⬇️) or finished (🌱).
- `volume` -- i3blocks module. Shows volume percentage or mute notification.
- `weather` -- i3blocks module. Gets weather forcast from wttr.in and returns today's precipitation chance (☔), daily low (❄️) and daily high (☀️).
## `cron/`
For scripts meant to be cronjobs. None are active by default on LARBS.
### `checkup`
If connected to internet, syncs package repositories and downloads (but does
not install) any potential updates. Gives `notify-send` notifications of when
it is active since other `pacman` install commands cannot be run
simultaneously.
You may need to grant your user the ability to run `pacman -Syyuw --noconfirm`
without a password (done in `/etc/sudoers`).
### `cronbat`
Gives a dunst notification if the battery is less than 25%.
### `crontog`
Not actually a cronjob, but just turns off/on all user cronjobs.
### `newsup`
Updates newsboat RSS feeds if connected to internet. Will also display a
newspaper update icon on i3blocks if it has not be user disabled.
- `checkup` -- If connected to internet, syncs package repositories and downloads (but does not install) any potential updates. Gives `notify-send` notifications of when it is active since other `pacman` install commands cannot be run simultaneously. You may need to grant your user the ability to run `pacman -Syyuw --noconfirm` without a password (done in `/etc/sudoers`).
- `cronbat` -- Gives a dunst notification if the battery is less than 25%.
- `crontog` -- Not actually a cronjob, but just turns off/on all user cronjobs.
- `getforecast` -- Updates the weather forecast. This is automatically run by `weather` if there hasn't been a new forecast today.
- `newsup` -- Updates newsboat RSS feeds if connected to internet. Will also display a newspaper update icon on i3blocks if it has not be user disabled.
## `tools/`
Scripts intended to be run either manually by the user or linked to a shortcut
in vim or another program.
### `compiler`
Compiles a markdown, R markdown or LaTeX document with the approriate command.
Will also run `make && sudo make install` if in a `config.h` file. Otherwise
it will create a sent presentation. This can be thought of a general output
handler. I have it bound to `<leader>c` in vim.
### `dmenuhandler`
Give this script a url and it will offer dmenu options for opening it. Used by
`newsboat` and some other programs as a link handler.
### `extract`
Will detect file type of archive and run appropriate extraction command.
### `getbib`
Use crossref.org to automatically detect bibtex entry of a .pdf. Attempts to
search for the .pdf's DOI. Returns nothing if none detected.
### `getkeys`
Get the LARBS documentation on what bindings exist for main programs.
### `linkhandler`
The automatic link handler used by `newsboat` and other programs. Urls of video
sites or of video files are opened in `mpv`, images are downloaded/opened in
`feh`, music files are downloaded with `wget` and all other urls are opened in
the default browser.
### `lmc`
A music controller that simplifies music/audio management and improves the
interface with i3blocks. Check inside to see what it does. This is what i3
audio/music commands run by default. If you use a difference music system or
ALSA, you can change this script rather than changing all the shortcuts in
different places.
### `note`
Give this script some text/a message as an argument. It will print it to the
terminal, and if `dunst` is running, display a notification.
### `opout`
"Open output", opens the corresponding `.pdf` file if run on a `.md`, `.tex` or
`.rmd` file, or if given an `.html` file, will open it in the browser. Bound
to `<leader>p` in my vim config to reveal typical output.
### `pauseallmpv`
Pauses all mpv instances by sending the `,` key to each. Used by several
scripts, but can be used alone as well. It will not pause an audio only mpv
instance. If you know how to add a hack to do this, feel free to PR it or email
me an addition.
### `remaps`
Remaps capslock to escape when pressed and super/mod when held. Maps the menu
key to super as well. Runs the US international keyboard setup. If you want
another keyboard setup, edit this fine.
### `shortcuts`
For updating bash and ranger shortcuts. Reads `~/.key_directories` and
`~/.key_files` for pairs of keypresses and directories and files, then
autoproduces bash aliases and ranger shortcuts for them which output to
`~/.shortcuts` and `~/.config/ranger/shortcuts.conf` respectively. These are
read automatically by my bash and ranger configs. You don't have to run this
script manually though, as it's run by vim whenever you edit one of the
`~/.key_*` files.
### `speedvid`
Speed up a given video file (`$1`) by a given ammount (`$2`).
### `tpb`
Search Pirate Bay for the certain search terms given as arguments.
### `texclear`
Remove all `.tex` related build files. This is run by my vim when I stop
editing any `.tex` file.
### `transadd`
The mimeapp default script for handling torrent magnet links. Starts
`transmission-daemon` if not running and adds the link.
- `compiler` -- Compiles a markdown, R markdown or LaTeX document with the approriate command. Will also run `make && sudo make install` if in a `config.h` file. Otherwise it will create a sent presentation. This can be thought of a general output handler. I have it bound to `<leader>c` in vim.
- `dmenuhandler` -- Give this script a url and it will offer dmenu options for opening it. Used by `newsboat` and some other programs as a link handler.
- `extract` -- Will detect file type of archive and run appropriate extraction command.
- `getbib` -- Use crossref.org to automatically detect bibtex entry of a .pdf. Attempts to search for the .pdf's DOI. Returns nothing if none detected.
- `getkeys` -- Get the LARBS documentation on what bindings exist for main programs.
- `linkhandler` -- The automatic link handler used by `newsboat` and other programs. Urls of video sites or of video files are opened in `mpv`, images are downloaded/opened in `feh`, music files are downloaded with `wget` and all other urls are opened in the default browser.
- `lmc` -- A music controller that simplifies music/audio management and improves the interface with i3blocks. Check inside to see what it does. This is what i3 audio/music commands run by default. If you use a difference music system or ALSA, you can change this script rather than changing all the shortcuts in different places.
- `note` -- Give this script some text/a message as an argument. It will print it to the terminal, and if `dunst` is running, display a notification.
- `opout` -- "Open output", opens the corresponding `.pdf` file if run on a `.md`, `.tex` or `.rmd` file, or if given an `.html` file, will open it in the browser. Bound to `<leader>p` in my vim config to reveal typical output.
- `pauseallmpv` -- Pauses all mpv instances by sending the `,` key to each. Used by several scripts, but can be used alone as well. It will not pause an audio only mpv instance. If you know how to add a hack to do this, feel free to PR it or email me an addition.
- `remaps` -- Remaps capslock to escape when pressed and super/mod when held. Maps the menu key to super as well. Runs the US international keyboard setup. If you want another keyboard setup, edit this fine.
- `shortcuts` -- For updating bash and ranger shortcuts. Reads `~/.key_directories` and `~/.key_files` for pairs of keypresses and directories and files, then autoproduces bash aliases and ranger shortcuts for them which output to `~/.shortcuts` and `~/.config/ranger/shortcuts.conf` respectively. These are read automatically by my bash and ranger configs. You don't have to run this script manually though, as it's run by vim whenever you edit one of the `~/.key_*` files.
- `speedvid` -- Speed up a given video file (`$1`) by a given ammount (`$2`).
- `tpb` -- Search Pirate Bay for the certain search terms given as arguments.
- `texclear` -- Remove all `.tex` related build files. This is run by my vim when I stop editing any `.tex` file.
- `transadd` -- The mimeapp default script for handling torrent magnet links. Starts `transmission-daemon` if not running and adds the link.
## `i3cmds`
These are scripts linked to bindings in i3. They typically perform
user-interface actions or involve dmenu.
### `bottomleft` and `bottomright`
Makes the currently selected window float in one of the bottom corners of the
screen. `bottomleft` is bound to `mod+B` by default.
### `camtoggle`
Starts/kills /dev/video0 webcam. Placed in bottom right by default.
### `ddspawn`
This is the script called to create, show and hide the dropdown tmux terminal
mapped to `mod+u`, but also the dropdown calculator mapped to `mod+a`. Give the
script an argument that is a script the window will run. If a window does not
already exist, `ddspawn` creates it, if it does, `ddspawn` will toggle its
visibility. The the script itself for usage.
### `displayselect`
Select which displays to use. Bound to `mod+F3`.
### `dmenumount`
Gives a dmenu prompt for mounting USB drives or Android devices. Bound to
`mod+F9`. Will do nothing if none are available.
### `dmenurecord`
Gives a list of recording commands: `audio`, `video` and `screencast` (both) in
dmenu for selection. Bound to `mod+Print Screen` by default. Should be kill by
`killrecording`.
### `dmenuumount`
Unmount a mounted non-essential partition. Bound to `mod+F10`. Will do nothing
if none are mounted. It will not try to unmount essential system partitions.
### `dmenuunicode`
Shows a searchable dmenu prompt of emoji characters. The selected emoji is
copied to the system clipboard, while its character code is copied to primary
selection (middle mouse button).
### `dropdowncalc`
The dropdown calculator script called by `ddspawn` and bound to `mod+a` by
default. Will run an R calculator if installed, otherwise python.
### `ducksearch`
Show a dmenu prompt and search for the inputed text in DuckDuckGo. Can take
bangtags as expected, i.e. typing in `!aw Arch Linux` will search the Arch Wiki
for "Arch Linux" or `!yt Luke Smith` will search YouTube for "Luke Smith", etc.
### `i3resize`
A script that allows intuitive resizing of windows. Mapped to `mod+Y/U/I/O`.
### `killrecording`
End a recording started by `dmenurecord` the proper way without file trucation
or lingering background processes, mapped to `mod+Delete` by default.
### `lockscreen`
The screen locker. Gives a confirm prompt and if user says yes, all audio will
be paused and the screen will be distorted and locked and screen will soon time
out. User must insert password to unlock. Mapped to `mod+x` by default.
### `newspod`
A silly line that has a script all to itself due to i3's idiosyncracies. Starts
`newsboat`, if `newsboat` cannot open because of another instance being open,
opens `podboat`.
### `prompt`
Gives a Yes/No prompt to a question given as an argument. Used by numerous
bindings like `mod+shift+x`, `mod+shift+backspace` and `mod+shift+escape`.
### `samedir`
Opens a terminal window in the same directory as the window currently
selection. Bound to `mod+shift+enter`.
### `td-toggle`
Gives a dmenu prompt to start `transmission-daemon` if not running, or the kill
it if it is. Obviously you need `transmission-cli` installed for this to work.
Mapped to `mod+F7` by default.
### `tmuxdd`
The startup script for the dropdown terminal (toggleable with `mod+u`). Either
attaches to an existing tmux session or begins a new one.
### `toggletouchpad`
As the name suggests, turns off TouchPad if on, and turns it on if off.
Requires `xf86-input-synaptics`. If your laptop has a special button for this,
it will be mapped by default.
### `tutorialvids`
A dmenu prompt that gives some options of tutorial videos to watch. Bound to
`mod+shift+e`.
- `bottomleft` and `bottomright` -- Makes the currently selected window float in one of the bottom corners of the screen. `bottomleft` is bound to `mod+B` by default.
- `camtoggle` -- Starts/kills /dev/video0 webcam. Placed in bottom right by default.
- `ddspawn` -- This is the script called to create, show and hide the dropdown tmux terminal mapped to `mod+u`, but also the dropdown calculator mapped to `mod+a`. Give the script an argument that is a script the window will run. If a window does not already exist, `ddspawn` creates it, if it does, `ddspawn` will toggle its visibility. The the script itself for usage.
- `displayselect` -- Select which displays to use. Bound to `mod+F3`.
- `dmenumount` -- Gives a dmenu prompt for mounting USB drives or Android devices. Bound to `mod+F9`. Will do nothing if none are available.
- `dmenurecord` -- Gives a list of recording commands: `audio`, `video` and `screencast` (both) in dmenu for selection. Bound to `mod+PrintScreen` by default. Should be killed by `killrecording`.
- `dmenuumount` -- Unmount a mounted non-essential partition. Bound to `mod+F10`. Will do nothing if none are mounted. It will not try to unmount essential system partitions.
- `dmenuunicode` -- Shows a searchable dmenu prompt of emoji characters. The selected emoji is copied to the system clipboard, while its character code is copied to primary selection (middle mouse button).
- `dropdowncalc` -- The dropdown calculator script called by `ddspawn` and bound to `mod+a` by default. Will run an R calculator if installed, otherwise python.
- `ducksearch` -- Show a dmenu prompt and search for the inputed text in DuckDuckGo. Can take bangtags as expected, i.e. typing in `!aw Arch Linux` will search the Arch Wiki for "Arch Linux" or `!yt Luke Smith` will search YouTube for "Luke Smith", etc.
- `i3resize` -- A script that allows intuitive resizing of windows. Mapped to `mod+Y/U/I/O`.
- `killrecording` -- End a recording started by `dmenurecord` the proper way without file trucation or lingering background processes, mapped to `mod+Delete` by default.
- `lockscreen` -- The screen locker. Gives a confirm prompt and if user says yes, all audio will be paused and the screen will be distorted and locked and screen will soon time out. User must insert password to unlock. Mapped to `mod+x` by default.
- `newspod` -- A silly line that has a script all to itself due to i3's idiosyncracies. Starts `newsboat`, if `newsboat` cannot open because of another instance being open, opens `podboat`.
- `prompt` -- Gives a Yes/No prompt to a question given as an argument. Used by numerous bindings like `mod+shift+x`, `mod+shift+backspace` and `mod+shift+escape`.
- `samedir` -- Opens a terminal window in the same directory as the window currently selection. Bound to `mod+shift+enter`.
- `td-toggle` -- Gives a dmenu prompt to start `transmission-daemon` if not running, or the kill it if it is. Obviously you need `transmission-cli` installed for this to work. Mapped to `mod+F7` by default.
- `tmuxdd` -- The startup script for the dropdown terminal (toggleable with `mod+u`). Either attaches to an existing tmux session or begins a new one.
- `toggletouchpad` -- As the name suggests, turns off TouchPad if on, and turns it on if off. Requires `xf86-input-synaptics`. If your laptop has a special button for this, it will be mapped by default.
- `tutorialvids` -- A dmenu prompt that gives some options of tutorial videos to watch. Bound to `mod+shift+e`.

View File

@ -3,16 +3,16 @@
ping -q -w 1 -c 1 `ip r | grep -m 1 default | cut -d ' ' -f 3` >/dev/null || exit
note "Checking for pacakge updates..." "$PIX/larbs.gif"
notify-send -i "$PIX/larbs.gif" "Checking for pacakge updates..."
sudo pacman -Syyuw --noconfirm || note "Error downloading updates.
sudo pacman -Syyuw --noconfirm || notify-send "Error downloading updates.
Check your internet connection, if pacman is already running, or run update manually to see errors."
pkill -RTMIN+8 i3blocks
if pacman -Qul
if pacman -Qu | grep -v "\[ignored\]"
then
note "Package updates available. Click statusbar icon for update." "$PIX/larbs.gif"
notify-send -i "$PIX/larbs.gif" "Package updates available. Click statusbar icon (📦) for update."
else
note "Repository sync complete. No new packages for update." "$PIX/larbs.gif"
notify-send -i "$PIX/larbs.gif" "Repository sync complete. No new packages for update."
fi

View File

@ -2,5 +2,5 @@
# Updates weather forecast
ping -q -w 1 -c 1 "$(ip r | grep default | tail -1 | cut -d ' ' -f 3)" >/dev/null || exit
location="$1"; [ -z "$location" ] || location="$location+"
curl -s "wttr.in/$location" > ~/.weatherreport
curl -s "wttr.in/$location" > /tmp/weatherreport
pkill -RTMIN+5 i3blocks && notify-send "🌞 Weather forecast updated."

View File

@ -8,9 +8,9 @@ current=$(xdotool getwindowfocus)
newwidth=$(($(xdotool getdisplaygeometry | awk '{print $2}') / 3))
newheight=$(($(xdotool getdisplaygeometry | awk '{print $1}') / 3))
xdotool windowsize "$(xdotool getwindowfocus)" $newheight $newwidth
xdotool windowsize "$current" $newheight $newwidth
newsize=$(xdotool getwindowgeometry "$(xdotool getwindowfocus)" | grep Geometry | sed -e 's/x/ /g' | awk '{print $3}')
newsize=$(xdotool getwindowgeometry "$current" | grep Geometry | sed -e 's/x/ /g' | awk '{print $3}')
height=$(($(xdotool getdisplaygeometry | awk '{print $2}') - newsize))
xdotool windowmove "$current" 0 $height

View File

@ -8,10 +8,10 @@ current=$(xdotool getwindowfocus)
newwidth=$(($(xdotool getdisplaygeometry | awk '{print $2}') / 3))
newheight=$(($(xdotool getdisplaygeometry | awk '{print $1}') / 3))
xdotool windowsize "$(xdotool getwindowfocus)" $newheight $newwidth
xdotool windowsize "$current" $newheight $newwidth
newsize=$(xdotool getwindowgeometry "$(xdotool getwindowfocus)" | grep Geometry | sed -e 's/x/ /g' | awk '{print $3}')
newwidth=$(xdotool getwindowgeometry "$(xdotool getwindowfocus)" | grep Geometry | grep -o " [0-9]*")
newsize=$(xdotool getwindowgeometry "$current" | grep Geometry | sed -e 's/x/ /g' | awk '{print $3}')
newwidth=$(xdotool getwindowgeometry "$current" | grep Geometry | grep -o " [0-9]*")
vertical=$(($(xdotool getdisplaygeometry | awk '{print $2}') - newsize))
horizontal=$(($(xdotool getdisplaygeometry | awk '{print $1}') - newwidth))

View File

@ -1,25 +1,17 @@
#!/bin/sh
# This script simplifies dropdown windows in i3.
# Shows/hides a scratchpad of a given name, if it doesn't exist, creates it.
# Usage:
# argument 1: script to run in dropdown window
# all other args are interpreted as options for your terminal
# My usage:
# ddpawn
# bindsym $mod+u exec --no-startup-id ddspawn tmuxdd
# Will hide/show window running the `tmuxdd` script when I press mod+u in i3
# bindsym $mod+a exec --no-startup-id ddspawn dropdowncalc -f mono:pixelsize=24
# Similar to above but with `dropdowncalc` and the other args are interpretated as for my terminal emulator (to increase font)
# Toggle floating dropdown terminal in i3, or start if non-existing.
# $1 is the script run in the terminal.
# All other args are terminal settings.
# Terminal names are in dropdown_* to allow easily setting i3 settings.
[ -z "$1" ] && exit
if xwininfo -tree -root | grep "(\"$1\" ";
if xwininfo -tree -root | grep "(\"dropdown_$1\" ";
then
echo "Window detected."
i3 "[instance=\"dropdown_$1\"] scratchpad show; [instance=\"dropdown_$1\"] move position center"
else
echo "Window not detected... spawning."
i3 "exec --no-startup-id $TERMINAL -n $1 $(echo "$@" | cut -d ' ' -f2-) -e $1" && i3 "[instance=\"$1\"] scratchpad show; [instance=\"$1\"] move position center"
sleep .25 # This sleep is my laziness, will fix later (needed for immediate appearance after spawn).
i3 "exec --no-startup-id $TERMINAL -n dropdown_$1 $(echo "$@" | cut -d ' ' -f2-) -e $1"
fi
i3 "[instance=\"$1\"] scratchpad show; [instance=\"$1\"] move position center"

View File

@ -6,11 +6,38 @@
# I plan on adding a routine from multi-monitor setups later.
twoscreen() { # If multi-monitor is selected and there are two screens.
primary=$(echo "$screens" | dmenu -i -p "Select primary display:")
secondary=$(echo "$screens" | grep -v "$primary")
direction=$(printf "left\\nright" | dmenu -i -p "What side of $primary should $secondary be on?")
xrandr --output "$primary" --auto --output "$secondary" --"$direction"-of "$primary" --auto
}
mirror=$(printf "no\\nyes" | dmenu -i -p "Mirror displays?")
# Mirror displays using native resolution of external display and a scaled
# version for the internal display
if [ "$mirror" = "yes" ]; then
external=$(echo "$screens" | dmenu -i -p "Optimize resolution for:")
internal=$(echo "$screens" | grep -v "$external")
res_external=$(xrandr --query | sed -n "/^$external/,/\+/p" | \
tail -n 1 | awk '{print $1}')
res_internal=$(xrandr --query | sed -n "/^$internal/,/\+/p" | \
tail -n 1 | awk '{print $1}')
res_ext_x=$(echo $res_external | sed 's/x.*//')
res_ext_y=$(echo $res_external | sed 's/.*x//')
res_int_x=$(echo $res_internal | sed 's/x.*//')
res_int_y=$(echo $res_internal | sed 's/.*x//')
scale_x=$(echo "$res_ext_x / $res_int_x" | bc -l)
scale_y=$(echo "$res_ext_y / $res_int_y" | bc -l)
xrandr --output "$external" --auto --scale 1.0x1.0 \
--output "$internal" --auto --same-as "$external" \
--scale "$scale_x"x"$scale_y"
else
primary=$(echo "$screens" | dmenu -i -p "Select primary display:")
secondary=$(echo "$screens" | grep -v "$primary")
direction=$(printf "left\\nright" | dmenu -i -p "What side of $primary should $secondary be on?")
xrandr --output "$primary" --auto --scale 1.0x1.0 --output "$secondary" --"$direction"-of "$primary" --auto --scale 1.0x1.0
fi
}
morescreen() { # If multi-monitor is selected and there are more than two screens.
primary=$(echo "$screens" | dmenu -i -p "Select primary display:")
@ -38,7 +65,7 @@ chosen=$(printf "%s\\nmulti-monitor\\nmanual selection" "$screens" | dmenu -i -p
case "$chosen" in
"manual selection") arandr ; exit ;;
"multi-monitor") multimon ;;
*) xrandr --output "$chosen" --auto $(echo "$screens" | grep -v "$chosen" | awk '{print "--output", $1, "--off"}' | tr '\n' ' ') ;;
*) xrandr --output "$chosen" --auto --scale 1.0x1.0 $(echo "$screens" | grep -v "$chosen" | awk '{print "--output", $1, "--off"}' | tr '\n' ' ') ;;
esac
# Fix feh background if screen size/arangement has changed.

View File

@ -19,7 +19,12 @@ mountusb() { \
chosen="$(echo "$usbdrives" | dmenu -i -p "Mount which drive?" | awk '{print $1}')"
sudo -A mount "$chosen" && notify-send "$chosen mounted." && exit 0
getmount "/mnt /media /mount /home -maxdepth 5 -type d"
sudo -A mount "$chosen" "$mp" && notify-send "$chosen mounted to $mp."
partitiontype="$(lsblk -no "fstype" "$chosen")"
case "$partitiontype" in
"vfat") sudo -A mount -t vfat "$chosen" "$mp" -o rw,umask=0000;;
*) sudo -A mount "$chosen" "$mp"; user="$(whoami)"; ug="$(groups | awk '{print $1}')"; sudo -A chown "$user":"$ug" 741 "$mp";;
esac
notify-send "$chosen mounted to $mp."
}
mountandroid() { \

View File

@ -10,15 +10,15 @@
# If there is already a running instance, user will be prompted to end it.
updateicon() { \
echo "$1" > ~/.recordingicon
echo "$1" > /tmp/recordingicon
pkill -RTMIN+9 i3blocks
}
killrecording() {
recpid="$(cat ~/.recordingpid)"
recpid="$(cat /tmp/recordingpid)"
# kill with SIGTERM, allowing finishing touches.
kill -15 "$recpid"
rm -f ~/.recordingpid
rm -f /tmp/recordingpid
updateicon ""
pkill -RTMIN+9 i3blocks
# even after SIGTERM, ffmpeg may still run, so SIGKILL it.
@ -37,7 +37,7 @@ screencast() { \
-r 30 \
-c:v libx264rgb -crf 0 -preset ultrafast -c:a flac \
"$HOME/screencast-$(date '+%y%m%d-%H%M-%S').mkv" &
echo $! > ~/.recordingpid
echo $! > /tmp/recordingpid
updateicon "⏺️🎙️"
}
@ -47,25 +47,25 @@ video() { ffmpeg \
-i :0.0 \
-c:v libx264 -qp 0 -r 30 \
"$HOME/video-$(date '+%y%m%d-%H%M-%S').mkv" &
echo $! > ~/.recordingpid
echo $! > /tmp/recordingpid
updateicon "⏺️"
}
webcamhidef() { ffmpeg \
-f v412 \
-f v4l2 \
-i /dev/video0 \
-video_size 1920x1080 \
"$HOME/webcam-$(date '+%y%m%d-%H%M-%S').mkv" &
echo $! > ~/.recordingpid
echo $! > /tmp/recordingpid
updateicon "🎥"
}
webcam() { ffmpeg \
-f v412 \
-f v4l2 \
-i /dev/video0 \
-video_size 640x480 \
"$HOME/webcam-$(date '+%y%m%d-%H%M-%S').mkv" &
echo $! > ~/.recordingpid
echo $! > /tmp/recordingpid
updateicon "🎥"
}
@ -75,7 +75,7 @@ audio() { \
-f alsa -i default \
-c:a flac \
"$HOME/audio-$(date '+%y%m%d-%H%M-%S').flac" &
echo $! > ~/.recordingpid
echo $! > /tmp/recordingpid
updateicon "🎙️"
}
@ -85,8 +85,8 @@ askrecording() { \
screencast) screencast;;
audio) audio;;
video) video;;
webcam) webcamrecord;;
"webcam (hi-def)") webcamrecord;;
webcam) webcam;;
"webcam (hi-def)") webcamhidef;;
esac
}
@ -101,5 +101,5 @@ case "$1" in
audio) audio;;
video) video;;
kill) killrecording;;
*) ([ -f ~/.recordingpid ] && asktoend && exit) || askrecording;;
*) ([ -f /tmp/recordingpid ] && asktoend && exit) || askrecording;;
esac

9
.scripts/i3cmds/maimpick Executable file
View File

@ -0,0 +1,9 @@
#!/bin/sh
case "$(printf "a selected area\\ncurrent window\\nfull screen\\na selected area (copy)\\ncurrent window (copy)\\nfullscreen (copy)" | dmenu -l 6 -i -p "Screenshot which area?")" in
"a selected area") maim -s pic-selected-"$(date '+%y%m%d-%H%M-%S').png" ;;
"current window") maim -i "$(xdotool getactivewindow)" pic-window-"$(date '+%y%m%d-%H%M-%S').png" ;;
"full screen") maim pic-full-"$(date '+%y%m%d-%H%M-%S').png" ;;
"a selected area (copy)") maim -s | xclip -selection clipboard -t image/png ;;
"current window (copy)") maim -i | xclip -selection clipboard -t image/png ;;
"full screen (copy)") maim | xclip -selection clipboard -t image/png ;;
esac

View File

@ -9,7 +9,7 @@ clip=$(xclip -o -selection clipboard)
prim=$(xclip -o -selection primary)
[ "$prim" != "" ] && notify-send "<b>Clipboard:</b>
[ "$clip" != "" ] && notify-send "<b>Clipboard:</b>
$clip"
[ "$clip" != "" ] && notify-send "<b>Primary:</b>
[ "$prim" != "" ] && notify-send "<b>Primary:</b>
$prim"

View File

@ -1,7 +1,7 @@
#!/bin/sh
vidlist="
status bar https://www.youtube.com/watch?v=gKumet6b-WY
feh
sxiv (image viewer) https://www.youtube.com/watch?v=GYW9i_u5PYs
st (terminal) https://www.youtube.com/watch?v=9H75enWM22k
i3 (window manager) https://www.youtube.com/watch?v=GKviflL9XeI
mutt (email) https://www.youtube.com/watch?v=2U3vRbF7v5A
@ -15,4 +15,4 @@ urlview https://www.youtube.com/watch?v=IgzpAjFgbCw
colorschemes with pywal https://www.youtube.com/watch?v=Es79N_9BblE
vi mode in shell https://www.youtube.com/watch?v=GqoJQft5R2E
"
mpv "$(echo "$vidlist" | grep -P "^$(echo "$vidlist" | grep "https:" | sed 's/\t.*//g' | dmenu -i -p "Learn about what? (ESC to cancel)" -l 5 | awk '{print $1}')\s" | sed 's/.*\t//')"
echo "$vidlist" | grep -P "^$(echo "$vidlist" | grep "https:" | sed 's/\t.*//g' | dmenu -i -p "Learn about what? (ESC to cancel)" -l 20 | awk '{print $1}')\s" | sed 's/.*\t//' | xargs -r mpv

View File

@ -16,4 +16,4 @@ case $BLOCK_BUTTON in
esac
pacman -Qu | wc -l | sed -e "s/^0$//g"
pacman -Qu | grep -v "\[ignored\]" | wc -l | sed -e "s/^0$//g"

View File

@ -1,8 +1,8 @@
#!/bin/sh
[ "$(stat -c %y .weatherreport | awk '{print $1}')" != "$(date '+%Y-%m-%d')" ] && getforecast
[ "$(stat -c %y /tmp/weatherreport | awk '{print $1}')" != "$(date '+%Y-%m-%d')" ] && getforecast
case $BLOCK_BUTTON in
1) $TERMINAL -e less -S ~/.weatherreport ;;
1) $TERMINAL -e less -S /tmp/weatherreport ;;
3) pgrep -x dunst >/dev/null && notify-send "<b>🌈 Weather module:</b>
- Click for wttr.in forecast.
☔: Chance of rain/snow
@ -10,6 +10,6 @@ case $BLOCK_BUTTON in
🌞: Daily high" ;;
esac
printf "%s" "$(sed '16q;d' ~/.weatherreport | grep -wo "[0-9]*%" | sort -n | sed -e '$!d' | sed -e "s/^/☔ /g" | tr -d '\n')"
printf "%s" "$(sed '16q;d' /tmp/weatherreport | grep -wo "[0-9]*%" | sort -n | sed -e '$!d' | sed -e "s/^/☔ /g" | tr -d '\n')"
sed '13q;d' ~/.weatherreport | grep -o "m\\(-\\)*[0-9]\\+" | sort -n -t 'm' -k 2n | sed -e 1b -e '$!d' | tr '\n|m' ' ' | awk '{print " ❄️",$1 "°","🌞",$2 "°"}'
sed '13q;d' /tmp/weatherreport | grep -o "m\\(-\\)*[0-9]\\+" | sort -n -t 'm' -k 2n | sed -e 1b -e '$!d' | tr '\n|m' ' ' | awk '{print " ❄️",$1 "°","🌞",$2 "°"}'

View File

@ -5,11 +5,11 @@
case "$(printf "copy url\\nmpv\\nmpv (loop)\\nqueue download\\n\\nqueue youtube-dl\\nfeh\\nbrowser\\nw3m\\nmpv (float)" | dmenu -i -p "Open link with what program?")" in
"copy url") echo "$1" | xclip -selection clipboard ;;
mpv) setsid mpv -quiet "$1" >/dev/null 2>&1 & ;;
"mpv (loop)") setsid mpv -quiet --loop "$1" >/dev/null 2>&1 & ;;
"mpv (loop)") setsid mpv --input-ipc-server=/tmp/mpvsoc$(date +%s) -quiet --loop "$1" >/dev/null 2>&1 & ;;
"queue download") tsp curl -LO "$1" >/dev/null 2>&1 ;;
"queue youtube-dl") tsp youtube-dl --write-metadata -ic "$1" >/dev/null 2>&1 ;;
browser) setsid "$TRUEBROWSER" "$1" >/dev/null 2>&1 & ;;
browser) setsid "$BROWSER" "$1" >/dev/null 2>&1 & ;;
feh) setsid feh "$1" >/dev/null 2>&1 & ;;
w3m) w3m "$1" >/dev/null 2>&1 ;;
"mpv (float)") setsid mpv --geometry=+0-0 --autofit=30% --title="mpvfloat" "$1" >/dev/null 2>&1 & ;;
"mpv (float)") setsid mpv --input-ipc-server=/tmp/mpvsoc$(date +%s) --geometry=+0-0 --autofit=30% --title="mpvfloat" "$1" >/dev/null 2>&1 & ;;
esac

View File

@ -10,18 +10,18 @@
scihub="http://sci-hub.tw/"
# If no url given. Opens browser. For using script as $BROWSER.
[ -z "$1" ] && { "$TRUEBROWSER"; exit; }
[ -z "$1" ] && { "$BROWSER"; exit; }
case "$1" in
*mkv|*webm|*mp4|*gif|*youtube.com*|*youtu.be*|*hooktube.com*|*bitchute.com*)
setsid mpv -quiet "$1" >/dev/null 2>&1 & ;;
*png|*jpg|*jpe|*jpeg)
setsid feh "$1" >/dev/null 2>&1 & ;;
*mp3|*flac|*opus|*mp3?source)
*mkv|*webm|*mp4|*youtube.com*|*youtu.be*|*hooktube.com*|*bitchute.com*)
setsid mpv --input-ipc-server=/tmp/mpvsoc$(date +%s) -quiet "$1" >/dev/null 2>&1 & ;;
*png|*jpg|*jpe|*jpeg|*gif)
setsid sxiv -a "$1" >/dev/null 2>&1 & ;;
*mp3|*flac|*opus|*mp3?source*)
setsid tsp curl -LO "$1" >/dev/null 2>&1 & ;;
*springer.com*)
setsid curl -sO "$(curl -s "$scihub$*" | grep -Po "(?<=location.href=').+.pdf")" >/dev/null 2>&1 & ;;
*)
if [ -f "$1" ]; then "$TERMINAL" -e "$EDITOR $1"
else setsid "$TRUEBROWSER" "$1" >/dev/null 2>&1 & fi ;;
else setsid "$BROWSER" "$1" >/dev/null 2>&1 & fi ;;
esac

View File

@ -1,4 +1,4 @@
#!/bin/sh
# Sends a , key to all mpv instances, pausing them at the last frame.
xdotool search --class mpv | xargs -I % xdotool key --window % comma
for i in $(ls /tmp/mpvsoc*); do
echo '{ "command": ["set_property", "pause", true] }' | socat - $i;
done

View File

@ -1,12 +1,4 @@
#!/bin/bash
# Shell rc file (i.e. bash vs. zsh, etc.)
shellrc="$HOME/.bashrc"
# Bookmark file locations
bmdirs="$HOME/.bmdirs"
bmfiles="$HOME/.bmfiles"
# Output locations. Unactivated progs should go to /dev/null.
shell_shortcuts="$HOME/.shortcuts"
ranger_shortcuts="$HOME/.config/ranger/shortcuts.conf"
@ -15,24 +7,16 @@ fish_shortcuts="/dev/null"
# Remove, prepare files
rm -f "$ranger_shortcuts" "$qute_shortcuts" 2>/dev/null
#echo "abbr \\" > "$fish_shortcuts"
echo "abbr \\" > "$fish_shortcuts"
echo "alias \\" > "$shell_shortcuts"
# Ensure text of argument 1 exists in the file argument 2
ensure() { (grep "$1" "$2")>/dev/null 2>&1 || echo "$1" >> "$2" ;}
ensure "source $shell_shortcuts" "$shellrc"
ensure "source $HOME/.config/ranger/shortcuts.conf" "$HOME/.config/ranger/rc.conf"
#ensure "config.source('shortcuts.py')" "$HOME/.config/qutebrowser/config.py"
#ensure "source $HOME/.config/fish/shortcuts.fish" "$HOME/.config/fish/config.fish"
# Format the `bmdirs` file in the correct syntax and sent it to all three configs.
sed "s/#.*$//;/^$/d" "$bmdirs" | tee >(awk '{print $1"=\"cd "$2" && ls -a\" \\"}' >> "$shell_shortcuts") \
sed "s/\s*#.*$//;/^\s*$/d" "$HOME/.bmdirs" | tee >(awk '{print $1"=\"cd "$2" && ls -a\" \\"}' >> "$shell_shortcuts") \
>(awk '{print $1, "\"cd " $2 "; and ls -a\" \\"}' >> "$fish_shortcuts") \
>(awk '{print "config.bind(\";"$1"\", \"set downloads.location.directory "$2" ;; hint links download\")"}' >> "$qute_shortcuts") \
| awk '{print "map g"$1" cd "$2"\nmap t"$1" tab_new "$2"\nmap m"$1" shell mv -v %s "$2"\nmap Y"$1" shell cp -rv %s "$2}' >> "$ranger_shortcuts"
# Format the `configs` file in the correct syntax and sent it to both configs.
sed "s/#.*$//;/^$/d" "$bmfiles" | tee >(awk '{print $1"=\"$EDITOR "$2"\" \\"}' >> "$shell_shortcuts") \
sed "s/\s*#.*$//;/^\s*$/d" "$HOME/.bmfiles" | tee >(awk '{print $1"=\"$EDITOR "$2"\" \\"}' >> "$shell_shortcuts") \
>(awk '{print $1, "\"$EDITOR "$2"\" \\"}' >> "$fish_shortcuts") \
| awk '{print "map "$1" shell $EDITOR "$2}' >> "$ranger_shortcuts"

View File

@ -1,66 +1,5 @@
" vim-plug: Vim plugin manager
" ============================
"
" Download plug.vim and put it in ~/.vim/autoload
"
" curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
" https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
"
" Edit your .vimrc
"
" call plug#begin('~/.vim/plugged')
"
" " Make sure you use single quotes
"
" " Shorthand notation; fetches https://github.com/junegunn/vim-easy-align
" Plug 'junegunn/vim-easy-align'
"
" " Any valid git URL is allowed
" Plug 'https://github.com/junegunn/vim-github-dashboard.git'
"
" " Multiple Plug commands can be written in a single line using | separators
" Plug 'SirVer/ultisnips' | Plug 'honza/vim-snippets'
"
" " On-demand loading
" Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
" Plug 'tpope/vim-fireplace', { 'for': 'clojure' }
"
" " Using a non-master branch
" Plug 'rdnetto/YCM-Generator', { 'branch': 'stable' }
"
" " Using a tagged release; wildcard allowed (requires git 1.9.2 or above)
" Plug 'fatih/vim-go', { 'tag': '*' }
"
" " Plugin options
" Plug 'nsf/gocode', { 'tag': 'v.20150303', 'rtp': 'vim' }
"
" " Plugin outside ~/.vim/plugged with post-update hook
" Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
"
" " Unmanaged plugin (manually installed and updated)
" Plug '~/my-prototype-plugin'
"
" " Initialize plugin system
" call plug#end()
"
" Then reload .vimrc and :PlugInstall to install plugins.
"
" Plug options:
"
"| Option | Description |
"| ----------------------- | ------------------------------------------------ |
"| `branch`/`tag`/`commit` | Branch/tag/commit of the repository to use |
"| `rtp` | Subdirectory that contains Vim plugin |
"| `dir` | Custom directory for the plugin |
"| `as` | Use different name for the plugin |
"| `do` | Post-update hook (string or funcref) |
"| `on` | On-demand loading: Commands or `<Plug>`-mappings |
"| `for` | On-demand loading: File types |
"| `frozen` | Do not update unless explicitly specified |
"
" More information: https://github.com/junegunn/vim-plug
"
"
" Copyright (c) 2017 Junegunn Choi
"
" MIT License

216
.vimrc
View File

@ -1,216 +0,0 @@
" _
" __ _(_)_ __ ___ _ __ ___
" \ \ / / | '_ ` _ \| '__/ __|
" \ V /| | | | | | | | | (__
" \_/ |_|_| |_| |_|_| \___|
let mapleader =" "
call plug#begin('~/.vim/plugged')
Plug 'junegunn/goyo.vim'
Plug 'PotatoesMaster/i3-vim-syntax'
Plug 'jreybert/vimagit'
Plug 'LukeSmithxyz/vimling'
Plug 'vimwiki/vimwiki'
call plug#end()
" Some basics:
set nocompatible
filetype plugin on
syntax on
set encoding=utf-8
set number relativenumber
" Enable autocompletion:
set wildmode=longest,list,full
" Disables automatic commenting on newline:
autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o
" Goyo plugin makes text more readable when writing prose:
map <leader>f :Goyo \| set linebreak<CR>
" Spell-check set to <leader>o, 'o' for 'orthography':
map <leader>o :setlocal spell! spelllang=en_us<CR>
" Splits open at the bottom and right, which is non-retarded, unlike vim defaults.
set splitbelow splitright
" 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
" Check file in shellcheck:
map <leader>s :!clear && shellcheck %<CR>
" Open my bibliography file in split
map <leader>b :vsp<space>$BIB<CR>
map <leader>r :vsp<space>$REFER<CR>
" Replace all is aliased to S.
nnoremap S :%s//g<Left><Left>
" Compile document, be it groff/LaTeX/markdown/etc.
map <leader>c :w! \| !compiler <c-r>%<CR><CR>
" Open corresponding .pdf/.html or preview
map <leader>p :!opout <c-r>%<CR><CR>
" Runs a script that cleans out tex build files whenever I close out of a .tex file.
autocmd VimLeave *.tex !texclear %
" Ensure files are read as what I want:
let g:vimwiki_ext2syntax = {'.Rmd': 'markdown', '.rmd': 'markdown','.md': 'markdown', '.markdown': 'markdown', '.mdown': 'markdown'}
autocmd BufRead,BufNewFile /tmp/calcurse*,~/.calcurse/notes/* set filetype=markdown
autocmd BufRead,BufNewFile *.ms,*.me,*.mom,*.man set filetype=groff
autocmd BufRead,BufNewFile *.tex set filetype=tex
" Readmes autowrap text:
autocmd BufRead,BufNewFile *.md set tw=79
" Use urlscan to choose and open a url:
:noremap <leader>u :w<Home> !urlscan -r 'linkhandler {}'<CR>
:noremap ,, !urlscan -r 'linkhandler {}'<CR>
" Copy selected text to system clipboard (requires gvim/nvim/vim-x11 installed):
vnoremap <C-c> "+y
map <C-p> "+P
" Enable Goyo by default for mutt writting
" Goyo's width will be the line limit in mutt.
autocmd BufRead,BufNewFile /tmp/neomutt* let g:goyo_width=80
autocmd BufRead,BufNewFile /tmp/neomutt* :Goyo
" Automatically deletes all trailing whitespace on save.
autocmd BufWritePre * %s/\s\+$//e
" When shortcut files are updated, renew bash and ranger configs with new material:
autocmd BufWritePost ~/.bm* !shortcuts
" Run xrdb whenever Xdefaults or Xresources are updated.
autocmd BufWritePost ~/.Xresources,~/.Xdefaults !xrdb %
" Navigating with guides
inoremap <Space><Tab> <Esc>/<++><Enter>"_c4l
vnoremap <Space><Tab> <Esc>/<++><Enter>"_c4l
map <Space><Tab> <Esc>/<++><Enter>"_c4l
"____ _ _
"/ ___| _ __ (_)_ __ _ __ ___| |_ ___
"\___ \| '_ \| | '_ \| '_ \ / _ \ __/ __|
"___) | | | | | |_) | |_) | __/ |_\__ \
"|____/|_| |_|_| .__/| .__/ \___|\__|___/
"|_| |_|
"""LATEX
" Word count:
autocmd FileType tex map <leader><leader>o :w !detex \| wc -w<CR>
" Code snippets
autocmd FileType tex inoremap ,fr \begin{frame}<Enter>\frametitle{}<Enter><Enter><++><Enter><Enter>\end{frame}<Enter><Enter><++><Esc>6kf}i
autocmd FileType tex inoremap ,fi \begin{fitch}<Enter><Enter>\end{fitch}<Enter><Enter><++><Esc>3kA
autocmd FileType tex inoremap ,exe \begin{exe}<Enter>\ex<Space><Enter>\end{exe}<Enter><Enter><++><Esc>3kA
autocmd FileType tex inoremap ,em \emph{}<++><Esc>T{i
autocmd FileType tex inoremap ,bf \textbf{}<++><Esc>T{i
autocmd FileType tex vnoremap , <ESC>`<i\{<ESC>`>2la}<ESC>?\\{<Enter>a
autocmd FileType tex inoremap ,it \textit{}<++><Esc>T{i
autocmd FileType tex inoremap ,ct \textcite{}<++><Esc>T{i
autocmd FileType tex inoremap ,cp \parencite{}<++><Esc>T{i
autocmd FileType tex inoremap ,glos {\gll<Space><++><Space>\\<Enter><++><Space>\\<Enter>\trans{``<++>''}}<Esc>2k2bcw
autocmd FileType tex inoremap ,x \begin{xlist}<Enter>\ex<Space><Enter>\end{xlist}<Esc>kA<Space>
autocmd FileType tex inoremap ,ol \begin{enumerate}<Enter><Enter>\end{enumerate}<Enter><Enter><++><Esc>3kA\item<Space>
autocmd FileType tex inoremap ,ul \begin{itemize}<Enter><Enter>\end{itemize}<Enter><Enter><++><Esc>3kA\item<Space>
autocmd FileType tex inoremap ,li <Enter>\item<Space>
autocmd FileType tex inoremap ,ref \ref{}<Space><++><Esc>T{i
autocmd FileType tex inoremap ,tab \begin{tabular}<Enter><++><Enter>\end{tabular}<Enter><Enter><++><Esc>4kA{}<Esc>i
autocmd FileType tex inoremap ,ot \begin{tableau}<Enter>\inp{<++>}<Tab>\const{<++>}<Tab><++><Enter><++><Enter>\end{tableau}<Enter><Enter><++><Esc>5kA{}<Esc>i
autocmd FileType tex inoremap ,can \cand{}<Tab><++><Esc>T{i
autocmd FileType tex inoremap ,con \const{}<Tab><++><Esc>T{i
autocmd FileType tex inoremap ,v \vio{}<Tab><++><Esc>T{i
autocmd FileType tex inoremap ,a \href{}{<++>}<Space><++><Esc>2T{i
autocmd FileType tex inoremap ,sc \textsc{}<Space><++><Esc>T{i
autocmd FileType tex inoremap ,chap \chapter{}<Enter><Enter><++><Esc>2kf}i
autocmd FileType tex inoremap ,sec \section{}<Enter><Enter><++><Esc>2kf}i
autocmd FileType tex inoremap ,ssec \subsection{}<Enter><Enter><++><Esc>2kf}i
autocmd FileType tex inoremap ,sssec \subsubsection{}<Enter><Enter><++><Esc>2kf}i
autocmd FileType tex inoremap ,st <Esc>F{i*<Esc>f}i
autocmd FileType tex inoremap ,beg \begin{DELRN}<Enter><++><Enter>\end{DELRN}<Enter><Enter><++><Esc>4k0fR:MultipleCursorsFind<Space>DELRN<Enter>c
autocmd FileType tex inoremap ,up <Esc>/usepackage<Enter>o\usepackage{}<Esc>i
autocmd FileType tex nnoremap ,up /usepackage<Enter>o\usepackage{}<Esc>i
autocmd FileType tex inoremap ,tt \texttt{}<Space><++><Esc>T{i
autocmd FileType tex inoremap ,bt {\blindtext}
autocmd FileType tex inoremap ,nu $\varnothing$
autocmd FileType tex inoremap ,col \begin{columns}[T]<Enter>\begin{column}{.5\textwidth}<Enter><Enter>\end{column}<Enter>\begin{column}{.5\textwidth}<Enter><++><Enter>\end{column}<Enter>\end{columns}<Esc>5kA
autocmd FileType tex inoremap ,rn (\ref{})<++><Esc>F}i
"""HTML
autocmd FileType html inoremap ,b <b></b><Space><++><Esc>FbT>i
autocmd FileType html inoremap ,it <em></em><Space><++><Esc>FeT>i
autocmd FileType html inoremap ,1 <h1></h1><Enter><Enter><++><Esc>2kf<i
autocmd FileType html inoremap ,2 <h2></h2><Enter><Enter><++><Esc>2kf<i
autocmd FileType html inoremap ,3 <h3></h3><Enter><Enter><++><Esc>2kf<i
autocmd FileType html inoremap ,p <p></p><Enter><Enter><++><Esc>02kf>a
autocmd FileType html inoremap ,a <a<Space>href=""><++></a><Space><++><Esc>14hi
autocmd FileType html inoremap ,e <a<Space>target="_blank"<Space>href=""><++></a><Space><++><Esc>14hi
autocmd FileType html inoremap ,ul <ul><Enter><li></li><Enter></ul><Enter><Enter><++><Esc>03kf<i
autocmd FileType html inoremap ,li <Esc>o<li></li><Esc>F>a
autocmd FileType html inoremap ,ol <ol><Enter><li></li><Enter></ol><Enter><Enter><++><Esc>03kf<i
autocmd FileType html inoremap ,im <img src="" alt="<++>"><++><esc>Fcf"a
autocmd FileType html inoremap ,td <td></td><++><Esc>Fdcit
autocmd FileType html inoremap ,tr <tr></tr><Enter><++><Esc>kf<i
autocmd FileType html inoremap ,th <th></th><++><Esc>Fhcit
autocmd FileType html inoremap ,tab <table><Enter></table><Esc>O
autocmd FileType html inoremap ,gr <font color="green"></font><Esc>F>a
autocmd FileType html inoremap ,rd <font color="red"></font><Esc>F>a
autocmd FileType html inoremap ,yl <font color="yellow"></font><Esc>F>a
autocmd FileType html inoremap ,dt <dt></dt><Enter><dd><++></dd><Enter><++><esc>2kcit
autocmd FileType html inoremap ,dl <dl><Enter><Enter></dl><enter><enter><++><esc>3kcc
autocmd FileType html inoremap &<space> &amp;<space>
autocmd FileType html inoremap á &aacute;
autocmd FileType html inoremap é &eacute;
autocmd FileType html inoremap í &iacute;
autocmd FileType html inoremap ó &oacute;
autocmd FileType html inoremap ú &uacute;
autocmd FileType html inoremap ä &auml;
autocmd FileType html inoremap ë &euml;
autocmd FileType html inoremap ï &iuml;
autocmd FileType html inoremap ö &ouml;
autocmd FileType html inoremap ü &uuml;
autocmd FileType html inoremap ã &atilde;
autocmd FileType html inoremap &etilde;
autocmd FileType html inoremap ĩ &itilde;
autocmd FileType html inoremap õ &otilde;
autocmd FileType html inoremap ũ &utilde;
autocmd FileType html inoremap ñ &ntilde;
autocmd FileType html inoremap à &agrave;
autocmd FileType html inoremap è &egrave;
autocmd FileType html inoremap ì &igrave;
autocmd FileType html inoremap ò &ograve;
autocmd FileType html inoremap ù &ugrave;
""".bib
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
"MARKDOWN
autocmd Filetype markdown,rmd map <leader>w yiWi[<esc>Ea](<esc>pa)
autocmd Filetype markdown,rmd inoremap ,n ---<Enter><Enter>
autocmd Filetype markdown,rmd inoremap ,b ****<++><Esc>F*hi
autocmd Filetype markdown,rmd inoremap ,s ~~~~<++><Esc>F~hi
autocmd Filetype markdown,rmd inoremap ,e **<++><Esc>F*i
autocmd Filetype markdown,rmd inoremap ,h ====<Space><++><Esc>F=hi
autocmd Filetype markdown,rmd inoremap ,i ![](<++>)<++><Esc>F[a
autocmd Filetype markdown,rmd inoremap ,a [](<++>)<++><Esc>F[a
autocmd Filetype markdown,rmd inoremap ,1 #<Space><Enter><++><Esc>kA
autocmd Filetype markdown,rmd inoremap ,2 ##<Space><Enter><++><Esc>kA
autocmd Filetype markdown,rmd inoremap ,3 ###<Space><Enter><++><Esc>kA
autocmd Filetype markdown,rmd inoremap ,l --------<Enter>
autocmd Filetype rmd inoremap ,r ```{r}<CR>```<CR><CR><esc>2kO
autocmd Filetype rmd inoremap ,p ```{python}<CR>```<CR><CR><esc>2kO
autocmd Filetype rmd inoremap ,c ```<cr>```<cr><cr><esc>2kO
""".xml
autocmd FileType xml inoremap ,e <item><Enter><title><++></title><Enter><guid<space>isPermaLink="false"><++></guid><Enter><pubDate><Esc>:put<Space>=strftime('%a, %d %b %Y %H:%M:%S %z')<Enter>kJA</pubDate><Enter><link><++></link><Enter><description><![CDATA[<++>]]></description><Enter></item><Esc>?<title><enter>cit
autocmd FileType xml inoremap ,a <a href="<++>"><++></a><++><Esc>F"ci"

1
.vimrc Symbolic link
View File

@ -0,0 +1 @@
.config/nvim/init.vim