commit 328608fd05bdcf15a07b40041671483770875c19 Author: Maxime Wack Date: Thu Jan 17 22:57:18 2019 +0100 Fresh start with stow diff --git a/.Rprofile b/.Rprofile new file mode 100644 index 0000000..d2c870a --- /dev/null +++ b/.Rprofile @@ -0,0 +1,18 @@ +if(interactive()) +{ + library(colorout) + library(setwidth) + options(blogdown.ext = ".md", + blogdown.author = "maximewack", + menu.graphics = F, + scipen = 999, + tibble.print_min = 10, + tibble.print_max = 40) + + .View <- function(x) + { + x %>% + dplyr::mutate_if(is.character, factor) %>% + DT::datatable(filter = "top", options = list(paging = F, fixedHeader = T)) + } +} diff --git a/.Xresources b/.Xresources new file mode 100644 index 0000000..d54f49d --- /dev/null +++ b/.Xresources @@ -0,0 +1,29 @@ +*background: #202020 +*foreground: #CCCCCC + +!BLK +*color0: #666666 +*color8: #999999 +!RED +*color1: #CC6699 +*color9: #FF99CC +!GRN +*color2: #99CC66 +*color10: #CCFF99 +!YEL +*color3: #CC9966 +*color11: #FFCC99 +!BLU +*color4: #6699CC +*color12: #99CCFF +!MAG +*color5: #9966CC +*color13: #CC99FF +!CYN +*color6: #66CC99 +*color14: #99FFCC +!WHT +*color7: #CCCCCC +*color15: #FFFFFF + +Xcursor.theme: Obsidian diff --git a/.bspwm-session b/.bspwm-session new file mode 100755 index 0000000..406288e --- /dev/null +++ b/.bspwm-session @@ -0,0 +1,65 @@ +#!/bin/bash +# +# bspwm-session +# +# This script is a session launcher for bspwm. +# It is based on similar scripts included with Openbox. + +if [ -n "$1" ]; then + echo "Usage: bspwm-session" + echo + exit 1 +fi + +# Multi-user support: +state_prefix=${XDG_CACHE_HOME:-"$HOME/.cache"} +mkdir -p "${state_prefix}" + +if [ ! -d "${state_prefix}" ]; then + echo "bspwm-session: cache directory ‘${state_prefix}‘ is missing." + echo + exit 1 +elif [ ! -w "${state_prefix}" ]; then + echo "bspwm-session: cache directory ‘${state_prefix}‘ is not writable." + echo + exit 1 +fi + +state_path=$(mktemp -d "${state_prefix}/bspwm-session.XXXXXX") + +if [ $? -ne 0 ]; then + echo "bspwm-session: failed to create state directory ‘${state_path}‘." + echo + exit 1 +fi + +export BSPWM_SOCKET=${state_path}/bspwm-socket + +# Trap: make sure everything started in ~/.config/bspwm/autostart is +# signalled when this script exits or dies. Also clean up $state_path. +function on_exit { + for child in $(jobs -p); do + jobs -p | grep -q $child && kill $child + done + # Extra paranoia + [[ -d "${state_path}" && -w "${state_path}" ]] && rm -rf -- "${state_path}" +} + +trap on_exit EXIT SIGHUP SIGINT SIGTERM + +# Environment and autostart: +source_these=( + "/etc/profile" + "${HOME}/.profile" + "${XDG_CONFIG_HOME:-"$HOME/.config"}/bspwm/autostart" +) + +for file in "${source_these[@]}"; do + [ -r "${file}" ] && . "${file}" +done + +# Launch sxhkd: +sxhkd & + +# Launch bspwm: +bspwm diff --git a/.config/bin/clear_desktops b/.config/bin/clear_desktops new file mode 100755 index 0000000..2632d02 --- /dev/null +++ b/.config/bin/clear_desktops @@ -0,0 +1,38 @@ +#!/bin/bash + +last=`cat /tmp/lastdesk` + +namelast=$last +namecurrent=`bspc query -d focused -D --names` +wincurrent=`bspc query -d focused -N` + +if [[ "$last" -gt "1" ]]; then + del_desks=0 + + for desk in `seq 1 $last`; do + if [[ -z `bspc query -N -d "$desk"` ]]; then + let "del_desks += 1" + bspc desktop "$desk" -r + else + let "newname = desk - del_desks" + bspc desktop "$desk" -n "$newname" + fi + done + + let "last = last - del_desks" + echo "$last" + + # Always keep desktop 1 existing, even if empty + if [[ "$last" -eq "0" ]]; then + bspc monitor -a 1 + bspc desktop -f 1 + last=1 + # Allow for an additional empty desktop + elif [[ "$namecurrent" -eq "$namelast" && -z "$wincurrent" ]]; then + let "last=$last + 1" + bspc monitor -a "$last" + bspc desktop -f "$last" + fi +fi + +echo "$last" > /tmp/lastdesk diff --git a/.config/bin/meteo b/.config/bin/meteo new file mode 100755 index 0000000..9934450 --- /dev/null +++ b/.config/bin/meteo @@ -0,0 +1,3 @@ +#!/bin/bash + +curl -s wttr.in | sed -n 3,7p > /tmp/meteo diff --git a/.config/bin/meteo_display b/.config/bin/meteo_display new file mode 100755 index 0000000..5b47072 --- /dev/null +++ b/.config/bin/meteo_display @@ -0,0 +1,2 @@ +#!/bin/bash +curl -s wttr.in | sed -n 8,37p diff --git a/.config/bin/panel b/.config/bin/panel new file mode 100755 index 0000000..b3d5cd9 --- /dev/null +++ b/.config/bin/panel @@ -0,0 +1,43 @@ +#!/bin/zsh + +PANEL_FIFO=/tmp/panel-fifo + +if [ $(pgrep -cx panel) -gt 1 ] ; then + printf "%s\n" "The panel is already running." >&2 + exit 1 +fi + +trap 'trap - TERM; kill 0' INT TERM QUIT EXIT + +[ -e "$PANEL_FIFO" ] && rm "$PANEL_FIFO" +mkfifo "$PANEL_FIFO" + +bspc subscribe > "$PANEL_FIFO" & +xtitle -sf 'T%s\n' > "$PANEL_FIFO" & +if [ "$HOST" = "laptop" ];then + battery -sf 'BI%i' > "$PANEL_FIFO" & +fi +clock -sf 'CD%a %d %b' > "$PANEL_FIFO" & +clock -sf 'CT%H:%M' > "$PANEL_FIFO" & + + +if [ "$HOST" = "hegp" ];then + width=1660 + volume -sf 'VS%s' -d hw:1 > "$PANEL_FIFO" & + volume -sf 'VI%i' -d hw:1 > "$PANEL_FIFO" & +else + width=1900 + volume -sf 'VS%s' > "$PANEL_FIFO" & + volume -sf 'VI%i' > "$PANEL_FIFO" & +fi + +cat "$PANEL_FIFO" \ + | panel_bar \ + | lemonbar -g "$width"x24+10+0 \ + -f "monofur\ for\ Powerline:size=10" \ + -f "FontAwesome:size=10" \ + -u 0 \ + -B '#00AAAAAA' \ + -F '#FF202020' & + +wait diff --git a/.config/bin/panel_bar b/.config/bin/panel_bar new file mode 100755 index 0000000..02ecb60 --- /dev/null +++ b/.config/bin/panel_bar @@ -0,0 +1,119 @@ +#!/bin/bash + +COLOR_FOCUSED='#FF202020' +COLOR_FREE='#FFCCCCCC' +COLOR_OCCUPIED='#FF666666' + +num_mon=$(bspc query -M | wc -l) + +while read -r line ; do + case $line in + VS*) + # volume state + if [ ${line#??} == "on" ] + then + volume_state=`echo -e "%{T2}\uf028"` + else + volume_state=`echo -e "%{T2}\uf026"` + fi + ;; + VI*) + # volume output + volume="%{T1}${line#??}" + ;; + BS*) + # battery state + if [ ${line#??} == "Charging" ] + then + batt_state=`echo -e "%{T2}\uf0e7"` + elif [ ${line#??} == "Full" ] + then + batt_state=`echo -e "%{T2}\uf0e7"` + else + batt_state="" + fi + ;; + BI*) + # battery output + charge="${line#??}" + if [ $charge -lt "12" ] + then + batt=`echo -e "%{T2}\uf244"` + elif [ $charge -lt "37" ] + then + batt=`echo -e "%{T2}\uf243"` + elif [ $charge -lt "62" ] + then + batt=`echo -e "%{T2}\uf242"` + elif [ $charge -lt "87" ] + then + batt=`echo -e "%{T2}\uf241"` + else + batt=`echo -e "%{T2}\uf240"` + fi + charge=`echo -e "%{T1}$charge"` + ;; + CD*) + # date output + clock_date=`echo -e "%{T2}\uf073 %{T1}${line#??}"` + ;; + CT*) + # clock output + clock=`echo -e "%{T2}\uf017 %{T1}${line#??}"` + ;; + T*) + # xtitle output + title="%{T1}${line#?}" + ;; + W*) + # bspwm internal state + wm_infos="" + IFS=':' + set -- ${line#?} + while [ $# -gt 0 ] ; do + item=$1 + name=${item#?} + case $item in + M*) + # active monitor + if [ $num_mon -gt 1 ] ; then + wm_infos="$wm_infos %{F$COLOR_FOCUSED} ${name} %{F-}:" + fi + ;; + m*) + # inactive monitor + if [ $num_mon -gt 1 ] ; then + wm_infos="$wm_infos %{F$COLOR_OCCUPIED} ${name} %{F-}:" + fi + ;; + O*) + # focused occupied desktop + wm_infos="${wm_infos}%{F$COLOR_FOCUSED}%{+u} ${name} %{-u}%{F-}" + ;; + F*) + # focused free desktop + wm_infos="${wm_infos}%{F$COLOR_FOCUSED}%{+u} ${name} %{-u}%{F-}" + ;; + U*) + # focused urgent desktop + wm_infos="${wm_infos}%{F$COLOR_FOCUSED}%{+u} ${name} %{-u}%{F-}" + ;; + o*) + # occupied desktop + wm_infos="${wm_infos}%{F$COLOR_OCCUPIED} ${name} %{F-}" + ;; + f*) + # free desktop + wm_infos="${wm_infos}%{F$COLOR_FREE} ${name} %{F-}" + ;; + h*) + # urgent desktop + wm_infos="${wm_infos} ${name} " + ;; + esac + shift + done + ;; + esac + printf "%s\n" "%{l}${wm_infos}%{c}${title}%{r}${volume_state} ${volume} ${batt} ${charge}${batt_state} ${clock_date} ${clock} " +done diff --git a/.config/bin/popup b/.config/bin/popup new file mode 100755 index 0000000..ed20718 --- /dev/null +++ b/.config/bin/popup @@ -0,0 +1,22 @@ +#!/bin/zsh + +if [ $# -eq 0 ];then + echo "Give at least a classname to toggle" + exit 0 +fi + +name=$1 +shift + +if [ -z `xdotool search --classname $name` ];then + bspc subscribe node -c 1 | cut -d ' ' -f 5 > /tmp/${name}_win & + kitty --name $name $* + sleep .5 +else + win=`cat /tmp/${name}_win` + if [ -z `bspc query -N -n ${win}.hidden` ];then + bspc node ${win} -g hidden + else + bspc node ${win} -g hidden -f + fi +fi diff --git a/.config/bin/reconky b/.config/bin/reconky new file mode 100755 index 0000000..68b43d8 --- /dev/null +++ b/.config/bin/reconky @@ -0,0 +1,4 @@ +#!/bin/bash + +killall conky +conky -c /home/maxx/.config/conky/conkyrc diff --git a/.config/bin/retray b/.config/bin/retray new file mode 100755 index 0000000..b6f2e5b --- /dev/null +++ b/.config/bin/retray @@ -0,0 +1,4 @@ +#!/bin/bash + +killall stalonetray +/home/maxx/.config/bin/tray diff --git a/.config/bin/tray b/.config/bin/tray new file mode 100755 index 0000000..016cd07 --- /dev/null +++ b/.config/bin/tray @@ -0,0 +1,10 @@ +#!/bin/zsh +if [ "$HOST" = "laptop" ] +then + width=1600 +elif [ "$HOST" = "hegp" ] +then + width=1400 +fi + +stalonetray --window-type dock --geometry +$width+0 -t --icon-gravity S --grow-gravity NE -i 16 --slot-size 24 --kludges force_icons_size diff --git a/.config/bspwm/background.png b/.config/bspwm/background.png new file mode 100644 index 0000000..1a0554f Binary files /dev/null and b/.config/bspwm/background.png differ diff --git a/.config/bspwm/bspwmrc b/.config/bspwm/bspwmrc new file mode 100755 index 0000000..f0f5ce6 --- /dev/null +++ b/.config/bspwm/bspwmrc @@ -0,0 +1,113 @@ +#!/bin/zsh + +bspc config border_width 0 +bspc config window_gap 10 + +bspc config split_ratio 0.4 +bspc config borderless_monocle true +bspc config gapless_monocle true +bspc config focus_by_distance true +bspc config initial_polarity first_child + +bspc config remove_unplugged_monitors true +bspc config ignore_ewmh_focus true + +bspc config click_to_focus any +bspc config pointer_modifier mod4 +bspc config pointer_action1 move +bspc config pointer_action2 resize_corner + +bspc config presel_feedback_color "#FFFFFF" + +echo 1 > /tmp/lastdesk +if [ "$HOST" = "laptop" ];then + bspc monitor eDP1 -d    1 +elif [ "$HOST" = "hegp" ];then + bspc monitor HDMI1 -d    1 + bspc monitor VGA1 -d I II +elif [ "$HOST" = "home" ];then + bspc monitor HDMI2 -d  1 +fi + +bspc rule -a Slack desktop= +bspc rule -a TelegramDesktop desktop= +bspc rule -a Skype desktop= state=tiled +bspc rule -a Thunderbird desktop= +bspc rule -a qutebrowser desktop= +bspc rule -a Galculator state=floating +bspc rule -a Arandr state=floating +bspc rule -a Zathura state=tiled +bspc rule -a Pinentry state=floating +bspc rule -a Soffice state=tiled + +# Figures and PDFs on second monitor +if [ "$HOST" = "hegp" ];then + bspc rule -a R_x11 monitor=^2 + bspc rule -a Zathura monitor=^2 +fi + +# Popup CLI apps +if [ "$HOST" = "laptop" ];then + bspc rule -a kitty:Ranger sticky=on state=floating rectangle=1820x900+0+0 center=on + bspc rule -a kitty:Music_playlist sticky=on state=floating rectangle=430x470+30+64 + bspc rule -a kitty:Music_media sticky=on state=floating rectangle=430x476+30+574 + bspc rule -a kitty:Music_playlist_home sticky=on state=floating rectangle=430x470+30+64 + bspc rule -a kitty:Music_media_home sticky=on state=floating rectangle=430x476+30+574 + bspc rule -a kitty:Wiki sticky=on state=floating rectangle=840x986+490+64 + bspc rule -a kitty:Volume sticky=on state=floating rectangle=530x270+1360+64 + bspc rule -a kitty:Torrent sticky=on state=floating rectangle=530x676+1360+374 +elif [ "$HOST" = "hegp" ];then + bspc rule -a kitty:Volume monitor=^1 sticky=on state=floating rectangle=490x300+1170+30 + bspc rule -a kitty:Wiki monitor=^1 sticky=on state=floating rectangle=1000x1000+350+30 + bspc rule -a kitty:Ranger monitor=^1 sticky=on state=floating rectangle=1550x900+0+0 center=on locked=on + bspc rule -a kitty:Music_playlist sticky=on state=floating rectangle=430x470+30+64 + bspc rule -a kitty:Music_media sticky=on state=floating rectangle=430x476+30+574 +elif [ "$HOST" = "home" ];then + bspc rule -a kitty:Ranger sticky=on state=floating rectangle=1820x900+0+0 center=on + bspc rule -a kitty:Music_playlist sticky=on state=floating rectangle=945x1036+10+34 + bspc rule -a kitty:Music_media sticky=on state=floating rectangle=945x1036+965+34 + bspc rule -a kitty:Volume sticky=on state=floating rectangle=600x400+1310+34 +fi +bspc rule -a kitty:Meteo monitor=^1 sticky=on state=floating rectangle=880x580+500+625 +bspc rule -a kitty:evimwhere state=floating rectangle=920x580+500+250 + +mpd +greenclip daemon & +udiskie -s & + +wmname compiz +dunst & +redshift & +compton -b +xsetroot -cursor_name left_ptr +if [ "$HOST" = "hegp" ];then + hsetroot -fill .config/bspwm/cat_sitting.png +else + hsetroot -tile .config/bspwm/cat.png +fi +conky -d -c .config/conky/conkyrc & +panel & +popup Ranger ranger & + +sleep 1 + +if [ "$HOST" = "home" ];then + synergyc laptop +else + tray & + thunderbird & + unclutter & + telegram-desktop & + slack & +fi + +meteo +qutebrowser & +popup Ranger + +if [ "$HOST" = "laptop" ];then + nm-applet --sm-disable & + synergys & +fi + +bspc config top_padding 14 diff --git a/.config/bspwm/cat.cron b/.config/bspwm/cat.cron new file mode 100644 index 0000000..f198917 --- /dev/null +++ b/.config/bspwm/cat.cron @@ -0,0 +1,21 @@ +0 8 * * * DISPLAY=:0.0 hsetroot -tile /home/maxx/.config/bspwm/cat_sitting.png +0 9 * * * DISPLAY=:0.0 hsetroot -tile /home/maxx/.config/bspwm/cat_mouse.png +0 10 * * * DISPLAY=:0.0 hsetroot -tile /home/maxx/.config/bspwm/cat.png +30 10 * * * DISPLAY=:0.0 hsetroot -tile /home/maxx/.config/bspwm/cat_sleeping.png +0 11 * * * DISPLAY=:0.0 hsetroot -tile /home/maxx/.config/bspwm/cat_playing.png +30 11 * * * DISPLAY=:0.0 hsetroot -tile /home/maxx/.config/bspwm/cat.png +30 12 * * * DISPLAY=:0.0 hsetroot -tile /home/maxx/.config/bspwm/cat_sitting.png +0 13 * * * DISPLAY=:0.0 hsetroot -tile /home/maxx/.config/bspwm/cat_playing.png +30 13 * * * DISPLAY=:0.0 hsetroot -tile /home/maxx/.config/bspwm/cat.png +0 14 * * * DISPLAY=:0.0 hsetroot -tile /home/maxx/.config/bspwm/cat_sleeping.png +50 17 * * * DISPLAY=:0.0 hsetroot -tile /home/maxx/.config/bspwm/cat_sitting.png +0 18 * * * DISPLAY=:0.0 hsetroot -tile /home/maxx/.config/bspwm/cat_mouse.png +0 19 * * * DISPLAY=:0.0 hsetroot -tile /home/maxx/.config/bspwm/cat_playing.png +30 19 * * * DISPLAY=:0.0 hsetroot -tile /home/maxx/.config/bspwm/cat.png +30 20 * * * DISPLAY=:0.0 hsetroot -tile /home/maxx/.config/bspwm/cat_sleeping.png +50 21 * * * DISPLAY=:0.0 hsetroot -tile /home/maxx/.config/bspwm/cat_sitting.png +00 22 * * * DISPLAY=:0.0 hsetroot -tile /home/maxx/.config/bspwm/cat_mouse.png +15 22 * * * DISPLAY=:0.0 hsetroot -tile /home/maxx/.config/bspwm/cat.png +30 22 * * * DISPLAY=:0.0 hsetroot -tile /home/maxx/.config/bspwm/cat_sleeping.png +40 0 * * * DISPLAY=:0.0 hsetroot -tile /home/maxx/.config/bspwm/cat_sitting.png +55 0 * * * DISPLAY=:0.0 hsetroot -tile /home/maxx/.config/bspwm/cat_sleeping.png diff --git a/.config/bspwm/cat.png b/.config/bspwm/cat.png new file mode 100644 index 0000000..690f1f5 Binary files /dev/null and b/.config/bspwm/cat.png differ diff --git a/.config/bspwm/cat.svg b/.config/bspwm/cat.svg new file mode 100644 index 0000000..4e161fb --- /dev/null +++ b/.config/bspwm/cat.svg @@ -0,0 +1,2780 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/.config/bspwm/cat_mouse.png b/.config/bspwm/cat_mouse.png new file mode 100644 index 0000000..91f2a1b Binary files /dev/null and b/.config/bspwm/cat_mouse.png differ diff --git a/.config/bspwm/cat_playing.png b/.config/bspwm/cat_playing.png new file mode 100644 index 0000000..0e9f5e7 Binary files /dev/null and b/.config/bspwm/cat_playing.png differ diff --git a/.config/bspwm/cat_sitting.png b/.config/bspwm/cat_sitting.png new file mode 100644 index 0000000..553f3c3 Binary files /dev/null and b/.config/bspwm/cat_sitting.png differ diff --git a/.config/bspwm/cat_sleeping.png b/.config/bspwm/cat_sleeping.png new file mode 100644 index 0000000..aeae3ca Binary files /dev/null and b/.config/bspwm/cat_sleeping.png differ diff --git a/.config/bspwm/left_edge b/.config/bspwm/left_edge new file mode 100755 index 0000000..5805c09 --- /dev/null +++ b/.config/bspwm/left_edge @@ -0,0 +1,17 @@ +#!/bin/bash + +for pad in `seq 0 20 560` +do + bspc config left_padding $pad +done + +eval $(xdotool getmouselocation --shell) +while [ "$X" -lt 250 ] +do + eval $(xdotool getmouselocation --shell) +done + +for pad in `seq 560 -20 0` +do + bspc config left_padding $pad +done diff --git a/.config/compton.conf b/.config/compton.conf new file mode 100644 index 0000000..9693f26 --- /dev/null +++ b/.config/compton.conf @@ -0,0 +1,74 @@ +shadow = true; +no-dnd-shadow = true; +no-dock-shadow = true; +shadow-radius = 14; +shadow-offset-x = -25; +shadow-offset-y = -6; +shadow-opacity = 0.8; +shadow-red = 0.0; +shadow-green = 0.0; +shadow-blue = 0.0; +shadow-exclude = [ + "name = 'stalonetray'", + "name = 'Notification'", + "name = 'VirtualBox'", + "class_g = 'Bspwm'", + "class_i = 'presel_feedback'", + "class_g = 'Conky'", + "class_g ?= 'Notify-osd'", + "class_g = 'Cairo-clock'", + "class_i = 'POWERPNT.EXE'", + "class_i = 'WINWORD.EXE'", + "class_i = 'Meteo'" + ]; +shadow-ignore-shaped = false; +menu-opacity = 0.9; +inactive-opacity = 1; +active-opacity = 1.0; +frame-opacity = 1.0; +inactive-opacity-override = false; +opacity-rule = [ + "10:class_g = 'Bspwm'", + "10:class_i = 'presel_feedback'", + ]; +alpha-step = 0.1; +inactive-dim = .3; +blur-kern = "11x11gaussian"; +blur-background-exclude = [ "window_type = 'dock'", "window_type = 'desktop'" ]; +fading = true; +fade-delta = 10; +fade-in-step = 0.03; +fade-out-step = 0.03; +fade-exclude = []; +backend = "glx"; +mark-wmwin-focused = false; +mark-ovredir-focused = false; +detect-rounded-corners = true; +detect-client-opacity = true; +refresh-rate = 0; +vsync = "opengl"; +sw-opti = true; +dbe = false; +focus-exclude = [ "class_g = 'Cairo-clock'", "class_g = 'mpv'" ]; +detect-transient = true; +detect-client-leader = true; +invert-color-include = [ ]; +glx-copy-from-front = false; +glx-swap-method = "undefined"; +glx-no-stencil = true; +wintypes : +{ + tooltip = + { + fade = true; + shadow = false; + opacity = 0.75; + focus = true; + }; +}; +blur-background = true; +inactive-dim-fixed = true; +blur-background-frame = true; +blur-background-fixed = true; +no-fading-openclose = false; +use-ewmh-active-win = true; diff --git a/.config/conky/conky.lua b/.config/conky/conky.lua new file mode 100644 index 0000000..a8c8062 --- /dev/null +++ b/.config/conky/conky.lua @@ -0,0 +1,491 @@ +-- vim: set fdm=indent +-- conky uses lua5.1. lua51-utf8 package is needed +utf8 = require 'lua-utf8' +require 'cairo' + +netuphist = {} +netdownhist = {} +ramhist = {} +swaphist = {} +cpuhist = {} +cur = 1 + +-- SETTINGS +nbCPU = 4 +FSs = {"/", "/var", "/home"} +ladapter = "eth0" -- eno1 +wadapter = "wlan0" +ntop = 10 +-- SETTINGS + +function conky_init() + local cr, cs = nil + + if conky_window == nil then return end + if cs == nil or cairo_xlib_surface_get_width(cs) ~= conky_window.width or cairo_xlib_surface_get_height(cs) ~= conky_window.height then + if cs then cairo_surface_destroy(cs) end + cs = cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, conky_window.width, conky_window.height) + end + if cr then cairo_destroy(cr) end + cr = cairo_create(cs) + + + local items = 30 + nbCPU + #FSs + ntop + defaultSize = conky_window.height / items + height = defaultSize + 1 + small = defaultSize * .8 + blue = {.4,.6,.8,.5} + cur = cur % 100 + 1 + + local ypos = 60 + local xpos = 25 + local margin = 50 + + ypos = general(cr, xpos, ypos) + margin + ypos = fs (cr, xpos, ypos) + margin + ypos = ram (cr, xpos, ypos) + margin + ypos = cpu (cr, xpos, ypos) + margin + ypos = top (cr, xpos, ypos, ntop) + margin + ypos = network(cr, xpos, ypos) + margin + + clock(cr, conky_window.width / 2, conky_window.height / 2 - 170) + weather(cr, conky_window.width / 2 - 11.5*.6*15, conky_window.height / 2 - 60) + + cairo_destroy(cr) + cairo_surface_destroy(cs) +end + +function clock(cr, x, y) + emboss(cr, x, y - 100, conky_parse("${time %H}"), 1, 200) + emboss(cr, x, y - 50, conky_parse(":${time %M}"), 0, 150) +end + +function weather(cr, x, y) + size = 15 + meteo = "" + yt = 0 + for line in io.lines("/tmp/meteo") do + yt = yt + size + xt = 0 + for substr in string.gmatch(line, "[^]+") do + color = tonumber(substr:match("%[38;5;(%d+)m")) + if color ~= nil then + if color <= 231 then + color = color - 16 + b = color % 36 % 6 + color = color - b + g = color % 36 / 6 + color = color - g * 6 + r = color / 36 + color = {r * .2, g * .2, b * .2, 1} + else + a = (color - 232) / 24 + color = {a, a, a, 1} + end + end + substr = substr:gsub("%[[^m]+m", "") + emboss(cr, x + xt, y + yt, substr, 0, size, nil, color, "Fira Code") + xt = xt + .6*size * utf8.len(substr) + end + end +end + +function general(cr, x, y) + cadre(cr, x, y, 450, 3 * height, 10) + + emboss(cr , x , y, "Kernel") + y = emboss(cr, x + 450, y, conky_parse("$kernel") , 1) + emboss(cr , x , y, "Uptime") + y = emboss(cr, x + 450, y, conky_parse("$uptime") , 1) + emboss(cr , x , y, "Load") + y = emboss(cr, x + 450, y, conky_parse("$loadavg"), 1) + + return y +end + +function ram(cr, x, y) + cadre(cr, x, y, 450, 10 + 4 * height, 10) + + if #swaphist == 0 then + local i + for i = 1,100 do + swaphist[i] =.001 + end + end + + if #ramhist == 0 then + local i + for i = 1,100 do + ramhist[i] =.001 + end + end + + ramhist[cur] = tonumber(conky_parse("$memperc")) + swaphist[cur] = tonumber(conky_parse("$swapperc")) + + emboss(cr, x , y, "Ram") + emboss(cr, x + 180, y, conky_parse("$mem/") , 1) + y = emboss(cr, x + 260, y, conky_parse("$memmax"), 1) + bar(cr, x + 5, y, 255, conky_parse("$memperc"), blue) + graph(cr, x + 280, y, 170, ramhist, blue, 100) + y = y + height + 10 + + emboss(cr, x , y, "Swap") + emboss(cr, x + 180, y, conky_parse("$swap/") , 1) + y = emboss(cr, x + 260, y, conky_parse("$swapmax"), 1) + bar(cr, x + 5, y, 255, conky_parse("$swapperc"), blue) + graph(cr, x + 280, y, 170, swaphist, blue, 100) + y = y + height + + return y +end + +function cpu(cr, x, y) + cadre(cr, x, y, 450, 10 + (1 + nbCPU) * height, 10) + + if #cpuhist == 0 then + local i, j + for i = 1,nbCPU do + cpuhist[i] = {} + for j = 1,100 do + cpuhist[i][j] = .001 + end + end + end + + emboss(cr , x , y, "Cpu") + emboss(cr , x + 260, y, conky_parse("$freq_g GHz") , 1) + y = emboss(cr, x + 450, y, conky_parse("Temp ${hwmon 0 temp 1}°C"), 1) + 10 + + local cpu + + for cpu=1,nbCPU do + bar(cr, x + 5, y, 255, conky_parse("${cpu cpu" .. cpu .. "}"), blue) + cpuhist[cpu][cur] = tonumber(conky_parse("${cpu cpu" .. cpu .. "}")) + graph(cr, x + 280, y, 170, cpuhist[cpu], blue, 100) + y = y + height + end + + return y +end + +function network(cr, x, y) + cadre(cr, x, y, 450, 4 * height + 10, 10) + + local upspd = conky_parse("${upspeedf " .. wadapter .. "}") + conky_parse("${upspeedf " .. ladapter .. "}") + local downspd = conky_parse("${downspeedf " .. wadapter .. "}") + conky_parse("${downspeedf " .. ladapter .. "}") + + local upspdunit = "KiB/s" + local downspdunit = "KiB/s" + if upspd > 1024 then + upspd = upspd / 1024 + upspdunit = "MiB/s" + end + if downspd > 1024 then + downspd = downspd / 1024 + downspdunit = "MiB/s" + end + + local ethup = string.match(conky_parse("${totalup " .. ladapter .. "}"),"[%d.]+") + local ethupunit = string.match(conky_parse("${totalup " .. ladapter .. "}"),"%a") + if ethupunit == "K" then + ethup = ethup * 1024 + elseif ethupunit == "M" then + ethup = ethup * 1024 * 1024 + elseif ethupunit == "G" then + ethup = ethup * 1024 * 1024 * 1024 + end + + local ethdown = string.match(conky_parse("${totaldown " .. ladapter .. "}"),"[%d.]+") + local ethdownunit = string.match(conky_parse("${totaldown " .. ladapter .. "}"),"%a") + if ethdownunit == "K" then + ethdown = ethdown * 1024 + elseif ethdownunit == "M" then + ethdown = ethdown * 1024 * 1024 + elseif ethdownunit == "G" then + ethdown = ethdown * 1024 * 1024 * 1024 + end + + local wlanup = string.match(conky_parse("${totalup " .. wadapter .. "}"),"[%d.]+") + local wlanupunit = string.match(conky_parse("${totalup " .. wadapter .. "}"),"%a") + if wlanupunit == "K" then + wlanup = wlanup * 1024 + elseif wlanupunit == "M" then + wlanup = wlanup * 1024 * 1024 + elseif wlanupunit == "G" then + wlanup = wlanup * 1024 * 1024 * 1024 + end + + local wlandown = string.match(conky_parse("${totaldown " .. wadapter .. "}"),"[%d.]+") + local wlandownunit = string.match(conky_parse("${totaldown " .. wadapter .. "}"),"%a") + if wlandownunit == "K" then + wlandown = wlandown * 1024 + elseif wlandownunit == "M" then + wlandown = wlandown * 1024 * 1024 + elseif wlandownunit == "G" then + wlandown = wlandown * 1024 * 1024 * 1024 + end + + local totalup = ethup + wlanup + local upunit = "B" + if totalup > (1024 * 1024 * 1024) then + totalup = totalup / (1024 * 1024 * 1024) + upunit = "GiB" + elseif totalup > (1024 * 1024) then + totalup = totalup / (1024 * 1024) + upunit = "MiB" + elseif totalup > 1024 then + totalup = totalup / 1024 + upunit = "KiB" + end + + local totaldown = ethdown + wlandown + local downunit = "B" + if totaldown > (1024 * 1024 * 1024) then + totaldown = totaldown / (1024 * 1024 * 1024) + downunit = "GiB" + elseif totaldown > (1024 * 1024) then + totaldown = totaldown / (1024 * 1024) + downunit = "MiB" + elseif totaldown > 1024 then + totaldown = totaldown / 1024 + downunit = "KiB" + end + + if #netuphist == 0 then + local i + for i = 1,100 do + netuphist[i] = .001 + end + end + + if #netdownhist == 0 then + local i + for i = 1,100 do + netdownhist[i] = .001 + end + end + + netuphist[cur] = tonumber(conky_parse("${upspeedf " .. wadapter .. "}") + conky_parse("${upspeedf " .. ladapter .. "}")) + netdownhist[cur] = tonumber(conky_parse("${downspeedf " .. wadapter .. "}") + conky_parse("${downspeedf " .. ladapter .. "}")) + + maxspeed = max({max(netuphist), max(netdownhist)}) + if maxspeed == 0 then + maxspeed = 1 + end + + emboss(cr, x , y, "Up") + emboss(cr, x + 260, y, string.format("%.1f",upspd) .. upspdunit , 1) + graph(cr, x + 280, y, 170, netuphist, blue, maxspeed) + y = y + height + emboss(cr, x , y, "Down") + emboss(cr, x + 260, y, string.format("%.1f",downspd) .. downspdunit, 1) + graph(cr, x + 280, y, 170, netdownhist, blue, maxspeed, 1) + y = y + height + 10 + emboss(cr , x , y, "Total up") + y = emboss(cr, x+260, y, string.format("%.2f",totalup) .. upunit , 1) + emboss(cr , x , y, "Total down") + y = emboss(cr, x+260, y, string.format("%.2f",totaldown) .. downunit , 1) + + return y +end + +function fs(cr, x, y) + cadre(cr, x, y, 450, height * #FSs, 10) + + for row=1,#FSs do + emboss(cr, x , y , FSs[row]) + emboss(cr, x + 180, y , conky_parse("${fs_used " .. FSs[row] .. "}/"), 1) + emboss(cr, x + 260, y , conky_parse("${fs_size " .. FSs[row] .. "}") , 1) + bar(cr, x + 280, y, 170, conky_parse("${fs_used_perc " .. FSs[row] .. "}"), blue) + y = y + height + end + + return y +end + +function top(cr, x, y, nrows) + cadre(cr, x, y, 450, height + 10 + nrows * small, 10) + + emboss(cr , x , y, "Name") + emboss(cr , x + 220, y, "Cpu", 1) + emboss(cr , x + 230, y, "Name") + y = emboss(cr, x + 450, y, "Ram", 1) + 10 + + local row + + for row=1,nrows do + emboss(cr , x , y, conky_parse("${top name " .. row .. "}") , 0, small) + emboss(cr , x + 220, y, conky_parse("${top cpu " .. row .. "}") , 1, small) + emboss(cr , x + 230, y, conky_parse("${top_mem name " .. row .. "}"), 0, small) + y = emboss(cr, x + 450, y, conky_parse("${top_mem mem " .. row .. "}") , 1, small) + end + + return y +end + +function cadre(cr, x, y, w, h, r, pop, col) + if pop == nil then pop = 1 end + + local pi = 3.141592 + + if pop < 0 then y = y + pop end + cairo_set_operator(cr, CAIRO_OPERATOR_XOR) + cairo_move_to(cr, x, y - r) + cairo_arc(cr, x + w, y , r, 1.5 * pi, 0 * pi) + cairo_arc(cr, x + w, y + h, r, 0 * pi, .5 * pi) + cairo_arc(cr, x , y + h, r, .5 * pi, 1 * pi) + cairo_arc(cr, x , y , r, 1 * pi, 1.5 * pi) + + cairo_set_source_rgb(cr, 1, 1, 1) + cairo_fill(cr) + + y = y - pop + + cairo_move_to(cr, x, y - r) + cairo_arc(cr, x + w, y , r,1.5 * pi, 0 * pi) + cairo_arc(cr, x + w, y + h, r,0 * pi, .5 * pi) + cairo_arc(cr, x , y + h, r,.5 * pi, 1 * pi) + cairo_arc(cr, x , y , r,1 * pi, 1.5 * pi) + + cairo_set_source_rgb(cr, 0, 0, 0) + cairo_fill(cr) + cairo_set_operator(cr, CAIRO_OPERATOR_OVER) + + cairo_move_to(cr, x, y - r) + cairo_arc(cr, x + w, y , r, 1.5 * pi, 0 * pi) + cairo_arc(cr, x + w, y + h, r, 0 * pi, .5 * pi) + cairo_arc(cr, x , y + h, r, .5 * pi, 1 * pi) + cairo_arc(cr, x , y , r, 1 * pi, 1.5 * pi) + + if pop > 0 then cairo_set_source_rgba(cr, 0, 0, 0, .1) else cairo_set_source_rgba(cr, 1, 1, 1, .1) end + cairo_fill_preserve(cr) + if col ~= nil then cairo_set_source_rgba(cr, col[1], col[2], col[3], col[4]) else cairo_set_source_rgba(cr, 0, 0, 0, 0)end + cairo_fill(cr) +end + +function bar(cr, x, y, width, percent, color) + local barh = height / 3 + emboss(cr, x + width, y + 3, percent .. "%", 1, small) + width = width - 45 + cadre(cr, x, y + barh + 4, width , barh - 4, 4) + cadre(cr, x, y + barh + 4, width * percent / 100, barh - 4, 2, -1, color) +end + +function emboss(cr, x, y, text, right, size, pop, col, font) + if pop == nil then pop = 1 end + if size == nil then size = defaultSize end + if right == nil then right = 0 end + if font == nil then font = "Impact" end + + y = y + size + + cairo_select_font_face (cr, font, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL); + cairo_set_font_size (cr, size); + + if right == 1 then + extent = cairo_text_extents_t:create() + tolua.takeownership(extent) + cairo_text_extents(cr, text, extent) + x = x - extent.x_advance + -- cairo_text_extents_t:destroy(extent) + end + + if pop < 0 then y = y + pop end + cairo_set_operator(cr, CAIRO_OPERATOR_XOR) + cairo_move_to(cr, x, y) + cairo_text_path(cr, text) + cairo_set_source_rgb(cr, 1, 1, 1) + cairo_fill(cr) + + cairo_move_to(cr,x,y - pop) + cairo_text_path(cr, text) + cairo_set_source_rgb(cr, 0, 0, 0) + cairo_fill(cr) + cairo_set_operator(cr, CAIRO_OPERATOR_OVER) + + cairo_move_to(cr, x, y) + cairo_text_path(cr, text) + if pop > 0 then cairo_set_source_rgba(cr, 0, 0, 0, .1) else cairo_set_source_rgba(cr, 1, 1, 1, .1) end + cairo_fill_preserve(cr) + if col ~= nil then cairo_set_source_rgba(cr, col[1], col[2], col[3], col[4]) else cairo_set_source_rgba(cr, 0, 0, 0, 0) end + cairo_fill(cr) + + return y +end + +function graph(cr, x, y, width, hist, color, maximum, reverse) + + if maximum == nil then maximum = max(hist) end + if reverse == nil then reverse = 0 end + + x = x - 2 + width = width + 2 + + local scalev = (height - 2) / maximum + if reverse == 1 then + scalev = -scalev + y = y + 1 + else + y = y + height - 1 + end + local scaleh = width / 100 + + cairo_move_to(cr, x + scaleh, y) + + local i + for i = cur+1,100 do + cairo_line_to(cr, x + (i - cur) * scaleh, y - hist[i] * scalev) + end + for i = 1,cur do + cairo_line_to(cr, x + ((100 - cur) + i) * scaleh, y - hist[i] * scalev) + end + + cairo_line_to(cr, x + 100 * scaleh, y) + cairo_close_path(cr) + cairo_set_source_rgb(cr, 1, 1, 1) + cairo_fill(cr) + + y = y - 2 + + cairo_move_to(cr, x + scaleh, y) + + for i = cur+1,100 do + cairo_line_to(cr, x + (i - cur) * scaleh, y - hist[i] * scalev) + end + for i = 1,cur do + cairo_line_to(cr, x + ((100 - cur) + i) * scaleh, y - hist[i] * scalev) + end + + cairo_line_to(cr, x + 100 * scaleh, y) + cairo_close_path(cr) + cairo_set_source_rgb(cr, 0, 0, 0) + cairo_fill(cr) + + y = y + 1 + + cairo_move_to(cr, x + scaleh, y) + + for i = cur+1,100 do + cairo_line_to(cr, x + (i - cur) * scaleh, y - hist[i] * scalev) + end + for i = 1,cur do + cairo_line_to(cr, x + ((100 - cur) + i) * scaleh, y - hist[i] * scalev) + end + + cairo_line_to(cr, x + 100 * scaleh, y) + cairo_close_path(cr) + cairo_set_source_rgba(cr, color[1], color[2], color[3], 1) + cairo_fill(cr) +end + +function max(hist) + local i + local max = 0 + + for i=1,#hist do + if hist[i] > max then max = hist[i] end + end + + return max +end diff --git a/.config/conky/conkyrc b/.config/conky/conkyrc new file mode 100644 index 0000000..ec00231 --- /dev/null +++ b/.config/conky/conkyrc @@ -0,0 +1,40 @@ +conky.config = { + alignment = 'top_left', + background = true, + border_width = 0, + cpu_avg_samples = 2, + default_color = 'grey', + default_outline_color = 'white', + default_shade_color = 'white', + draw_borders = false, + draw_graph_borders = false, + draw_outline = false, + draw_shades = false, + use_xft = true, + minimum_width = 1920, + minimum_height = 1080, + gap_x = 5, + gap_y = 5, + net_avg_samples = 2, + no_buffers = true, + out_to_console = false, + out_to_stderr = false, + extra_newline = false, + own_window = true, + own_window_class = 'Conky', + own_window_type = 'desktop', + own_window_argb_visual = true, + own_window_transparent = true, + stippled_borders = 0, + update_interval = 1.0, + update_interval_on_battery = 10, + uppercase = false, + use_spacer = none, + show_graph_scale = false, + show_graph_range = false, + double_buffer = true, + lua_load = '~/.config/conky/conky.lua', + lua_draw_hook_pre = 'init' +} + +conky.text = [[]] diff --git a/.config/dunst/dunstrc b/.config/dunst/dunstrc new file mode 100644 index 0000000..f0cc5bd --- /dev/null +++ b/.config/dunst/dunstrc @@ -0,0 +1,245 @@ +[global] + font = FontAwesome 24 + + # Allow a small subset of html markup: + # bold + # italic + # strikethrough + # underline + # + # For a complete reference see + # . + # If markup is not allowed, those tags will be stripped out of the + # message. + allow_markup = yes + + # The format of the message. Possible variables are: + # %a appname + # %s summary + # %b body + # %i iconname (including its path) + # %I iconname (without its path) + # %p progress value if set ([ 0%] to [100%]) or nothing + # Markup is allowed + format = "%s\n%b" + + # Sort messages by urgency. + sort = no + + # Show how many messages are currently hidden (because of geometry). + indicate_hidden = no + + # Alignment of message text. + # Possible values are "left", "center" and "right". + alignment = center + + # The frequency with wich text that is longer than the notification + # window allows bounces back and forth. + # This option conflicts with "word_wrap". + # Set to 0 to disable. + bounce_freq = 0 + + # Show age of message if message is older than show_age_threshold + # seconds. + # Set to -1 to disable. + show_age_threshold = -1 + + # Split notifications into multiple lines if they don't fit into + # geometry. + word_wrap = yes + + # Ignore newlines '\n' in notifications. + ignore_newline = no + + + # The geometry of the window: + # [{width}]x{height}[+/-{x}+/-{y}] + # The geometry of the message window. + # The height is measured in number of notifications everything else + # in pixels. If the width is omitted but the height is given + # ("-geometry x2"), the message window expands over the whole screen + # (dmenu-like). If width is 0, the window expands to the longest + # message displayed. A positive x is measured from the left, a + # negative from the right side of the screen. Y is measured from + # the top and down respectevly. + # The width can be negative. In this case the actual width is the + # screen width minus the width defined in within the geometry option. + geometry = "400x1+760+420" + + # Shrink window if it's smaller than the width. Will be ignored if + # width is 0. + shrink = no + + # The transparency of the window. Range: [0; 100]. + # This option will only work if a compositing windowmanager is + # present (e.g. xcompmgr, compiz, etc.). + transparency = 30 + + # Don't remove messages, if the user is idle (no mouse or keyboard input) + # for longer than idle_threshold seconds. + # Set to 0 to disable. + idle_threshold = 0 + + # Which monitor should the notifications be displayed on. + monitor = 0 + + # Display notification on focused monitor. Possible modes are: + # mouse: follow mouse pointer + # keyboard: follow window with keyboard focus + # none: don't follow anything + # + # "keyboard" needs a windowmanager that exports the + # _NET_ACTIVE_WINDOW property. + # This should be the case for almost all modern windowmanagers. + # + # If this option is set to mouse or keyboard, the monitor option + # will be ignored. + follow = keyboard + + # Should a notification popped up from history be sticky or timeout + # as if it would normally do. + sticky_history = yes + + # Maximum amount of notifications kept in history + history_length = 0 + + # Display indicators for URLs (U) and actions (A). + show_indicators = yes + + # The height of a single line. If the height is smaller than the + # font height, it will get raised to the font height. + # This adds empty space above and under the text. + line_height = 0 + + # Draw a line of "separatpr_height" pixel height between two + # notifications. + # Set to 0 to disable. + separator_height = 2 + + # Padding between text and separator. + padding = 8 + + # Horizontal padding. + horizontal_padding = 8 + + # Define a color for the separator. + # possible values are: + # * auto: dunst tries to find a color fitting to the background; + # * foreground: use the same color as the foreground; + # * frame: use the same color as the frame; + # * anything else will be interpreted as a X color. + separator_color = frame + + # Print a notification on startup. + # This is mainly for error detection, since dbus (re-)starts dunst + # automatically after a crash. + startup_notification = false + + # dmenu path. + dmenu = /usr/bin/dmenu -p dunst: + + # Browser for opening urls in context menu. + browser = /usr/bin/firefox -new-tab + + # Align icons left/right/off + icon_position = off + + # Paths to default icons. + icon_folders = /usr/share/icons/gnome/16x16/status/:/usr/share/icons/gnome/16x16/devices/ + +[frame] + width = 0 + color = "#aaaaaa" + +[shortcuts] + + # Shortcuts are specified as [modifier+][modifier+]...key + # Available modifiers are "ctrl", "mod1" (the alt-key), "mod2", + # "mod3" and "mod4" (windows-key). + # Xev might be helpful to find names for keys. + + # Close notification. + close = ctrl+space + + # Close all notifications. + close_all = ctrl+shift+space + + # Redisplay last message(s). + # On the US keyboard layout "grave" is normally above TAB and left + # of "1". + history = ctrl+grave + + # Context menu. + context = ctrl+shift+period + +[urgency_low] + # IMPORTANT: colors have to be defined in quotation marks. + # Otherwise the "#" and following would be interpreted as a comment. + background = "#222222" + foreground = "#CCCCCC" + timeout = 1 + +[urgency_normal] + background = "#222222" + foreground = "#CCCCCC" + timeout = 1 + +[urgency_critical] + background = "#222222" + foreground = "#CCCCCC" + timeout = 0 + + +# Every section that isn't one of the above is interpreted as a rules to +# override settings for certain messages. +# Messages can be matched by "appname", "summary", "body", "icon", "category", +# "msg_urgency" and you can override the "timeout", "urgency", "foreground", +# "background", "new_icon" and "format". +# Shell-like globbing will get expanded. +# +# SCRIPTING +# You can specify a script that gets run when the rule matches by +# setting the "script" option. +# The script will be called as follows: +# script appname summary body icon urgency +# where urgency can be "LOW", "NORMAL" or "CRITICAL". +# +# NOTE: if you don't want a notification to be displayed, set the format +# to "". +# NOTE: It might be helpful to run dunst -print in a terminal in order +# to find fitting options for rules. + +#[espeak] +# summary = "*" +# script = dunst_espeak.sh + +#[script-test] +# summary = "*script*" +# script = dunst_test.sh + +#[ignore] +# # This notification will not be displayed +# summary = "foobar" +# format = "" + +#[signed_on] +# appname = Pidgin +# summary = "*signed on*" +# urgency = low +# +#[signed_off] +# appname = Pidgin +# summary = *signed off* +# urgency = low +# +#[says] +# appname = Pidgin +# summary = *says* +# urgency = critical +# +#[twitter] +# appname = Pidgin +# summary = *twitter.com* +# urgency = normal +# +# vim: ft=cfg diff --git a/.config/kitty/kitty.conf b/.config/kitty/kitty.conf new file mode 100644 index 0000000..324fc34 --- /dev/null +++ b/.config/kitty/kitty.conf @@ -0,0 +1,908 @@ +# vim:fileencoding=utf-8:ft=conf:foldmethod=marker + +#: Fonts {{{ + +#: kitty has very powerful font management. You can configure +#: individual font faces and even specify special fonts for particular +#: characters. + +font_family Fira Code +# bold_font auto +italic_font Fira Code Italic +# bold_italic_font auto + +#: You can specify different fonts for the bold/italic/bold-italic +#: variants. By default they are derived automatically, by the OSes +#: font system. Setting them manually is useful for font families that +#: have many weight variants like Book, Medium, Thick, etc. For +#: example:: + +#: font_family Operator Mono Book +#: bold_font Operator Mono Medium +#: italic_font Operator Mono Book Italic +#: bold_italic_font Operator Mono Medium Italic + +font_size 9 + +#: Font size (in pts) + +# adjust_line_height 0 +# adjust_column_width 0 + +#: Change the size of each character cell kitty renders. You can use +#: either numbers, which are interpreted as pixels or percentages +#: (number followed by %), which are interpreted as percentages of the +#: unmodified values. You can use negative pixels or percentages less +#: than 100% to reduce sizes (but this might cause rendering +#: artifacts). + +# symbol_map U+E0A0-U+E0A2,U+E0B0-U+E0B3 PowerlineSymbols + +#: Map the specified unicode codepoints to a particular font. Useful +#: if you need special rendering for some symbols, such as for +#: Powerline. Avoids the need for patched fonts. Each unicode code +#: point is specified in the form U+. You +#: can specify multiple code points, separated by commas and ranges +#: separated by hyphens. symbol_map itself can be specified multiple +#: times. Syntax is:: + +#: symbol_map codepoints Font Family Name + +# box_drawing_scale 0.001, 1, 1.5, 2 + +#: Change the sizes of the lines used for the box drawing unicode +#: characters These values are in pts. They will be scaled by the +#: monitor DPI to arrive at a pixel value. There must be four values +#: corresponding to thin, normal, thick, and very thick lines. + +#: }}} + +#: Cursor customization {{{ + +# cursor #cccccc + +#: Default cursor color + +# cursor_text_color #111111 + +#: Choose the color of text under the cursor. If you want it rendered +#: with the background color of the cell underneath instead, use the +#: special keyword: background + +# cursor_shape block + +#: The cursor shape can be one of (block, beam, underline) + +# cursor_blink_interval 0.5 +# cursor_stop_blinking_after 15.0 + +#: The interval (in seconds) at which to blink the cursor. Set to zero +#: to disable blinking. Note that numbers smaller than repaint_delay +#: will be limited to repaint_delay. Stop blinking cursor after the +#: specified number of seconds of keyboard inactivity. Set to zero to +#: never stop blinking. + +#: }}} + +#: Scrollback {{{ + +# scrollback_lines 2000 + +#: Number of lines of history to keep in memory for scrolling back. +#: Memory is allocated on demand. Negative numbers are (effectively) +#: infinite scrollback. Note that using very large scrollback is not +#: recommended a it can slow down resizing of the terminal and also +#: use large amounts of RAM. + +# scrollback_pager less --chop-long-lines --RAW-CONTROL-CHARS +INPUT_LINE_NUMBER + +#: Program with which to view scrollback in a new window. The +#: scrollback buffer is passed as STDIN to this program. If you change +#: it, make sure the program you use can handle ANSI escape sequences +#: for colors and text formatting. INPUT_LINE_NUMBER in the command +#: line above will be replaced by an integer representing which line +#: should be at the top of the screen. + +wheel_scroll_multiplier 4.0 + +#: Modify the amount scrolled by the mouse wheel. Note this is only +#: used for low precision scrolling devices, not for high precision +#: scrolling on platforms such as macOS and Wayland. Use negative +#: numbers to change scroll direction. + +#: }}} + +#: Mouse {{{ + +# url_color #0087BD +# url_style curly + +#: The color and style for highlighting URLs on mouse-over. url_style +#: can be one of: none, single, double, curly + +# open_url_modifiers kitty_mod + +#: The modifier keys to press when clicking with the mouse on URLs to +#: open the URL + +# open_url_with default + +#: The program with which to open URLs that are clicked on. The +#: special value default means to use the operating system's default +#: URL handler. + +# copy_on_select no + +#: Copy to clipboard on select. With this enabled, simply selecting +#: text with the mouse will cause the text to be copied to clipboard. +#: Useful on platforms such as macOS/Wayland that do not have the +#: concept of primary selections. Note that this is a security risk, +#: as all programs, including websites open in your browser can read +#: the contents of the clipboard. + +# rectangle_select_modifiers ctrl+alt + +#: The modifiers to use rectangular selection (i.e. to select text in +#: a rectangular block with the mouse) + +# select_by_word_characters :@-./_~?&=%+# + +#: Characters considered part of a word when double clicking. In +#: addition to these characters any character that is marked as an +#: alpha-numeric character in the unicode database will be matched. + +# click_interval 0.5 + +#: The interval between successive clicks to detect double/triple +#: clicks (in seconds) + +# mouse_hide_wait 3.0 + +#: Hide mouse cursor after the specified number of seconds of the +#: mouse not being used. Set to zero to disable mouse cursor hiding. + +# focus_follows_mouse no + +#: Set the active window to the window under the mouse when moving the +#: mouse around + +#: }}} + +#: Performance tuning {{{ + +# repaint_delay 10 + +#: Delay (in milliseconds) between screen updates. Decreasing it, +#: increases frames-per-second (FPS) at the cost of more CPU usage. +#: The default value yields ~100 FPS which is more than sufficient for +#: most uses. Note that to actually achieve 100 FPS you have to either +#: set sync_to_monitor to no or use a monitor with a high refresh +#: rate. + +# input_delay 3 + +#: Delay (in milliseconds) before input from the program running in +#: the terminal is processed. Note that decreasing it will increase +#: responsiveness, but also increase CPU usage and might cause flicker +#: in full screen programs that redraw the entire screen on each loop, +#: because kitty is so fast that partial screen updates will be drawn. + +# sync_to_monitor yes + +#: Sync screen updates to the refresh rate of the monitor. This +#: prevents tearing (https://en.wikipedia.org/wiki/Screen_tearing) +#: when scrolling. However, it limits the rendering speed to the +#: refresh rate of your monitor. With a very high speed mouse/high +#: keyboard repeat rate, you may notice some slight input latency. If +#: so, set this to no. + +#: }}} + +#: Terminal bell {{{ + +# enable_audio_bell yes + +#: Enable/disable the audio bell. Useful in environments that require +#: silence. + +# visual_bell_duration 0.0 + +#: Visual bell duration. Flash the screen when a bell occurs for the +#: specified number of seconds. Set to zero to disable. + +# window_alert_on_bell yes + +#: Request window attention on bell. Makes the dock icon bounce on +#: macOS or the taskbar flash on linux. + +# bell_on_tab yes + +#: Show a bell symbol on the tab if a bell occurs in one of the +#: windows in the tab and the window is not the currently focused +#: window + +#: }}} + +#: Window layout {{{ + +# remember_window_size yes +# initial_window_width 640 +# initial_window_height 400 + +#: If enabled, the window size will be remembered so that new +#: instances of kitty will have the same size as the previous +#: instance. If disabled, the window will initially have size +#: configured by initial_window_width/height, in pixels. You can use a +#: suffix of "c" on the width/height values to have them interpreted +#: as number of cells instead of pixels. + +# enabled_layouts * + +#: The enabled window layouts. A comma separated list of layout names. +#: The special value all means all layouts. The first listed layout +#: will be used as the startup layout. For a list of available +#: layouts, see the +#: https://sw.kovidgoyal.net/kitty/index.html#layouts. + +# window_resize_step_cells 2 +# window_resize_step_lines 2 + +#: The step size (in units of cell width/cell height) to use when +#: resizing windows. The cells value is used for horizontal resizing +#: and the lines value for vertical resizing. + +# window_border_width 1.0 + +#: The width (in pts) of window borders. Will be rounded to the +#: nearest number of pixels based on screen resolution. Note that +#: borders are displayed only when more than one window is visible. +#: They are meant to separate multiple windows. + +# draw_minimal_borders yes + +#: Draw only the minimum borders needed. This means that only the +#: minimum needed borders for inactive windows are drawn. That is only +#: the borders that separate the inactive window from a neighbor. Note +#: that setting a non-zero window margin overrides this and causes all +#: borders to be drawn. + +# window_margin_width 0.0 + +#: The window margin (in pts) (blank area outside the border) + +# single_window_margin_width -1000.0 + +#: The window margin (in pts) to use when only a single window is +#: visible. Negative values will cause the value of +#: window_margin_width to be used instead. + +# window_padding_width 0.0 + +#: The window padding (in pts) (blank area between the text and the +#: window border) + +# active_border_color #00ff00 + +#: The color for the border of the active window + +# inactive_border_color #cccccc + +#: The color for the border of inactive windows + +# bell_border_color #ff5a00 + +#: The color for the border of inactive windows in which a bell has +#: occurred + +# inactive_text_alpha 1.0 + +#: Fade the text in inactive windows by the specified amount (a number +#: between zero and one, with zero being fully faded). + +#: }}} + +#: Tab bar {{{ + +# tab_bar_edge bottom + +#: Which edge to show the tab bar on, top or bottom + +# tab_bar_margin_width 0.0 + +#: The margin to the left and right of the tab bar (in pts) + +# tab_bar_style fade + +#: The tab bar style, can be one of: fade or separator. In the fade +#: style, each tab's edges fade into the background color, in the +#: separator style, tabs are separated by a configurable separator. + +# tab_fade 0.25 0.5 0.75 1 + +#: Control how each tab fades into the background when using fade for +#: the tab_bar_style. Each number is an alpha (between zero and one) +#: that controls how much the corresponding cell fades into the +#: background, with zero being no fade and one being full fade. You +#: can change the number of cells used by adding/removing entries to +#: this list. + +# tab_separator " ┇" + +#: The separator between tabs in the tab bar when using separator as +#: the tab_bar_style. + +# active_tab_foreground #000 +# active_tab_background #eee +# active_tab_font_style bold-italic +# inactive_tab_foreground #444 +# inactive_tab_background #999 +# inactive_tab_font_style normal + +#: Tab bar colors and styles + +#: }}} + +#: Color scheme {{{ + +background #202020 +foreground #CCCCCC + +color0 #666666 +color8 #999999 +color1 #CC6699 +color9 #FF99CC +color2 #99CC66 +color10 #CCFF99 +color3 #CC9966 +color11 #FFCC99 +color4 #6699CC +color12 #99CCFF +color5 #9966CC +color13 #CC99FF +color6 #66CC99 +color14 #99FFCC +color7 #CCCCCC +color15 #FFFFFF +# foreground #dddddd +# background #000000 + +#: The foreground and background colors + +background_opacity .8 +dynamic_background_opacity yes + +#: The opacity of the background. A number between 0 and 1, where 1 is +#: opaque and 0 is fully transparent. This will only work if +#: supported by the OS (for instance, when using a compositor under +#: X11). Note that it only sets the default background color's +#: opacity. This is so that things like the status bar in vim, +#: powerline prompts, etc. still look good. But it means that if you +#: use a color theme with a background color in your editor, it will +#: not be rendered as transparent. Instead you should change the +#: default background color in your kitty config and not use a +#: background color in the editor color scheme. Or use the escape +#: codes to set the terminals default colors in a shell script to +#: launch your editor. Be aware that using a value less than 1.0 is a +#: (possibly significant) performance hit. If you want to dynamically +#: change transparency of windows set dynamic_background_opacity to +#: yes (this is off by default as it has a performance cost) + +# dim_opacity 0.75 + +#: How much to dim text that has the DIM/FAINT attribute set. One +#: means no dimming and zero means fully dimmed (i.e. invisible). + +# selection_foreground #000000 +# selection_background #FFFACD + +#: The foreground and background for text selected with the mouse + + +#: The 16 terminal colors. There are 8 basic colors, each color has a +#: dull and bright version. You can also set the remaining colors from +#: the 256 color table as color16 to color255. + +# color0 #000000 +# color8 #767676 + +#: black + +# color1 #cc0403 +# color9 #f2201f + +#: red + +# color2 #19cb00 +# color10 #23fd00 + +#: green + +# color3 #cecb00 +# color11 #fffd00 + +#: yellow + +# color4 #0d73cc +# color12 #1a8fff + +#: blue + +# color5 #cb1ed1 +# color13 #fd28ff + +#: magenta + +# color6 #0dcdcd +# color14 #14ffff + +#: cyan + +# color7 #dddddd +# color15 #ffffff + +#: white + +#: }}} + +#: Advanced {{{ + +# shell . + +#: The shell program to execute. The default value of . means to use +#: whatever shell is set as the default shell for the current user. +#: Note that on macOS if you change this, you might need to add +#: --login to ensure that the shell starts in interactive mode and +#: reads its startup rc files. + +# editor . + +#: The console editor to use when editing the kitty config file or +#: similar tasks. A value of . means to use the environment variable +#: EDITOR. Note that this environment variable has to be set not just +#: in your shell startup scripts but system-wide, otherwise kitty will +#: not see it. + +# close_on_child_death no + +#: Close the window when the child process (shell) exits. If no (the +#: default), the terminal will remain open when the child exits as +#: long as there are still processes outputting to the terminal (for +#: example disowned or backgrounded processes). If yes, the window +#: will close as soon as the child process exits. Note that setting it +#: to yes means that any background processes still using the terminal +#: can fail silently because their stdout/stderr/stdin no longer work. + +# allow_remote_control no + +#: Allow other programs to control kitty. If you turn this on other +#: programs can control all aspects of kitty, including sending text +#: to kitty windows, opening new windows, closing windows, reading the +#: content of windows, etc. Note that this even works over ssh +#: connections. + +# env + +#: Specify environment variables to set in all child processes. Note +#: that environment variables are expanded recursively, so if you +#: use:: + +#: env MYVAR1=a +#: env MYVAR2=${MYVAR}/${HOME}/b + +#: The value of MYVAR2 will be a//b. + +# startup_session none + +#: Path to a session file to use for all kitty instances. Can be +#: overridden by using the kitty --session command line option for +#: individual instances. See +#: https://sw.kovidgoyal.net/kitty/index.html#sessions in the kitty +#: documentation for details. Note that relative paths are interpreted +#: with respect to the kitty config directory. Environment variables +#: in the path are expanded. + +# clipboard_control write-clipboard write-primary + +#: Allow programs running in kitty to read and write from the +#: clipboard. You can control exactly which actions are allowed. The +#: set of possible actions is: write-clipboard read-clipboard write- +#: primary read-primary The default is to allow writing to the +#: clipboard and primary selection. Note that enabling the read +#: functionality is a security risk as it means that any program, even +#: one running on a remote server via SSH can read your clipboard. + +# term xterm-kitty + +#: The value of the TERM environment variable to set. Changing this +#: can break many terminal programs, only change it if you know what +#: you are doing, not because you read some advice on Stack Overflow +#: to change it. The TERM variable if used by various programs to get +#: information about the capabilities and behavior of the terminal. If +#: you change it, depending on what programs you run, and how +#: different the terminal you are changing it to is, various things +#: from key-presses, to colors, to various advanced features may not +#: work. + +#: }}} + +#: OS specific tweaks {{{ + +# macos_titlebar_color system + +#: Change the color of the kitty window's titlebar on macOS. A value +#: of system means to use the default system color, a value of +#: background means to use the background color of the currently +#: active window and finally you can use an arbitrary color, such as +#: #12af59 or red. WARNING: This option works by using a hack, as +#: there is no proper Cocoa API for it. It sets the background color +#: of the entire window and makes the titlebar transparent. As such it +#: is incompatible with background_opacity. If you want to use both, +#: you are probably better off just hiding the titlebar with +#: macos_hide_titlebar. + +# macos_hide_titlebar no + +#: Hide the kitty window's title bar on macOS. + +# x11_hide_window_decorations no + +#: Hide the window decorations (title bar and window borders) on X11 +#: and Wayland. Whether this works and exactly what effect it has +#: depends on the window manager, as it is the job of the window +#: manager/compositor to draw window decorations. + +# macos_option_as_alt yes + +#: Use the option key as an alt key. With this set to no, kitty will +#: use the macOS native Option+Key = unicode character behavior. This +#: will break any Alt+key keyboard shortcuts in your terminal +#: programs, but you can use the macOS unicode input technique. + +# macos_hide_from_tasks no + +#: Hide the kitty window from running tasks (Option+Tab) on macOS. + +# macos_quit_when_last_window_closed no + +#: Have kitty quit when all the top-level windows are closed. By +#: default, kitty will stay running, even with no open windows, as is +#: the expected behavior on macOS. + +# macos_window_resizable yes + +#: Disable this if you want kitty top-level (OS) windows to not be +#: resizable on macOS. + +# macos_thicken_font 0 + +#: Draw an extra border around the font with the given width, to +#: increase legibility at small font sizes. For example, a value of +#: 0.75 will result in rendering that looks similar to sub-pixel +#: antialiasing at common font sizes. + +# macos_traditional_fullscreen no + +#: Use the traditional full-screen transition, that is faster, but +#: less pretty. + +# macos_custom_beam_cursor no + +#: Enable/disable custom mouse cursor for macOS that is easier to see +#: on both light and dark backgrounds. WARNING: this might make your +#: mouse cursor invisible on dual GPU machines. + +#: }}} + +#: Keyboard shortcuts {{{ + +#: For a list of key names, see: GLFW keys +#: . The name to use +#: is the part after the GLFW_KEY_ prefix. For a list of modifier +#: names, see: GLFW mods +#: + +#: On Linux you can also use XKB key names to bind keys that are not +#: supported by GLFW. See XKB keys +#: for a list of key names. The name to use is the part +#: after the XKB_KEY_ prefix. Note that you should only use an XKB key +#: name for keys that are not present in the list of GLFW keys. + +#: Finally, you can use raw system key codes to map keys. To see the +#: system key code for a key, start kitty with the kitty --debug- +#: keyboard option. Then kitty will output some debug text for every +#: key event. In that text look for ``native_code`` the value of that +#: becomes the key name in the shortcut. For example: + +#: .. code-block:: none + +#: on_key_input: glfw key: 65 native_code: 0x61 action: PRESS mods: 0x0 text: 'a' + +#: Here, the key name for the A key is 0x61 and you can use it with:: + +#: map ctrl+0x61 something + +#: to map ctrl+a to something. + +#: You can use the special action no_op to unmap a keyboard shortcut +#: that is assigned in the default configuration. + +#: You can combine multiple actions to be triggered by a single +#: shortcut, using the syntax below:: + +#: map key combine action1 action2 action3 ... + +#: For example:: + +#: map kitty_mod+e combine : new_window : next_layout + +#: this will create a new window and switch to the next available +#: layout + +#: You can use multi-key shortcuts using the syntax shown below:: + +#: map key1>key2>key3 action + +#: For example:: + +#: map ctrl+f>2 set_font_size 20 + +# kitty_mod ctrl+shift + +#: The value of kitty_mod is used as the modifier for all default +#: shortcuts, you can change it in your kitty.conf to change the +#: modifiers for all the default shortcuts. + +# clear_all_shortcuts no + +#: You can have kitty remove all shortcut definition seen up to this +#: point. Useful, for instance, to remove the default shortcuts. + +#: Clipboard {{{ + +# map kitty_mod+c copy_to_clipboard +# map kitty_mod+v paste_from_clipboard +# map kitty_mod+s paste_from_selection +# map shift+insert paste_from_selection +# map kitty_mod+o pass_selection_to_program + +#: You can also pass the contents of the current selection to any +#: program using pass_selection_to_program. By default, the system's +#: open program is used, but you can specify your own, for example:: + +#: map kitty_mod+o pass_selection_to_program firefox + +#: You can pass the current selection to a terminal program running in +#: a new kitty window, by using the @selection placeholder:: + +#: map kitty_mod+y new_window less @selection + +#: }}} + +#: Scrolling {{{ + +# map kitty_mod+up scroll_line_up +# map kitty_mod+k scroll_line_up +# map kitty_mod+down scroll_line_down +# map kitty_mod+j scroll_line_down +# map kitty_mod+page_up scroll_page_up +# map kitty_mod+page_down scroll_page_down +# map kitty_mod+home scroll_home +# map kitty_mod+end scroll_end +# map kitty_mod+h show_scrollback + +#: You can pipe the contents of the current screen + history buffer as +#: STDIN to an arbitrary program using the ``pipe`` function. For +#: example, the following opens the scrollback buffer in less in an +#: overlay window:: + +#: map f1 pipe @ansi overlay less +G -R + +#: Placeholders available are: @text (which is plain text) and @ansi +#: (which includes text styling escape codes). For only the current +#: screen, use @screen or @ansi_screen. For the secondary screen, use +#: @alternate and @ansi_alternate. The secondary screen is the screen +#: not currently displayed. For example if you run a fullscreen +#: terminal application, the secondary screen will be the screen you +#: return to when quitting the application. You can also use ``none`` +#: for no STDIN input. + +#: To open in a new window, tab or new OS window, use ``window``, +#: ``tab``, or ``os_window`` respectively. You can also use ``none`` +#: in which case the data will be piped into the program without +#: creating any windows, useful if the program is a GUI program that +#: creates its own windows. + +#: }}} + +#: Window management {{{ + +# map kitty_mod+enter new_window + +#: You can open a new window running an arbitrary program, for +#: example:: + +#: map kitty_mod+y new_window mutt + +#: You can open a new window with the current working directory set to +#: the working directory of the current window using:: + +#: map ctrl+alt+enter new_window_with_cwd + +#: You can open a new window that is allowed to control kitty via the +#: kitty remote control facility by prefixing the command line with @. +#: Any programs running in that window will be allowed to control +#: kitty. For example:: + +#: map ctrl+enter new_window @ some_program + +# map kitty_mod+n new_os_window +# map kitty_mod+w close_window +# map kitty_mod+] next_window +# map kitty_mod+[ previous_window +# map kitty_mod+f move_window_forward +# map kitty_mod+b move_window_backward +# map kitty_mod+` move_window_to_top +# map kitty_mod+r start_resizing_window +# map kitty_mod+1 first_window +# map kitty_mod+2 second_window +# map kitty_mod+3 third_window +# map kitty_mod+4 fourth_window +# map kitty_mod+5 fifth_window +# map kitty_mod+6 sixth_window +# map kitty_mod+7 seventh_window +# map kitty_mod+8 eighth_window +# map kitty_mod+9 ninth_window +# map kitty_mod+0 tenth_window +#: }}} + +#: Tab management {{{ + +# map kitty_mod+right next_tab +# map kitty_mod+left previous_tab +# map kitty_mod+t new_tab +# map kitty_mod+q close_tab +# map kitty_mod+. move_tab_forward +# map kitty_mod+, move_tab_backward +# map kitty_mod+alt+t set_tab_title + +#: You can also create shortcuts to go to specific tabs, with 1 being +#: the first tab:: + +#: map ctrl+alt+1 goto_tab 1 +#: map ctrl+alt+2 goto_tab 2 + +#: Just as with new_window above, you can also pass the name of +#: arbitrary commands to run when using new_tab and use +#: new_tab_with_cwd. Finally, if you want the new tab to open next to +#: the current tab rather than at the end of the tabs list, use:: + +#: map ctrl+t new_tab !neighbor [optional cmd to run] +#: }}} + +#: Layout management {{{ + +# map kitty_mod+l next_layout + +#: You can also create shortcuts to switch to specific layouts:: + +#: map ctrl+alt+t goto_layout tall +#: map ctrl+alt+s goto_layout stack + +#: Similarly, to switch back to the previous layout:: + +#: map ctrl+alt+p last_used_layout +#: }}} + +#: Font sizes {{{ + +#: You can change the font size for all top-level kitty windows at a +#: time or only the current one. + +# map kitty_mod+equal change_font_size all +2.0 +# map kitty_mod+minus change_font_size all -2.0 +# map kitty_mod+backspace change_font_size all 0 + +#: To setup shortcuts for specific font sizes:: + +#: map kitty_mod+f6 change_font_size all 10.0 + +#: To setup shortcuts to change only the current window's font size:: + +#: map kitty_mod+f6 change_font_size current 10.0 +#: }}} + +#: Select and act on visible text {{{ + +#: Use the hints kitten to select text and either pass it to an +#: external program or insert it into the terminal or copy it to the +#: clipboard. + +# map kitty_mod+e kitten hints + +#: Open a currently visible URL using the keyboard. The program used +#: to open the URL is specified in open_url_with. + +# map kitty_mod+p>f kitten hints --type path --program - + +#: Select a path/filename and insert it into the terminal. Useful, for +#: instance to run git commands on a filename output from a previous +#: git command. + +# map kitty_mod+p>shift+f kitten hints --type path + +#: Select a path/filename and open it with the default open program. + +# map kitty_mod+p>l kitten hints --type line --program - + +#: Select a line of text and insert it into the terminal. Use for the +#: output of things like: ls -1 + +# map kitty_mod+p>w kitten hints --type word --program - + +#: Select words and insert into terminal. + +# map kitty_mod+p>h kitten hints --type hash --program - + +#: Select something that looks like a hash and insert it into the +#: terminal. Useful with git, which uses sha1 hashes to identify +#: commits + + +#: The hints kitten has many more modes of operation that you can map +#: to different shortcuts. For a full description see kittens/hints. +#: }}} + +#: Miscellaneous {{{ + +# map kitty_mod+f11 toggle_fullscreen +# map kitty_mod+u kitten unicode_input +# map kitty_mod+f2 edit_config_file +# map kitty_mod+escape kitty_shell window + +#: Open the kitty shell in a new window/tab/overlay/os_window to +#: control kitty using commands. + +# map kitty_mod+a>m set_background_opacity +0.1 +# map kitty_mod+a>l set_background_opacity -0.1 +# map kitty_mod+a>1 set_background_opacity 1 +# map kitty_mod+a>d set_background_opacity default +# map kitty_mod+delete clear_terminal reset active + +#: You can create shortcuts to clear/reset the terminal. For example:: + +#: map kitty_mod+f9 clear_terminal reset active +#: map kitty_mod+f10 clear_terminal clear active +#: map kitty_mod+f11 clear_terminal scrollback active + +#: These will reset screen/clear screen/clear screen+scrollback +#: respectively. If you want to operate on all windows instead of just +#: the current one, use all instead of :italic`active`. + + +#: You can tell kitty to send arbitrary (UTF-8) encoded text to the +#: client program when pressing specified shortcut keys. For example:: + +#: map ctrl+alt+a send_text all Special text + +#: This will send "Special text" when you press the ctrl+alt+a key +#: combination. The text to be sent is a python string literal so you +#: can use escapes like \x1b to send control codes or \u21fb to send +#: unicode characters (or you can just input the unicode characters +#: directly as UTF-8 text). The first argument to send_text is the +#: keyboard modes in which to activate the shortcut. The possible +#: values are normal or application or kitty or a comma separated +#: combination of them. The special keyword all means all modes. The +#: modes normal and application refer to the DECCKM cursor key mode +#: for terminals, and kitty refers to the special kitty extended +#: keyboard protocol. + +#: Another example, that outputs a word and then moves the cursor to +#: the start of the line (same as pressing the Home key):: + +#: map ctrl+alt+a send_text normal Word\x1b[H +#: map ctrl+alt+a send_text application Word\x1bOH + +#: }}} + +# }}} diff --git a/.config/mimeapps.list b/.config/mimeapps.list new file mode 100644 index 0000000..3fc14b1 --- /dev/null +++ b/.config/mimeapps.list @@ -0,0 +1,21 @@ +[Default Applications] +x-scheme-handler/magnet=transmission.desktop +x-scheme-handler/http=qutebrowser.desktop +x-scheme-handler/https=qutebrowser.desktop +x-scheme-handler/ftp=qutebrowser.desktop +x-scheme-handler/chrome=qutebrowser.desktop +text/html=qutebrowser.desktop +application/octet-stream=qutebrowser.desktop +application/x-extension-htm=qutebrowser.desktop +application/x-extension-html=qutebrowser.desktop +application/x-extension-shtml=qutebrowser.desktop +application/xhtml+xml=qutebrowser.desktop +application/x-extension-xhtml=qutebrowser.desktop +application/x-extension-xht=qutebrowser.desktop +x-scheme-handler/tg=telegramdesktop.desktop +application/pdf=org.pwmt.zathura.desktop +image/jpeg=sxiv.desktop + +[Added Associations] +text/csv=libreoffice-calc.desktop; +application/vnd.ms-excel=libreoffice-calc.desktop; diff --git a/.config/mpv/input.conf b/.config/mpv/input.conf new file mode 100644 index 0000000..4fdfbe6 --- /dev/null +++ b/.config/mpv/input.conf @@ -0,0 +1,232 @@ +# mpv keybindings +# +# Location of user-defined bindings: ~/.config/mpv/input.conf +# +# Lines starting with # are comments. Use SHARP to assign the # key. +# Copy this file and uncomment and edit the bindings you want to change. +# +# List of commands and further details: DOCS/man/input.rst +# List of special keys: --input-keylist +# Keybindings testing mode: mpv --input-test --force-window --idle +# +# Use 'ignore' to unbind a key fully (e.g. 'ctrl+a ignore'). +# +# Strings need to be quoted and escaped: +# KEY show_text "This is a single backslash: \\ and a quote: \" !" +# +# You can use modifier-key combinations like Shift+Left or Ctrl+Alt+x with +# the modifiers Shift, Ctrl, Alt and Meta (may not work on the terminal). +# +# The default keybindings are hardcoded into the mpv binary. +# You can disable them completely with: --no-input-default-bindings + +# Developer note: +# On compilation, this file is baked into the mpv binary, and all lines are +# uncommented (unless '#' is followed by a space) - thus this file defines the +# default key bindings. + +# If this is enabled, treat all the following bindings as default. +#default-bindings start + +#MOUSE_BTN0 ignore # don't do anything +#MOUSE_BTN0_DBL cycle fullscreen # toggle fullscreen on/off +#MOUSE_BTN2 cycle pause # toggle pause on/off +MOUSE_BTN3 ignore +MOUSE_BTN4 ignore +MOUSE_BTN5 ignore +MOUSE_BTN6 ignore + +# Mouse wheels, touchpad or other input devices that have axes +# if the input devices supports precise scrolling it will also scale the +# numeric value accordingly +AXIS_UP ignore +AXIS_DOWN ignore +AXIS_LEFT ignore +AXIS_RIGHT ignore + +a cycle audio +KP7 seek -3 +KP9 seek 3 +KP4 seek -30 +KP6 seek 30 +KP1 seek -60 +KP3 seek 60 +KP2 add volume -2 +KP8 add volume 2 +/ add sub-delay -0.1 +* add sub-delay 0.1 ++ add audio-delay -0.1 +- add audio-delay 0.1 +n playlist_next +m playlist_prev +KP0 show_progress +w show_text "${playlist}" +## Seek units are in seconds, but note that these are limited by keyframes +#RIGHT seek 5 +#LEFT seek -5 +#UP seek 60 +#DOWN seek -60 +# Do smaller, always exact (non-keyframe-limited), seeks with shift. +# Don't show them on the OSD (no-osd). +#Shift+RIGHT no-osd seek 1 - exact +#Shift+LEFT no-osd seek -1 - exact +#Shift+UP no-osd seek 5 - exact +#Shift+DOWN no-osd seek -5 - exact +# Skip to previous/next subtitle (subject to some restrictions; see manpage) +#Ctrl+LEFT no-osd sub_seek -1 +#Ctrl+RIGHT no-osd sub_seek 1 +#PGUP add chapter 1 # skip to next chapter +#PGDWN add chapter -1 # skip to previous chapter +#Shift+PGUP seek 600 +#Shift+PGDWN seek -600 +#[ multiply speed 0.9091 # scale playback speed +#] multiply speed 1.1 +#{ multiply speed 0.5 +#} multiply speed 2.0 +#BS set speed 1.0 # reset speed to normal +#q quit +#Q quit_watch_later +#q {encode} quit +#ESC set fullscreen no +#ESC {encode} quit +#p cycle pause # toggle pause/playback mode +#. frame_step # advance one frame and pause +#, frame_back_step # go back by one frame and pause +#SPACE cycle pause +#> playlist_next # skip to next file +#ENTER playlist_next # skip to next file +#< playlist_prev # skip to previous file +#O osd # cycle through OSD mode +#o show_progress +#P show_progress +#I show_text "${filename}" # display filename in osd +#z add sub-delay -0.1 # subtract 100 ms delay from subs +#x add sub-delay +0.1 # add +#ctrl++ add audio-delay 0.100 # this changes audio/video sync +#ctrl+- add audio-delay -0.100 +#9 add volume -2 +#/ add volume -2 +#0 add volume 2 +#* add volume 2 +#m cycle mute +#1 add contrast -1 +#2 add contrast 1 +#3 add brightness -1 +#4 add brightness 1 +#5 add gamma -1 +#6 add gamma 1 +#7 add saturation -1 +#8 add saturation 1 +#d cycle framedrop # cycle through framedrop modes +# toggle deinterlacer (automatically inserts or removes required filter) +#D cycle deinterlace +#r add sub-pos -1 # move subtitles up +#t add sub-pos +1 # down +#v cycle sub-visibility +# stretch SSA/ASS subtitles with anamorphic videos to match historical +#V cycle ass-vsfilter-aspect-compat +#j cycle sub # cycle through subtitles +#J cycle sub down # ...backwards +#SHARP cycle audio # switch audio streams +#_ cycle video +#T cycle ontop # toggle video window ontop of other windows +#f cycle fullscreen # toggle fullscreen +#s screenshot # take a screenshot +#S screenshot video # ...without subtitles +#Alt+s screenshot - each-frame # automatically screenshot every frame +#w add panscan -0.1 # zoom out with -panscan 0 -fs +#e add panscan +0.1 # in +# cycle video aspect ratios; "-1" is the container aspect +#A cycle_values video-aspect "16:9" "4:3" "2.35:1" "-1" +#POWER quit +#MENU cycle osd +#PLAY cycle pause +#PAUSE cycle pause +#PLAYPAUSE cycle pause +#STOP quit +#FORWARD seek 60 +#REWIND seek -60 +#NEXT playlist_next +#PREV playlist_prev +#VOLUME_UP add volume 2 +#VOLUME_DOWN add volume -2 +#MUTE cycle mute +#CLOSE_WIN quit +#CLOSE_WIN {encode} quit +#E cycle edition # next edition +#l ab_loop # Set/clear A-B loop points +#ctrl+c quit + +# Apple Remote section +#AR_PLAY cycle pause +#AR_PLAY_HOLD quit +#AR_CENTER cycle pause +#AR_CENTER_HOLD quit +#AR_NEXT seek 10 +#AR_NEXT_HOLD seek 120 +#AR_PREV seek -10 +#AR_PREV_HOLD seek -120 +#AR_MENU show_progress +#AR_MENU_HOLD cycle mute +#AR_VUP add volume 2 +#AR_VUP_HOLD add chapter 1 +#AR_VDOWN add volume -2 +#AR_VDOWN_HOLD add chapter -1 + +# Joystick section +# WARNING: joystick support has to be explicitly enabled at +# compiletime with --enable-joystick +# + +#JOY_AXIS0_PLUS seek 10 +#JOY_AXIS0_MINUS seek -10 +#JOY_AXIS1_MINUS seek 60 +#JOY_AXIS1_PLUS seek -60 +#JOY_BTN0 cycle pause +#JOY_BTN1 cycle osd +#JOY_BTN2 add volume 2 +#JOY_BTN3 add volume -2 + +# For dvdnav:// and bdnav:// + +# navigation controls during playback +#ENTER {discnav} discnav menu # DISCNAV MENU +# BS {discnav} discnav prev # DISCNAV PREVIOUS menu (in the order chapter->title->root) +# navigation controls when showing menu (additionally to the controls above) +#UP {discnav-menu} discnav up # DISCNAV UP +#DOWN {discnav-menu} discnav down # DISCNAV DOWN +#LEFT {discnav-menu} discnav left # DISCNAV LEFT +#RIGHT {discnav-menu} discnav right # DISCNAV RIGHT +#ENTER {discnav-menu} discnav select # DISCNAV SELECT (ok) +#MOUSE_BTN0 {discnav-menu} discnav mouse +#MOUSE_MOVE {discnav-menu} discnav mouse_move + +# For tv:// +#h cycle tv-channel -1 # previous channel +#k cycle tv-channel +1 # next channel + +# +# Legacy bindings (may or may not be removed in the future) +# +#! add chapter -1 # skip to previous chapter +#@ add chapter 1 # next + +# +# Not assigned by default +# (not an exhaustive list of unbound commands) +# + +# ? add sub-scale +0.1 # increase subtitle font size +# ? add sub-scale -0.1 # decrease subtitle font size +# ? sub_step -1 # immediately display next subtitle +# ? sub_step +1 # previous +# ? cycle_values window-scale 0.5 2 1 # switch between 1/2, 2x, unresized window size +# ? cycle colormatrix +# ? add audio-delay 0.100 # this changes audio/video sync +# ? add audio-delay -0.100 +# ? cycle angle # switch DVD/Bluray angle +# ? add balance -0.1 # adjust audio balance in favor of left +# ? add balance 0.1 # right +# ? cycle sub-forced-only # toggle DVD forced subs +# ? cycle program # cycle transport stream programs +# ? stop # stop playback (quit or enter idle mode) diff --git a/.config/mpv/mpv.conf b/.config/mpv/mpv.conf new file mode 100644 index 0000000..8be1578 --- /dev/null +++ b/.config/mpv/mpv.conf @@ -0,0 +1,135 @@ +# +# mpv configuration file +# +# Configuration files are read system-wide from /usr/local/etc/mpv.conf +# and per-user from ~/.config/mpv/mpv.conf, where per-user settings override +# system-wide settings, all of which are overridden by the command line. +# +# Configuration file settings and the command line options use the same +# underlying mechanisms. Most options can be put into the configuration file +# by dropping the preceding '--'. See the man page for a complete list of +# options. +# +# Lines starting with '#' are comments and are ignored. +# +# See the CONFIGURATION FILES section in the man page +# for a detailed description of the syntax. +# +# Profiles should be placed at the bottom of the configuration file to ensure +# that settings wanted as defaults are not restricted to specific profiles. +# +# Note that the commented example options usually do _not_ set the default +# values. Calling mpv with --list-options is a nice way to see the default +# values for most options. + +################## +# video settings # +################## + +# Specify default video driver (see --vo=help for a list). +vo=gpu +# waitvsync=enabled + +# Start in fullscreen mode by default. +fs=no +#vf=delogo=x:y:w:h:t(thickness fuzzy edge):show(show rectangle) #blur a tv logo + +# force starting with centered window +#geometry=50%:50% + +# don't allow a new window to have a size larger than 90% of the screen size +#autofit-larger=90%x90% + +# Disable the On Screen Controller (OSC). +osc=no + +# Keep the player window on top of all other windows. +#ontop=yes + +################## +# audio settings # +################## + +# Specify default audio driver (see --ao=help for a list). +#ao=alsa + +# Disable softvol usage, and always use the system mixer if available. +# softvol=yes + +# Scale audio tempo by playback speed without altering pitch. (By default does +# nothing if playback speed is not changed. May introduce artifacts.) +#af=scaletempo +#af=bs2b #binaural for headphones, uses libbs2b (install needed) +# af=drc=2:0.25 + +# Output 5.1 audio natively, and upmix/downmix audio with a different format. +#audio-channels=5.1 +# Disable any automatic remix, _if_ the audio output accepts the audio format. +# of the currently played file. +#audio-channels=empty + +################## +# other settings # +################## + +sub-font-size=40 +osd-font-size=40 +keep-open=yes +osd-bar=no +# Pretend to be a web browser. Might fix playback with some streaming sites, +# but also will break with shoutcast streams. +#user-agent="Mozilla/5.0" + +# cache settings +# +# Use 8MB input cache by default. The cache is enabled for network streams only. +#cache-default=8192 +# +# Use 8MB input cache for everything, even local files. +#cache=8192 +# +# If a seek is issued, and the target is 1024KB past the cached range, then +# keep reading until the seek target is hit, instead of doing a real seek. +#cache-seek-min=1024 +# +# Disable the behavior that the player will pause if the cache goes below a +# certain fill size. +#cache-pause=no +# +# Read ahead about 5 seconds of audio and video packets. +#demuxer-readahead-secs=5.0 + +# Display English subtitles if available. +slang=en + +# Play Finnish audio if available, fall back to English otherwise. +alang=en + +# Change subtitle encoding. For Arabic subtitles use 'cp1256'. +# If the file seems to be valid UTF-8, prefer UTF-8. +#sub-codepage=utf8:cp1256 + +# Enable hardware decoding if available. Often, this requires using an certain +# video output, otherwise no hardware decoding will be used. +hwdec=vaapi + +############ +# Profiles # +############ + +# The options declared as part of profiles override global default settings, +# but only take effect when the profile is active. + +# The following profile can be enabled on the command line with: --profile=vdpau + +#[vdpau] +# The profile forces the vdpau VO. +#vo=vdpau +# Use hardware decoding (this might break playback of some h264 files) +#hwdec=vdpau +# Most video filters do not work with hardware decoding. +#vf-clr=yes + + +# You can also include other configuration files. +#include=/path/to/the/file/you/want/to/include diff --git a/.config/nvim/UltiSnips/r.snippets b/.config/nvim/UltiSnips/r.snippets new file mode 100644 index 0000000..1262fdb --- /dev/null +++ b/.config/nvim/UltiSnips/r.snippets @@ -0,0 +1,46 @@ +snippet doc +#' ${1:Title} +#' +#' ${2:Description} +#' +#' ${3:Description text} +#' +#' @param $4 +#' @return $5 +#' @export +#' @examples +#' $6 + +endsnippet + +snippet fun +function($1) +{ + $2 +} + +endsnippet + +snippet if +if ($1) +{ + $2 +} + +endsnippet + +snippet ifelse +ifelse($1, $2, $3) +endsnippet + +snippet case +case_when($1 ~ $2, + $3 ~ $4, + ${5:T} ~ $6) + +endsnippet + +snippet lib +library(${1:tidyverse}) + +endsnippet diff --git a/.config/nvim/UltiSnips/rmd.snippets b/.config/nvim/UltiSnips/rmd.snippets new file mode 100644 index 0000000..dc72abb --- /dev/null +++ b/.config/nvim/UltiSnips/rmd.snippets @@ -0,0 +1,50 @@ +snippet --- +--- +title: $1 +output: + $2_document: +--- + +endsnippet + +snippet opts +opts_chunk$set(echo = ${1:F}, + message = ${2:F}, + error = ${3:F}, + warning = ${4:F}, + fig.width = ${5:12}, + fig.height = ${6:7}) + +endsnippet + +snippet fun +function($1) +{ + $2 +} + +endsnippet + +snippet if +if ($1) +{ + $2 +} + +endsnippet + +snippet ifelse +ifelse($1, $2, $3) +endsnippet + +snippet case +case_when($1 ~ $2, + $3 ~ $4, + ${5:T} ~ $6) + +endsnippet + +snippet lib +library(${1:tidyverse}) + +endsnippet diff --git a/.config/nvim/after/ftplugin/fugitive.vim b/.config/nvim/after/ftplugin/fugitive.vim new file mode 100644 index 0000000..0aa132d --- /dev/null +++ b/.config/nvim/after/ftplugin/fugitive.vim @@ -0,0 +1,13 @@ +noremap D D + +augroup custom_fugitive + autocmd! + autocmd VimEnter,BufWinEnter * if !empty(maparg('dd', 'n')) | + \ unmap dd| + \ unmap dp| + \ unmap dv| + \ unmap ds| + \ unmap dh| + \ unmap s| + \ endif +augroup END diff --git a/.config/nvim/after/ftplugin/git.vim b/.config/nvim/after/ftplugin/git.vim new file mode 100644 index 0000000..07f5afb --- /dev/null +++ b/.config/nvim/after/ftplugin/git.vim @@ -0,0 +1 @@ +set nofoldenable diff --git a/.config/nvim/after/ftplugin/gitcommit.vim b/.config/nvim/after/ftplugin/gitcommit.vim new file mode 100644 index 0000000..7f00408 --- /dev/null +++ b/.config/nvim/after/ftplugin/gitcommit.vim @@ -0,0 +1,12 @@ +noremap D D + +augroup custom_fugitive + autocmd! + autocmd VimEnter,BufWinEnter * if !empty(maparg('dd', 'n')) | + \ unmap dd| + \ unmap dp| + \ unmap dv| + \ unmap ds| + \ unmap dh| + \ endif +augroup END diff --git a/.config/nvim/after/ftplugin/html.vim b/.config/nvim/after/ftplugin/html.vim new file mode 100644 index 0000000..578b9d8 --- /dev/null +++ b/.config/nvim/after/ftplugin/html.vim @@ -0,0 +1 @@ +syntax region htmlFold start="<\z(\<\(area\|base\|br\|col\|command\|embed\|hr\|img\|input\|keygen\|link\|meta\|para\|source\|track\|wbr\>\)\@![a-z-]\+\>\)\%(\_s*\_[^/]\?>\|\_s\_[^>]*\_[^>/]>\)" end="" fold transparent keepend extend diff --git a/.config/nvim/after/ftplugin/python.vim b/.config/nvim/after/ftplugin/python.vim new file mode 100644 index 0000000..29db1ec --- /dev/null +++ b/.config/nvim/after/ftplugin/python.vim @@ -0,0 +1,7 @@ +" vimcmdline options +nnoremap :call VimCmdLineSendLine() +vnoremap :call VimCmdLineSendSelection() +nnoremap rq :call VimCmdLineQuit() +nnoremap :call VimCmdLineStartApp() +let cmdline_term_height = 25 + diff --git a/.config/nvim/after/ftplugin/r.vim b/.config/nvim/after/ftplugin/r.vim new file mode 100644 index 0000000..70db93d --- /dev/null +++ b/.config/nvim/after/ftplugin/r.vim @@ -0,0 +1,6 @@ +inoremap » %>% +tnoremap » %>% +tnoremap   +inoremap   + +" execute "normal \RStart" diff --git a/.config/nvim/after/ftplugin/rbrowser.vim b/.config/nvim/after/ftplugin/rbrowser.vim new file mode 100644 index 0000000..c27ea0b --- /dev/null +++ b/.config/nvim/after/ftplugin/rbrowser.vim @@ -0,0 +1,8 @@ +if !empty(maparg('\rl', 'n'))| +\ unmap \rl| +\ endif + +nmap rd :call RAction(".View") +nmap rl :call RAction("rm") +nmap rg :call RAction("qplot") +nmap rv :call RAction("table") diff --git a/.config/nvim/after/ftplugin/rmd.vim b/.config/nvim/after/ftplugin/rmd.vim new file mode 100644 index 0000000..003a583 --- /dev/null +++ b/.config/nvim/after/ftplugin/rmd.vim @@ -0,0 +1,14 @@ +inoremap » %>% +tnoremap » %>% + +let b:surround_99 = "```{r \1name\1}\n\r\n```" + +" execute "normal \RStart" + +" func! litprog#paintChunks() +" endfunc + +" augroup paintChunksCmd +" autocmd! +" autocmd CursorHold * call litprog#paintChunks() +" augroup END diff --git a/.config/nvim/after/ftplugin/vimwiki.vim b/.config/nvim/after/ftplugin/vimwiki.vim new file mode 100644 index 0000000..995508d --- /dev/null +++ b/.config/nvim/after/ftplugin/vimwiki.vim @@ -0,0 +1 @@ +inoremap pumvisible() ? "\" : "\" diff --git a/.config/nvim/after/syntax/elm.vim b/.config/nvim/after/syntax/elm.vim new file mode 100644 index 0000000..ec2c397 --- /dev/null +++ b/.config/nvim/after/syntax/elm.vim @@ -0,0 +1,7 @@ +syntax match lambda "\\" conceal cchar=λ +syntax match div "//" conceal cchar=÷ +syntax match mul "*" conceal cchar=× +syntax match neq1 contained "/" conceal cchar=! containedin=neq +syntax match neq "/=" contains=neq1 +setlocal conceallevel=2 +setlocal concealcursor=nvic diff --git a/.config/nvim/after/syntax/r.vim b/.config/nvim/after/syntax/r.vim new file mode 100644 index 0000000..4290b5f --- /dev/null +++ b/.config/nvim/after/syntax/r.vim @@ -0,0 +1,8 @@ +syntax region rFold start="#.\{-}[-=]\{4,}" end="\n\ze\n#.\{-}[-=]\{4,}" fold transparent keepend +syntax match pipe1 contained "%" conceal cchar=| containedin=pipe +syntax match pipe2 contained ">%" conceal cchar=> containedin=pipe +syntax match pipe "%>%" contains=pipe1,pipe2 +syntax match mul "*" conceal cchar=× +syntax match in "%in%" conceal cchar=∈ + +setlocal conceallevel=2 diff --git a/.config/nvim/after/syntax/rmd.vim b/.config/nvim/after/syntax/rmd.vim new file mode 100644 index 0000000..80d2d48 --- /dev/null +++ b/.config/nvim/after/syntax/rmd.vim @@ -0,0 +1 @@ +syntax region rFold start="#.\{-}[-=]\{4,}" end="\n\ze\n#.\{-}[-=]\{4,}" fold transparent keepend diff --git a/.config/nvim/after/syntax/vim.vim b/.config/nvim/after/syntax/vim.vim new file mode 100644 index 0000000..da26a54 --- /dev/null +++ b/.config/nvim/after/syntax/vim.vim @@ -0,0 +1,2 @@ +syn match vimMapRhs '.*\ze|\s*".*' +syn match vimLineComment '|\s*".*$' diff --git a/.config/nvim/autoload/customwiki2html.sh b/.config/nvim/autoload/customwiki2html.sh new file mode 100755 index 0000000..311cf87 --- /dev/null +++ b/.config/nvim/autoload/customwiki2html.sh @@ -0,0 +1,66 @@ +#!/bin/bash + +# +# This script converts markdown into html, to be used with vimwiki's +# "customwiki2html" option. Experiment with the two proposed methods by +# commenting / uncommenting the relevant lines below. +# +# NEW! An alternative converter was developed by Jason6Anderson, and can +# be located at https://github.com/vimwiki-backup/vimwiki/issues/384 +# +# +# To use this script, you must have the Discount converter installed. +# +# http://www.pell.portland.or.us/~orc/Code/discount/ +# +# To verify your installation, check that the commands markdown and mkd2text, +# are on your path. +# +# Also verify that this file is executable. +# +# Then, in your .vimrc file, set: +# +# g:vimwiki_customwiki2html=$HOME.'/.vim/autoload/vimwiki/customwiki2html.sh' +# +# On your next restart, Vimwiki will run this script instead of using the +# internal wiki2html converter. +# + +MARKDOWN=markdown +MKD2HTML=mkd2html + + +FORCE="$1" +SYNTAX="$2" +EXTENSION="$3" +OUTPUTDIR="$4" +INPUT="$5" +CSSFILE="$6" +TPLPATH="$7" +TPLDEF="$8" +TPLEXT="$9" + +FORCEFLAG= + +[ $FORCE -eq 0 ] || { FORCEFLAG="-f"; }; +[ $SYNTAX = "markdown" ] || { echo "Error: Unsupported syntax"; exit -2; }; + +OUTPUT="$OUTPUTDIR"/$(basename "$INPUT" .$EXTENSION).html + +TPL="$TPLPATH$TPLDEF$TPLEXT" + +# Method 1: +# markdown [-d] [-T] [-V] [-b url-base] [-C prefix] [-F bitmap] [-f flags] [-o file] [-s text] [-t text] [textfile] +OUT=`cat "$INPUT" | perl -pe 's/(\[.*?\]\(.*?)\)/\1.html)/g' | $MARKDOWN` + +cat $TPL | perl -pe "s|%content%|$OUT|" > "$OUTPUT" + +# Method 2: +# mkd2html [-css file] [-header string] [-footer string] [file] + +# $MKD2HTML -css "$CSSFILE" "$INPUT" +# OUTPUTTMP=$(dirname "$INPUT")/$(basename "$INPUT" ."$EXTENSION").html +# mv -f "$OUTPUTTMP" "$OUTPUT" + + + diff --git a/.config/nvim/autoload/plug.vim b/.config/nvim/autoload/plug.vim new file mode 100644 index 0000000..4e05630 --- /dev/null +++ b/.config/nvim/autoload/plug.vim @@ -0,0 +1,2526 @@ +" 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 ``-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 +" +" Permission is hereby granted, free of charge, to any person obtaining +" a copy of this software and associated documentation files (the +" "Software"), to deal in the Software without restriction, including +" without limitation the rights to use, copy, modify, merge, publish, +" distribute, sublicense, and/or sell copies of the Software, and to +" permit persons to whom the Software is furnished to do so, subject to +" the following conditions: +" +" The above copyright notice and this permission notice shall be +" included in all copies or substantial portions of the Software. +" +" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +" EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +" NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +" LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +" OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +" WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +if exists('g:loaded_plug') + finish +endif +let g:loaded_plug = 1 + +let s:cpo_save = &cpo +set cpo&vim + +let s:plug_src = 'https://github.com/junegunn/vim-plug.git' +let s:plug_tab = get(s:, 'plug_tab', -1) +let s:plug_buf = get(s:, 'plug_buf', -1) +let s:mac_gui = has('gui_macvim') && has('gui_running') +let s:is_win = has('win32') +let s:nvim = has('nvim-0.2') || (has('nvim') && exists('*jobwait') && !s:is_win) +let s:vim8 = has('patch-8.0.0039') && exists('*job_start') +let s:me = resolve(expand(':p')) +let s:base_spec = { 'branch': 'master', 'frozen': 0 } +let s:TYPE = { +\ 'string': type(''), +\ 'list': type([]), +\ 'dict': type({}), +\ 'funcref': type(function('call')) +\ } +let s:loaded = get(s:, 'loaded', {}) +let s:triggers = get(s:, 'triggers', {}) + +function! plug#begin(...) + if a:0 > 0 + let s:plug_home_org = a:1 + let home = s:path(fnamemodify(expand(a:1), ':p')) + elseif exists('g:plug_home') + let home = s:path(g:plug_home) + elseif !empty(&rtp) + let home = s:path(split(&rtp, ',')[0]) . '/plugged' + else + return s:err('Unable to determine plug home. Try calling plug#begin() with a path argument.') + endif + if fnamemodify(home, ':t') ==# 'plugin' && fnamemodify(home, ':h') ==# s:first_rtp + return s:err('Invalid plug home. '.home.' is a standard Vim runtime path and is not allowed.') + endif + + let g:plug_home = home + let g:plugs = {} + let g:plugs_order = [] + let s:triggers = {} + + call s:define_commands() + return 1 +endfunction + +function! s:define_commands() + command! -nargs=+ -bar Plug call plug#() + if !executable('git') + return s:err('`git` executable not found. Most commands will not be available. To suppress this message, prepend `silent!` to `call plug#begin(...)`.') + endif + command! -nargs=* -bar -bang -complete=customlist,s:names PlugInstall call s:install(0, []) + command! -nargs=* -bar -bang -complete=customlist,s:names PlugUpdate call s:update(0, []) + command! -nargs=0 -bar -bang PlugClean call s:clean(0) + command! -nargs=0 -bar PlugUpgrade if s:upgrade() | execute 'source' s:esc(s:me) | endif + command! -nargs=0 -bar PlugStatus call s:status() + command! -nargs=0 -bar PlugDiff call s:diff() + command! -nargs=? -bar -bang -complete=file PlugSnapshot call s:snapshot(0, ) +endfunction + +function! s:to_a(v) + return type(a:v) == s:TYPE.list ? a:v : [a:v] +endfunction + +function! s:to_s(v) + return type(a:v) == s:TYPE.string ? a:v : join(a:v, "\n") . "\n" +endfunction + +function! s:glob(from, pattern) + return s:lines(globpath(a:from, a:pattern)) +endfunction + +function! s:source(from, ...) + let found = 0 + for pattern in a:000 + for vim in s:glob(a:from, pattern) + execute 'source' s:esc(vim) + let found = 1 + endfor + endfor + return found +endfunction + +function! s:assoc(dict, key, val) + let a:dict[a:key] = add(get(a:dict, a:key, []), a:val) +endfunction + +function! s:ask(message, ...) + call inputsave() + echohl WarningMsg + let answer = input(a:message.(a:0 ? ' (y/N/a) ' : ' (y/N) ')) + echohl None + call inputrestore() + echo "\r" + return (a:0 && answer =~? '^a') ? 2 : (answer =~? '^y') ? 1 : 0 +endfunction + +function! s:ask_no_interrupt(...) + try + return call('s:ask', a:000) + catch + return 0 + endtry +endfunction + +function! s:lazy(plug, opt) + return has_key(a:plug, a:opt) && + \ (empty(s:to_a(a:plug[a:opt])) || + \ !isdirectory(a:plug.dir) || + \ len(s:glob(s:rtp(a:plug), 'plugin')) || + \ len(s:glob(s:rtp(a:plug), 'after/plugin'))) +endfunction + +function! plug#end() + if !exists('g:plugs') + return s:err('Call plug#begin() first') + endif + + if exists('#PlugLOD') + augroup PlugLOD + autocmd! + augroup END + augroup! PlugLOD + endif + let lod = { 'ft': {}, 'map': {}, 'cmd': {} } + + if exists('g:did_load_filetypes') + filetype off + endif + for name in g:plugs_order + if !has_key(g:plugs, name) + continue + endif + let plug = g:plugs[name] + if get(s:loaded, name, 0) || !s:lazy(plug, 'on') && !s:lazy(plug, 'for') + let s:loaded[name] = 1 + continue + endif + + if has_key(plug, 'on') + let s:triggers[name] = { 'map': [], 'cmd': [] } + for cmd in s:to_a(plug.on) + if cmd =~? '^.\+' + if empty(mapcheck(cmd)) && empty(mapcheck(cmd, 'i')) + call s:assoc(lod.map, cmd, name) + endif + call add(s:triggers[name].map, cmd) + elseif cmd =~# '^[A-Z]' + let cmd = substitute(cmd, '!*$', '', '') + if exists(':'.cmd) != 2 + call s:assoc(lod.cmd, cmd, name) + endif + call add(s:triggers[name].cmd, cmd) + else + call s:err('Invalid `on` option: '.cmd. + \ '. Should start with an uppercase letter or ``.') + endif + endfor + endif + + if has_key(plug, 'for') + let types = s:to_a(plug.for) + if !empty(types) + augroup filetypedetect + call s:source(s:rtp(plug), 'ftdetect/**/*.vim', 'after/ftdetect/**/*.vim') + augroup END + endif + for type in types + call s:assoc(lod.ft, type, name) + endfor + endif + endfor + + for [cmd, names] in items(lod.cmd) + execute printf( + \ 'command! -nargs=* -range -bang -complete=file %s call s:lod_cmd(%s, "", , , , %s)', + \ cmd, string(cmd), string(names)) + endfor + + for [map, names] in items(lod.map) + for [mode, map_prefix, key_prefix] in + \ [['i', '', ''], ['n', '', ''], ['v', '', 'gv'], ['o', '', '']] + execute printf( + \ '%snoremap %s %s:call lod_map(%s, %s, %s, "%s")', + \ mode, map, map_prefix, string(map), string(names), mode != 'i', key_prefix) + endfor + endfor + + for [ft, names] in items(lod.ft) + augroup PlugLOD + execute printf('autocmd FileType %s call lod_ft(%s, %s)', + \ ft, string(ft), string(names)) + augroup END + endfor + + call s:reorg_rtp() + filetype plugin indent on + if has('vim_starting') + if has('syntax') && !exists('g:syntax_on') + syntax enable + end + else + call s:reload_plugins() + endif +endfunction + +function! s:loaded_names() + return filter(copy(g:plugs_order), 'get(s:loaded, v:val, 0)') +endfunction + +function! s:load_plugin(spec) + call s:source(s:rtp(a:spec), 'plugin/**/*.vim', 'after/plugin/**/*.vim') +endfunction + +function! s:reload_plugins() + for name in s:loaded_names() + call s:load_plugin(g:plugs[name]) + endfor +endfunction + +function! s:trim(str) + return substitute(a:str, '[\/]\+$', '', '') +endfunction + +function! s:version_requirement(val, min) + for idx in range(0, len(a:min) - 1) + let v = get(a:val, idx, 0) + if v < a:min[idx] | return 0 + elseif v > a:min[idx] | return 1 + endif + endfor + return 1 +endfunction + +function! s:git_version_requirement(...) + if !exists('s:git_version') + let s:git_version = map(split(split(s:system('git --version'))[2], '\.'), 'str2nr(v:val)') + endif + return s:version_requirement(s:git_version, a:000) +endfunction + +function! s:progress_opt(base) + return a:base && !s:is_win && + \ s:git_version_requirement(1, 7, 1) ? '--progress' : '' +endfunction + +if s:is_win + function! s:rtp(spec) + return s:path(a:spec.dir . get(a:spec, 'rtp', '')) + endfunction + + function! s:path(path) + return s:trim(substitute(a:path, '/', '\', 'g')) + endfunction + + function! s:dirpath(path) + return s:path(a:path) . '\' + endfunction + + function! s:is_local_plug(repo) + return a:repo =~? '^[a-z]:\|^[%~]' + endfunction +else + function! s:rtp(spec) + return s:dirpath(a:spec.dir . get(a:spec, 'rtp', '')) + endfunction + + function! s:path(path) + return s:trim(a:path) + endfunction + + function! s:dirpath(path) + return substitute(a:path, '[/\\]*$', '/', '') + endfunction + + function! s:is_local_plug(repo) + return a:repo[0] =~ '[/$~]' + endfunction +endif + +function! s:err(msg) + echohl ErrorMsg + echom '[vim-plug] '.a:msg + echohl None +endfunction + +function! s:warn(cmd, msg) + echohl WarningMsg + execute a:cmd 'a:msg' + echohl None +endfunction + +function! s:esc(path) + return escape(a:path, ' ') +endfunction + +function! s:escrtp(path) + return escape(a:path, ' ,') +endfunction + +function! s:remove_rtp() + for name in s:loaded_names() + let rtp = s:rtp(g:plugs[name]) + execute 'set rtp-='.s:escrtp(rtp) + let after = globpath(rtp, 'after') + if isdirectory(after) + execute 'set rtp-='.s:escrtp(after) + endif + endfor +endfunction + +function! s:reorg_rtp() + if !empty(s:first_rtp) + execute 'set rtp-='.s:first_rtp + execute 'set rtp-='.s:last_rtp + endif + + " &rtp is modified from outside + if exists('s:prtp') && s:prtp !=# &rtp + call s:remove_rtp() + unlet! s:middle + endif + + let s:middle = get(s:, 'middle', &rtp) + let rtps = map(s:loaded_names(), 's:rtp(g:plugs[v:val])') + let afters = filter(map(copy(rtps), 'globpath(v:val, "after")'), '!empty(v:val)') + let rtp = join(map(rtps, 'escape(v:val, ",")'), ',') + \ . ','.s:middle.',' + \ . join(map(afters, 'escape(v:val, ",")'), ',') + let &rtp = substitute(substitute(rtp, ',,*', ',', 'g'), '^,\|,$', '', 'g') + let s:prtp = &rtp + + if !empty(s:first_rtp) + execute 'set rtp^='.s:first_rtp + execute 'set rtp+='.s:last_rtp + endif +endfunction + +function! s:doautocmd(...) + if exists('#'.join(a:000, '#')) + execute 'doautocmd' ((v:version > 703 || has('patch442')) ? '' : '') join(a:000) + endif +endfunction + +function! s:dobufread(names) + for name in a:names + let path = s:rtp(g:plugs[name]).'/**' + for dir in ['ftdetect', 'ftplugin'] + if len(finddir(dir, path)) + if exists('#BufRead') + doautocmd BufRead + endif + return + endif + endfor + endfor +endfunction + +function! plug#load(...) + if a:0 == 0 + return s:err('Argument missing: plugin name(s) required') + endif + if !exists('g:plugs') + return s:err('plug#begin was not called') + endif + let names = a:0 == 1 && type(a:1) == s:TYPE.list ? a:1 : a:000 + let unknowns = filter(copy(names), '!has_key(g:plugs, v:val)') + if !empty(unknowns) + let s = len(unknowns) > 1 ? 's' : '' + return s:err(printf('Unknown plugin%s: %s', s, join(unknowns, ', '))) + end + let unloaded = filter(copy(names), '!get(s:loaded, v:val, 0)') + if !empty(unloaded) + for name in unloaded + call s:lod([name], ['ftdetect', 'after/ftdetect', 'plugin', 'after/plugin']) + endfor + call s:dobufread(unloaded) + return 1 + end + return 0 +endfunction + +function! s:remove_triggers(name) + if !has_key(s:triggers, a:name) + return + endif + for cmd in s:triggers[a:name].cmd + execute 'silent! delc' cmd + endfor + for map in s:triggers[a:name].map + execute 'silent! unmap' map + execute 'silent! iunmap' map + endfor + call remove(s:triggers, a:name) +endfunction + +function! s:lod(names, types, ...) + for name in a:names + call s:remove_triggers(name) + let s:loaded[name] = 1 + endfor + call s:reorg_rtp() + + for name in a:names + let rtp = s:rtp(g:plugs[name]) + for dir in a:types + call s:source(rtp, dir.'/**/*.vim') + endfor + if a:0 + if !s:source(rtp, a:1) && !empty(s:glob(rtp, a:2)) + execute 'runtime' a:1 + endif + call s:source(rtp, a:2) + endif + call s:doautocmd('User', name) + endfor +endfunction + +function! s:lod_ft(pat, names) + let syn = 'syntax/'.a:pat.'.vim' + call s:lod(a:names, ['plugin', 'after/plugin'], syn, 'after/'.syn) + execute 'autocmd! PlugLOD FileType' a:pat + call s:doautocmd('filetypeplugin', 'FileType') + call s:doautocmd('filetypeindent', 'FileType') +endfunction + +function! s:lod_cmd(cmd, bang, l1, l2, args, names) + call s:lod(a:names, ['ftdetect', 'after/ftdetect', 'plugin', 'after/plugin']) + call s:dobufread(a:names) + execute printf('%s%s%s %s', (a:l1 == a:l2 ? '' : (a:l1.','.a:l2)), a:cmd, a:bang, a:args) +endfunction + +function! s:lod_map(map, names, with_prefix, prefix) + call s:lod(a:names, ['ftdetect', 'after/ftdetect', 'plugin', 'after/plugin']) + call s:dobufread(a:names) + let extra = '' + while 1 + let c = getchar(0) + if c == 0 + break + endif + let extra .= nr2char(c) + endwhile + + if a:with_prefix + let prefix = v:count ? v:count : '' + let prefix .= '"'.v:register.a:prefix + if mode(1) == 'no' + if v:operator == 'c' + let prefix = "\" . prefix + endif + let prefix .= v:operator + endif + call feedkeys(prefix, 'n') + endif + call feedkeys(substitute(a:map, '^', "\", '') . extra) +endfunction + +function! plug#(repo, ...) + if a:0 > 1 + return s:err('Invalid number of arguments (1..2)') + endif + + try + let repo = s:trim(a:repo) + let opts = a:0 == 1 ? s:parse_options(a:1) : s:base_spec + let name = get(opts, 'as', fnamemodify(repo, ':t:s?\.git$??')) + let spec = extend(s:infer_properties(name, repo), opts) + if !has_key(g:plugs, name) + call add(g:plugs_order, name) + endif + let g:plugs[name] = spec + let s:loaded[name] = get(s:loaded, name, 0) + catch + return s:err(v:exception) + endtry +endfunction + +function! s:parse_options(arg) + let opts = copy(s:base_spec) + let type = type(a:arg) + if type == s:TYPE.string + let opts.tag = a:arg + elseif type == s:TYPE.dict + call extend(opts, a:arg) + if has_key(opts, 'dir') + let opts.dir = s:dirpath(expand(opts.dir)) + endif + else + throw 'Invalid argument type (expected: string or dictionary)' + endif + return opts +endfunction + +function! s:infer_properties(name, repo) + let repo = a:repo + if s:is_local_plug(repo) + return { 'dir': s:dirpath(expand(repo)) } + else + if repo =~ ':' + let uri = repo + else + if repo !~ '/' + throw printf('Invalid argument: %s (implicit `vim-scripts'' expansion is deprecated)', repo) + endif + let fmt = get(g:, 'plug_url_format', 'https://git::@github.com/%s.git') + let uri = printf(fmt, repo) + endif + return { 'dir': s:dirpath(g:plug_home.'/'.a:name), 'uri': uri } + endif +endfunction + +function! s:install(force, names) + call s:update_impl(0, a:force, a:names) +endfunction + +function! s:update(force, names) + call s:update_impl(1, a:force, a:names) +endfunction + +function! plug#helptags() + if !exists('g:plugs') + return s:err('plug#begin was not called') + endif + for spec in values(g:plugs) + let docd = join([s:rtp(spec), 'doc'], '/') + if isdirectory(docd) + silent! execute 'helptags' s:esc(docd) + endif + endfor + return 1 +endfunction + +function! s:syntax() + syntax clear + syntax region plug1 start=/\%1l/ end=/\%2l/ contains=plugNumber + syntax region plug2 start=/\%2l/ end=/\%3l/ contains=plugBracket,plugX + syn match plugNumber /[0-9]\+[0-9.]*/ contained + syn match plugBracket /[[\]]/ contained + syn match plugX /x/ contained + syn match plugDash /^-/ + syn match plugPlus /^+/ + syn match plugStar /^*/ + syn match plugMessage /\(^- \)\@<=.*/ + syn match plugName /\(^- \)\@<=[^ ]*:/ + syn match plugSha /\%(: \)\@<=[0-9a-f]\{4,}$/ + syn match plugTag /(tag: [^)]\+)/ + syn match plugInstall /\(^+ \)\@<=[^:]*/ + syn match plugUpdate /\(^* \)\@<=[^:]*/ + syn match plugCommit /^ \X*[0-9a-f]\{7,9} .*/ contains=plugRelDate,plugEdge,plugTag + syn match plugEdge /^ \X\+$/ + syn match plugEdge /^ \X*/ contained nextgroup=plugSha + syn match plugSha /[0-9a-f]\{7,9}/ contained + syn match plugRelDate /([^)]*)$/ contained + syn match plugNotLoaded /(not loaded)$/ + syn match plugError /^x.*/ + syn region plugDeleted start=/^\~ .*/ end=/^\ze\S/ + syn match plugH2 /^.*:\n-\+$/ + syn keyword Function PlugInstall PlugStatus PlugUpdate PlugClean + hi def link plug1 Title + hi def link plug2 Repeat + hi def link plugH2 Type + hi def link plugX Exception + hi def link plugBracket Structure + hi def link plugNumber Number + + hi def link plugDash Special + hi def link plugPlus Constant + hi def link plugStar Boolean + + hi def link plugMessage Function + hi def link plugName Label + hi def link plugInstall Function + hi def link plugUpdate Type + + hi def link plugError Error + hi def link plugDeleted Ignore + hi def link plugRelDate Comment + hi def link plugEdge PreProc + hi def link plugSha Identifier + hi def link plugTag Constant + + hi def link plugNotLoaded Comment +endfunction + +function! s:lpad(str, len) + return a:str . repeat(' ', a:len - len(a:str)) +endfunction + +function! s:lines(msg) + return split(a:msg, "[\r\n]") +endfunction + +function! s:lastline(msg) + return get(s:lines(a:msg), -1, '') +endfunction + +function! s:new_window() + execute get(g:, 'plug_window', 'vertical topleft new') +endfunction + +function! s:plug_window_exists() + let buflist = tabpagebuflist(s:plug_tab) + return !empty(buflist) && index(buflist, s:plug_buf) >= 0 +endfunction + +function! s:switch_in() + if !s:plug_window_exists() + return 0 + endif + + if winbufnr(0) != s:plug_buf + let s:pos = [tabpagenr(), winnr(), winsaveview()] + execute 'normal!' s:plug_tab.'gt' + let winnr = bufwinnr(s:plug_buf) + execute winnr.'wincmd w' + call add(s:pos, winsaveview()) + else + let s:pos = [winsaveview()] + endif + + setlocal modifiable + return 1 +endfunction + +function! s:switch_out(...) + call winrestview(s:pos[-1]) + setlocal nomodifiable + if a:0 > 0 + execute a:1 + endif + + if len(s:pos) > 1 + execute 'normal!' s:pos[0].'gt' + execute s:pos[1] 'wincmd w' + call winrestview(s:pos[2]) + endif +endfunction + +function! s:finish_bindings() + nnoremap R :call retry() + nnoremap D :PlugDiff + nnoremap S :PlugStatus + nnoremap U :call status_update() + xnoremap U :call status_update() + nnoremap ]] :silent! call section('') + nnoremap [[ :silent! call section('b') +endfunction + +function! s:prepare(...) + if empty(getcwd()) + throw 'Invalid current working directory. Cannot proceed.' + endif + + for evar in ['$GIT_DIR', '$GIT_WORK_TREE'] + if exists(evar) + throw evar.' detected. Cannot proceed.' + endif + endfor + + call s:job_abort() + if s:switch_in() + if b:plug_preview == 1 + pc + endif + enew + else + call s:new_window() + endif + + nnoremap q :if b:plug_preview==1pcendifbd + if a:0 == 0 + call s:finish_bindings() + endif + let b:plug_preview = -1 + let s:plug_tab = tabpagenr() + let s:plug_buf = winbufnr(0) + call s:assign_name() + + for k in ['', 'L', 'o', 'X', 'd', 'dd'] + execute 'silent! unmap ' k + endfor + setlocal buftype=nofile bufhidden=wipe nobuflisted nolist noswapfile nowrap cursorline modifiable nospell + if exists('+colorcolumn') + setlocal colorcolumn= + endif + setf vim-plug + if exists('g:syntax_on') + call s:syntax() + endif +endfunction + +function! s:assign_name() + " Assign buffer name + let prefix = '[Plugins]' + let name = prefix + let idx = 2 + while bufexists(name) + let name = printf('%s (%s)', prefix, idx) + let idx = idx + 1 + endwhile + silent! execute 'f' fnameescape(name) +endfunction + +function! s:chsh(swap) + let prev = [&shell, &shellcmdflag, &shellredir] + if s:is_win + set shell=cmd.exe shellcmdflag=/c shellredir=>%s\ 2>&1 + elseif a:swap + set shell=sh shellredir=>%s\ 2>&1 + endif + return prev +endfunction + +function! s:bang(cmd, ...) + try + let [sh, shellcmdflag, shrd] = s:chsh(a:0) + " FIXME: Escaping is incomplete. We could use shellescape with eval, + " but it won't work on Windows. + let cmd = a:0 ? s:with_cd(a:cmd, a:1) : a:cmd + if s:is_win + let batchfile = tempname().'.bat' + call writefile(["@echo off\r", cmd . "\r"], batchfile) + let cmd = batchfile + endif + let g:_plug_bang = (s:is_win && has('gui_running') ? 'silent ' : '').'!'.escape(cmd, '#!%') + execute "normal! :execute g:_plug_bang\\" + finally + unlet g:_plug_bang + let [&shell, &shellcmdflag, &shellredir] = [sh, shellcmdflag, shrd] + if s:is_win + call delete(batchfile) + endif + endtry + return v:shell_error ? 'Exit status: ' . v:shell_error : '' +endfunction + +function! s:regress_bar() + let bar = substitute(getline(2)[1:-2], '.*\zs=', 'x', '') + call s:progress_bar(2, bar, len(bar)) +endfunction + +function! s:is_updated(dir) + return !empty(s:system_chomp('git log --pretty=format:"%h" "HEAD...HEAD@{1}"', a:dir)) +endfunction + +function! s:do(pull, force, todo) + for [name, spec] in items(a:todo) + if !isdirectory(spec.dir) + continue + endif + let installed = has_key(s:update.new, name) + let updated = installed ? 0 : + \ (a:pull && index(s:update.errors, name) < 0 && s:is_updated(spec.dir)) + if a:force || installed || updated + execute 'cd' s:esc(spec.dir) + call append(3, '- Post-update hook for '. name .' ... ') + let error = '' + let type = type(spec.do) + if type == s:TYPE.string + if spec.do[0] == ':' + if !get(s:loaded, name, 0) + let s:loaded[name] = 1 + call s:reorg_rtp() + endif + call s:load_plugin(spec) + try + execute spec.do[1:] + catch + let error = v:exception + endtry + if !s:plug_window_exists() + cd - + throw 'Warning: vim-plug was terminated by the post-update hook of '.name + endif + else + let error = s:bang(spec.do) + endif + elseif type == s:TYPE.funcref + try + let status = installed ? 'installed' : (updated ? 'updated' : 'unchanged') + call spec.do({ 'name': name, 'status': status, 'force': a:force }) + catch + let error = v:exception + endtry + else + let error = 'Invalid hook type' + endif + call s:switch_in() + call setline(4, empty(error) ? (getline(4) . 'OK') + \ : ('x' . getline(4)[1:] . error)) + if !empty(error) + call add(s:update.errors, name) + call s:regress_bar() + endif + cd - + endif + endfor +endfunction + +function! s:hash_match(a, b) + return stridx(a:a, a:b) == 0 || stridx(a:b, a:a) == 0 +endfunction + +function! s:checkout(spec) + let sha = a:spec.commit + let output = s:system('git rev-parse HEAD', a:spec.dir) + if !v:shell_error && !s:hash_match(sha, s:lines(output)[0]) + let output = s:system( + \ 'git fetch --depth 999999 && git checkout '.s:esc(sha).' --', a:spec.dir) + endif + return output +endfunction + +function! s:finish(pull) + let new_frozen = len(filter(keys(s:update.new), 'g:plugs[v:val].frozen')) + if new_frozen + let s = new_frozen > 1 ? 's' : '' + call append(3, printf('- Installed %d frozen plugin%s', new_frozen, s)) + endif + call append(3, '- Finishing ... ') | 4 + redraw + call plug#helptags() + call plug#end() + call setline(4, getline(4) . 'Done!') + redraw + let msgs = [] + if !empty(s:update.errors) + call add(msgs, "Press 'R' to retry.") + endif + if a:pull && len(s:update.new) < len(filter(getline(5, '$'), + \ "v:val =~ '^- ' && v:val !~# 'Already up.to.date'")) + call add(msgs, "Press 'D' to see the updated changes.") + endif + echo join(msgs, ' ') + call s:finish_bindings() +endfunction + +function! s:retry() + if empty(s:update.errors) + return + endif + echo + call s:update_impl(s:update.pull, s:update.force, + \ extend(copy(s:update.errors), [s:update.threads])) +endfunction + +function! s:is_managed(name) + return has_key(g:plugs[a:name], 'uri') +endfunction + +function! s:names(...) + return sort(filter(keys(g:plugs), 'stridx(v:val, a:1) == 0 && s:is_managed(v:val)')) +endfunction + +function! s:check_ruby() + silent! ruby require 'thread'; VIM::command("let g:plug_ruby = '#{RUBY_VERSION}'") + if !exists('g:plug_ruby') + redraw! + return s:warn('echom', 'Warning: Ruby interface is broken') + endif + let ruby_version = split(g:plug_ruby, '\.') + unlet g:plug_ruby + return s:version_requirement(ruby_version, [1, 8, 7]) +endfunction + +function! s:update_impl(pull, force, args) abort + let sync = index(a:args, '--sync') >= 0 || has('vim_starting') + let args = filter(copy(a:args), 'v:val != "--sync"') + let threads = (len(args) > 0 && args[-1] =~ '^[1-9][0-9]*$') ? + \ remove(args, -1) : get(g:, 'plug_threads', 16) + + let managed = filter(copy(g:plugs), 's:is_managed(v:key)') + let todo = empty(args) ? filter(managed, '!v:val.frozen || !isdirectory(v:val.dir)') : + \ filter(managed, 'index(args, v:key) >= 0') + + if empty(todo) + return s:warn('echo', 'No plugin to '. (a:pull ? 'update' : 'install')) + endif + + if !s:is_win && s:git_version_requirement(2, 3) + let s:git_terminal_prompt = exists('$GIT_TERMINAL_PROMPT') ? $GIT_TERMINAL_PROMPT : '' + let $GIT_TERMINAL_PROMPT = 0 + for plug in values(todo) + let plug.uri = substitute(plug.uri, + \ '^https://git::@github\.com', 'https://github.com', '') + endfor + endif + + if !isdirectory(g:plug_home) + try + call mkdir(g:plug_home, 'p') + catch + return s:err(printf('Invalid plug directory: %s. '. + \ 'Try to call plug#begin with a valid directory', g:plug_home)) + endtry + endif + + if has('nvim') && !exists('*jobwait') && threads > 1 + call s:warn('echom', '[vim-plug] Update Neovim for parallel installer') + endif + + let use_job = s:nvim || s:vim8 + let python = (has('python') || has('python3')) && !use_job + let ruby = has('ruby') && !use_job && (v:version >= 703 || v:version == 702 && has('patch374')) && !(s:is_win && has('gui_running')) && threads > 1 && s:check_ruby() + + let s:update = { + \ 'start': reltime(), + \ 'all': todo, + \ 'todo': copy(todo), + \ 'errors': [], + \ 'pull': a:pull, + \ 'force': a:force, + \ 'new': {}, + \ 'threads': (python || ruby || use_job) ? min([len(todo), threads]) : 1, + \ 'bar': '', + \ 'fin': 0 + \ } + + call s:prepare(1) + call append(0, ['', '']) + normal! 2G + silent! redraw + + let s:clone_opt = get(g:, 'plug_shallow', 1) ? + \ '--depth 1' . (s:git_version_requirement(1, 7, 10) ? ' --no-single-branch' : '') : '' + + if has('win32unix') + let s:clone_opt .= ' -c core.eol=lf -c core.autocrlf=input' + endif + + let s:submodule_opt = s:git_version_requirement(2, 8) ? ' --jobs='.threads : '' + + " Python version requirement (>= 2.7) + if python && !has('python3') && !ruby && !use_job && s:update.threads > 1 + redir => pyv + silent python import platform; print platform.python_version() + redir END + let python = s:version_requirement( + \ map(split(split(pyv)[0], '\.'), 'str2nr(v:val)'), [2, 6]) + endif + + if (python || ruby) && s:update.threads > 1 + try + let imd = &imd + if s:mac_gui + set noimd + endif + if ruby + call s:update_ruby() + else + call s:update_python() + endif + catch + let lines = getline(4, '$') + let printed = {} + silent! 4,$d _ + for line in lines + let name = s:extract_name(line, '.', '') + if empty(name) || !has_key(printed, name) + call append('$', line) + if !empty(name) + let printed[name] = 1 + if line[0] == 'x' && index(s:update.errors, name) < 0 + call add(s:update.errors, name) + end + endif + endif + endfor + finally + let &imd = imd + call s:update_finish() + endtry + else + call s:update_vim() + while use_job && sync + sleep 100m + if s:update.fin + break + endif + endwhile + endif +endfunction + +function! s:log4(name, msg) + call setline(4, printf('- %s (%s)', a:msg, a:name)) + redraw +endfunction + +function! s:update_finish() + if exists('s:git_terminal_prompt') + let $GIT_TERMINAL_PROMPT = s:git_terminal_prompt + endif + if s:switch_in() + call append(3, '- Updating ...') | 4 + for [name, spec] in items(filter(copy(s:update.all), 'index(s:update.errors, v:key) < 0 && (s:update.force || s:update.pull || has_key(s:update.new, v:key))')) + let [pos, _] = s:logpos(name) + if !pos + continue + endif + if has_key(spec, 'commit') + call s:log4(name, 'Checking out '.spec.commit) + let out = s:checkout(spec) + elseif has_key(spec, 'tag') + let tag = spec.tag + if tag =~ '\*' + let tags = s:lines(s:system('git tag --list '.s:shellesc(tag).' --sort -version:refname 2>&1', spec.dir)) + if !v:shell_error && !empty(tags) + let tag = tags[0] + call s:log4(name, printf('Latest tag for %s -> %s', spec.tag, tag)) + call append(3, '') + endif + endif + call s:log4(name, 'Checking out '.tag) + let out = s:system('git checkout -q '.s:esc(tag).' -- 2>&1', spec.dir) + else + let branch = s:esc(get(spec, 'branch', 'master')) + call s:log4(name, 'Merging origin/'.branch) + let out = s:system('git checkout -q '.branch.' -- 2>&1' + \. (has_key(s:update.new, name) ? '' : ('&& git merge --ff-only origin/'.branch.' 2>&1')), spec.dir) + endif + if !v:shell_error && filereadable(spec.dir.'/.gitmodules') && + \ (s:update.force || has_key(s:update.new, name) || s:is_updated(spec.dir)) + call s:log4(name, 'Updating submodules. This may take a while.') + let out .= s:bang('git submodule update --init --recursive'.s:submodule_opt.' 2>&1', spec.dir) + endif + let msg = s:format_message(v:shell_error ? 'x': '-', name, out) + if v:shell_error + call add(s:update.errors, name) + call s:regress_bar() + silent execute pos 'd _' + call append(4, msg) | 4 + elseif !empty(out) + call setline(pos, msg[0]) + endif + redraw + endfor + silent 4 d _ + try + call s:do(s:update.pull, s:update.force, filter(copy(s:update.all), 'index(s:update.errors, v:key) < 0 && has_key(v:val, "do")')) + catch + call s:warn('echom', v:exception) + call s:warn('echo', '') + return + endtry + call s:finish(s:update.pull) + call setline(1, 'Updated. Elapsed time: ' . split(reltimestr(reltime(s:update.start)))[0] . ' sec.') + call s:switch_out('normal! gg') + endif +endfunction + +function! s:job_abort() + if (!s:nvim && !s:vim8) || !exists('s:jobs') + return + endif + + for [name, j] in items(s:jobs) + if s:nvim + silent! call jobstop(j.jobid) + elseif s:vim8 + silent! call job_stop(j.jobid) + endif + if j.new + call s:system('rm -rf ' . s:shellesc(g:plugs[name].dir)) + endif + endfor + let s:jobs = {} +endfunction + +function! s:last_non_empty_line(lines) + let len = len(a:lines) + for idx in range(len) + let line = a:lines[len-idx-1] + if !empty(line) + return line + endif + endfor + return '' +endfunction + +function! s:job_out_cb(self, data) abort + let self = a:self + let data = remove(self.lines, -1) . a:data + let lines = map(split(data, "\n", 1), 'split(v:val, "\r", 1)[-1]') + call extend(self.lines, lines) + " To reduce the number of buffer updates + let self.tick = get(self, 'tick', -1) + 1 + if !self.running || self.tick % len(s:jobs) == 0 + let bullet = self.running ? (self.new ? '+' : '*') : (self.error ? 'x' : '-') + let result = self.error ? join(self.lines, "\n") : s:last_non_empty_line(self.lines) + call s:log(bullet, self.name, result) + endif +endfunction + +function! s:job_exit_cb(self, data) abort + let a:self.running = 0 + let a:self.error = a:data != 0 + call s:reap(a:self.name) + call s:tick() +endfunction + +function! s:job_cb(fn, job, ch, data) + if !s:plug_window_exists() " plug window closed + return s:job_abort() + endif + call call(a:fn, [a:job, a:data]) +endfunction + +function! s:nvim_cb(job_id, data, event) dict abort + return a:event == 'stdout' ? + \ s:job_cb('s:job_out_cb', self, 0, join(a:data, "\n")) : + \ s:job_cb('s:job_exit_cb', self, 0, a:data) +endfunction + +function! s:spawn(name, cmd, opts) + let job = { 'name': a:name, 'running': 1, 'error': 0, 'lines': [''], + \ 'batchfile': (s:is_win && (s:nvim || s:vim8)) ? tempname().'.bat' : '', + \ 'new': get(a:opts, 'new', 0) } + let s:jobs[a:name] = job + let cmd = has_key(a:opts, 'dir') ? s:with_cd(a:cmd, a:opts.dir) : a:cmd + if !empty(job.batchfile) + call writefile(["@echo off\r", cmd . "\r"], job.batchfile) + let cmd = job.batchfile + endif + let argv = add(s:is_win ? ['cmd', '/c'] : ['sh', '-c'], cmd) + + if s:nvim + call extend(job, { + \ 'on_stdout': function('s:nvim_cb'), + \ 'on_exit': function('s:nvim_cb'), + \ }) + let jid = jobstart(argv, job) + if jid > 0 + let job.jobid = jid + else + let job.running = 0 + let job.error = 1 + let job.lines = [jid < 0 ? argv[0].' is not executable' : + \ 'Invalid arguments (or job table is full)'] + endif + elseif s:vim8 + let jid = job_start(s:is_win ? join(argv, ' ') : argv, { + \ 'out_cb': function('s:job_cb', ['s:job_out_cb', job]), + \ 'exit_cb': function('s:job_cb', ['s:job_exit_cb', job]), + \ 'out_mode': 'raw' + \}) + if job_status(jid) == 'run' + let job.jobid = jid + else + let job.running = 0 + let job.error = 1 + let job.lines = ['Failed to start job'] + endif + else + let job.lines = s:lines(call('s:system', [cmd])) + let job.error = v:shell_error != 0 + let job.running = 0 + endif +endfunction + +function! s:reap(name) + let job = s:jobs[a:name] + if job.error + call add(s:update.errors, a:name) + elseif get(job, 'new', 0) + let s:update.new[a:name] = 1 + endif + let s:update.bar .= job.error ? 'x' : '=' + + let bullet = job.error ? 'x' : '-' + let result = job.error ? join(job.lines, "\n") : s:last_non_empty_line(job.lines) + call s:log(bullet, a:name, empty(result) ? 'OK' : result) + call s:bar() + + if has_key(job, 'batchfile') && !empty(job.batchfile) + call delete(job.batchfile) + endif + call remove(s:jobs, a:name) +endfunction + +function! s:bar() + if s:switch_in() + let total = len(s:update.all) + call setline(1, (s:update.pull ? 'Updating' : 'Installing'). + \ ' plugins ('.len(s:update.bar).'/'.total.')') + call s:progress_bar(2, s:update.bar, total) + call s:switch_out() + endif +endfunction + +function! s:logpos(name) + for i in range(4, line('$')) + if getline(i) =~# '^[-+x*] '.a:name.':' + for j in range(i + 1, line('$')) + if getline(j) !~ '^ ' + return [i, j - 1] + endif + endfor + return [i, i] + endif + endfor + return [0, 0] +endfunction + +function! s:log(bullet, name, lines) + if s:switch_in() + let [b, e] = s:logpos(a:name) + if b > 0 + silent execute printf('%d,%d d _', b, e) + if b > winheight('.') + let b = 4 + endif + else + let b = 4 + endif + " FIXME For some reason, nomodifiable is set after :d in vim8 + setlocal modifiable + call append(b - 1, s:format_message(a:bullet, a:name, a:lines)) + call s:switch_out() + endif +endfunction + +function! s:update_vim() + let s:jobs = {} + + call s:bar() + call s:tick() +endfunction + +function! s:tick() + let pull = s:update.pull + let prog = s:progress_opt(s:nvim || s:vim8) +while 1 " Without TCO, Vim stack is bound to explode + if empty(s:update.todo) + if empty(s:jobs) && !s:update.fin + call s:update_finish() + let s:update.fin = 1 + endif + return + endif + + let name = keys(s:update.todo)[0] + let spec = remove(s:update.todo, name) + let new = empty(globpath(spec.dir, '.git', 1)) + + call s:log(new ? '+' : '*', name, pull ? 'Updating ...' : 'Installing ...') + redraw + + let has_tag = has_key(spec, 'tag') + if !new + let [error, _] = s:git_validate(spec, 0) + if empty(error) + if pull + let fetch_opt = (has_tag && !empty(globpath(spec.dir, '.git/shallow'))) ? '--depth 99999999' : '' + call s:spawn(name, printf('git fetch %s %s 2>&1', fetch_opt, prog), { 'dir': spec.dir }) + else + let s:jobs[name] = { 'running': 0, 'lines': ['Already installed'], 'error': 0 } + endif + else + let s:jobs[name] = { 'running': 0, 'lines': s:lines(error), 'error': 1 } + endif + else + call s:spawn(name, + \ printf('git clone %s %s %s %s 2>&1', + \ has_tag ? '' : s:clone_opt, + \ prog, + \ s:shellesc(spec.uri), + \ s:shellesc(s:trim(spec.dir))), { 'new': 1 }) + endif + + if !s:jobs[name].running + call s:reap(name) + endif + if len(s:jobs) >= s:update.threads + break + endif +endwhile +endfunction + +function! s:update_python() +let py_exe = has('python') ? 'python' : 'python3' +execute py_exe "<< EOF" +import datetime +import functools +import os +try: + import queue +except ImportError: + import Queue as queue +import random +import re +import shutil +import signal +import subprocess +import tempfile +import threading as thr +import time +import traceback +import vim + +G_NVIM = vim.eval("has('nvim')") == '1' +G_PULL = vim.eval('s:update.pull') == '1' +G_RETRIES = int(vim.eval('get(g:, "plug_retries", 2)')) + 1 +G_TIMEOUT = int(vim.eval('get(g:, "plug_timeout", 60)')) +G_CLONE_OPT = vim.eval('s:clone_opt') +G_PROGRESS = vim.eval('s:progress_opt(1)') +G_LOG_PROB = 1.0 / int(vim.eval('s:update.threads')) +G_STOP = thr.Event() +G_IS_WIN = vim.eval('s:is_win') == '1' + +class PlugError(Exception): + def __init__(self, msg): + self.msg = msg +class CmdTimedOut(PlugError): + pass +class CmdFailed(PlugError): + pass +class InvalidURI(PlugError): + pass +class Action(object): + INSTALL, UPDATE, ERROR, DONE = ['+', '*', 'x', '-'] + +class Buffer(object): + def __init__(self, lock, num_plugs, is_pull): + self.bar = '' + self.event = 'Updating' if is_pull else 'Installing' + self.lock = lock + self.maxy = int(vim.eval('winheight(".")')) + self.num_plugs = num_plugs + + def __where(self, name): + """ Find first line with name in current buffer. Return line num. """ + found, lnum = False, 0 + matcher = re.compile('^[-+x*] {0}:'.format(name)) + for line in vim.current.buffer: + if matcher.search(line) is not None: + found = True + break + lnum += 1 + + if not found: + lnum = -1 + return lnum + + def header(self): + curbuf = vim.current.buffer + curbuf[0] = self.event + ' plugins ({0}/{1})'.format(len(self.bar), self.num_plugs) + + num_spaces = self.num_plugs - len(self.bar) + curbuf[1] = '[{0}{1}]'.format(self.bar, num_spaces * ' ') + + with self.lock: + vim.command('normal! 2G') + vim.command('redraw') + + def write(self, action, name, lines): + first, rest = lines[0], lines[1:] + msg = ['{0} {1}{2}{3}'.format(action, name, ': ' if first else '', first)] + msg.extend([' ' + line for line in rest]) + + try: + if action == Action.ERROR: + self.bar += 'x' + vim.command("call add(s:update.errors, '{0}')".format(name)) + elif action == Action.DONE: + self.bar += '=' + + curbuf = vim.current.buffer + lnum = self.__where(name) + if lnum != -1: # Found matching line num + del curbuf[lnum] + if lnum > self.maxy and action in set([Action.INSTALL, Action.UPDATE]): + lnum = 3 + else: + lnum = 3 + curbuf.append(msg, lnum) + + self.header() + except vim.error: + pass + +class Command(object): + CD = 'cd /d' if G_IS_WIN else 'cd' + + def __init__(self, cmd, cmd_dir=None, timeout=60, cb=None, clean=None): + self.cmd = cmd + if cmd_dir: + self.cmd = '{0} {1} && {2}'.format(Command.CD, cmd_dir, self.cmd) + self.timeout = timeout + self.callback = cb if cb else (lambda msg: None) + self.clean = clean if clean else (lambda: None) + self.proc = None + + @property + def alive(self): + """ Returns true only if command still running. """ + return self.proc and self.proc.poll() is None + + def execute(self, ntries=3): + """ Execute the command with ntries if CmdTimedOut. + Returns the output of the command if no Exception. + """ + attempt, finished, limit = 0, False, self.timeout + + while not finished: + try: + attempt += 1 + result = self.try_command() + finished = True + return result + except CmdTimedOut: + if attempt != ntries: + self.notify_retry() + self.timeout += limit + else: + raise + + def notify_retry(self): + """ Retry required for command, notify user. """ + for count in range(3, 0, -1): + if G_STOP.is_set(): + raise KeyboardInterrupt + msg = 'Timeout. Will retry in {0} second{1} ...'.format( + count, 's' if count != 1 else '') + self.callback([msg]) + time.sleep(1) + self.callback(['Retrying ...']) + + def try_command(self): + """ Execute a cmd & poll for callback. Returns list of output. + Raises CmdFailed -> return code for Popen isn't 0 + Raises CmdTimedOut -> command exceeded timeout without new output + """ + first_line = True + + try: + tfile = tempfile.NamedTemporaryFile(mode='w+b') + preexec_fn = not G_IS_WIN and os.setsid or None + self.proc = subprocess.Popen(self.cmd, stdout=tfile, + stderr=subprocess.STDOUT, + stdin=subprocess.PIPE, shell=True, + preexec_fn=preexec_fn) + thrd = thr.Thread(target=(lambda proc: proc.wait()), args=(self.proc,)) + thrd.start() + + thread_not_started = True + while thread_not_started: + try: + thrd.join(0.1) + thread_not_started = False + except RuntimeError: + pass + + while self.alive: + if G_STOP.is_set(): + raise KeyboardInterrupt + + if first_line or random.random() < G_LOG_PROB: + first_line = False + line = '' if G_IS_WIN else nonblock_read(tfile.name) + if line: + self.callback([line]) + + time_diff = time.time() - os.path.getmtime(tfile.name) + if time_diff > self.timeout: + raise CmdTimedOut(['Timeout!']) + + thrd.join(0.5) + + tfile.seek(0) + result = [line.decode('utf-8', 'replace').rstrip() for line in tfile] + + if self.proc.returncode != 0: + raise CmdFailed([''] + result) + + return result + except: + self.terminate() + raise + + def terminate(self): + """ Terminate process and cleanup. """ + if self.alive: + if G_IS_WIN: + os.kill(self.proc.pid, signal.SIGINT) + else: + os.killpg(self.proc.pid, signal.SIGTERM) + self.clean() + +class Plugin(object): + def __init__(self, name, args, buf_q, lock): + self.name = name + self.args = args + self.buf_q = buf_q + self.lock = lock + self.tag = args.get('tag', 0) + + def manage(self): + try: + if os.path.exists(self.args['dir']): + self.update() + else: + self.install() + with self.lock: + thread_vim_command("let s:update.new['{0}'] = 1".format(self.name)) + except PlugError as exc: + self.write(Action.ERROR, self.name, exc.msg) + except KeyboardInterrupt: + G_STOP.set() + self.write(Action.ERROR, self.name, ['Interrupted!']) + except: + # Any exception except those above print stack trace + msg = 'Trace:\n{0}'.format(traceback.format_exc().rstrip()) + self.write(Action.ERROR, self.name, msg.split('\n')) + raise + + def install(self): + target = self.args['dir'] + if target[-1] == '\\': + target = target[0:-1] + + def clean(target): + def _clean(): + try: + shutil.rmtree(target) + except OSError: + pass + return _clean + + self.write(Action.INSTALL, self.name, ['Installing ...']) + callback = functools.partial(self.write, Action.INSTALL, self.name) + cmd = 'git clone {0} {1} {2} {3} 2>&1'.format( + '' if self.tag else G_CLONE_OPT, G_PROGRESS, self.args['uri'], + esc(target)) + com = Command(cmd, None, G_TIMEOUT, callback, clean(target)) + result = com.execute(G_RETRIES) + self.write(Action.DONE, self.name, result[-1:]) + + def repo_uri(self): + cmd = 'git rev-parse --abbrev-ref HEAD 2>&1 && git config -f .git/config remote.origin.url' + command = Command(cmd, self.args['dir'], G_TIMEOUT,) + result = command.execute(G_RETRIES) + return result[-1] + + def update(self): + actual_uri = self.repo_uri() + expect_uri = self.args['uri'] + regex = re.compile(r'^(?:\w+://)?(?:[^@/]*@)?([^:/]*(?::[0-9]*)?)[:/](.*?)(?:\.git)?/?$') + ma = regex.match(actual_uri) + mb = regex.match(expect_uri) + if ma is None or mb is None or ma.groups() != mb.groups(): + msg = ['', + 'Invalid URI: {0}'.format(actual_uri), + 'Expected {0}'.format(expect_uri), + 'PlugClean required.'] + raise InvalidURI(msg) + + if G_PULL: + self.write(Action.UPDATE, self.name, ['Updating ...']) + callback = functools.partial(self.write, Action.UPDATE, self.name) + fetch_opt = '--depth 99999999' if self.tag and os.path.isfile(os.path.join(self.args['dir'], '.git/shallow')) else '' + cmd = 'git fetch {0} {1} 2>&1'.format(fetch_opt, G_PROGRESS) + com = Command(cmd, self.args['dir'], G_TIMEOUT, callback) + result = com.execute(G_RETRIES) + self.write(Action.DONE, self.name, result[-1:]) + else: + self.write(Action.DONE, self.name, ['Already installed']) + + def write(self, action, name, msg): + self.buf_q.put((action, name, msg)) + +class PlugThread(thr.Thread): + def __init__(self, tname, args): + super(PlugThread, self).__init__() + self.tname = tname + self.args = args + + def run(self): + thr.current_thread().name = self.tname + buf_q, work_q, lock = self.args + + try: + while not G_STOP.is_set(): + name, args = work_q.get_nowait() + plug = Plugin(name, args, buf_q, lock) + plug.manage() + work_q.task_done() + except queue.Empty: + pass + +class RefreshThread(thr.Thread): + def __init__(self, lock): + super(RefreshThread, self).__init__() + self.lock = lock + self.running = True + + def run(self): + while self.running: + with self.lock: + thread_vim_command('noautocmd normal! a') + time.sleep(0.33) + + def stop(self): + self.running = False + +if G_NVIM: + def thread_vim_command(cmd): + vim.session.threadsafe_call(lambda: vim.command(cmd)) +else: + def thread_vim_command(cmd): + vim.command(cmd) + +def esc(name): + return '"' + name.replace('"', '\"') + '"' + +def nonblock_read(fname): + """ Read a file with nonblock flag. Return the last line. """ + fread = os.open(fname, os.O_RDONLY | os.O_NONBLOCK) + buf = os.read(fread, 100000).decode('utf-8', 'replace') + os.close(fread) + + line = buf.rstrip('\r\n') + left = max(line.rfind('\r'), line.rfind('\n')) + if left != -1: + left += 1 + line = line[left:] + + return line + +def main(): + thr.current_thread().name = 'main' + nthreads = int(vim.eval('s:update.threads')) + plugs = vim.eval('s:update.todo') + mac_gui = vim.eval('s:mac_gui') == '1' + + lock = thr.Lock() + buf = Buffer(lock, len(plugs), G_PULL) + buf_q, work_q = queue.Queue(), queue.Queue() + for work in plugs.items(): + work_q.put(work) + + start_cnt = thr.active_count() + for num in range(nthreads): + tname = 'PlugT-{0:02}'.format(num) + thread = PlugThread(tname, (buf_q, work_q, lock)) + thread.start() + if mac_gui: + rthread = RefreshThread(lock) + rthread.start() + + while not buf_q.empty() or thr.active_count() != start_cnt: + try: + action, name, msg = buf_q.get(True, 0.25) + buf.write(action, name, ['OK'] if not msg else msg) + buf_q.task_done() + except queue.Empty: + pass + except KeyboardInterrupt: + G_STOP.set() + + if mac_gui: + rthread.stop() + rthread.join() + +main() +EOF +endfunction + +function! s:update_ruby() + ruby << EOF + module PlugStream + SEP = ["\r", "\n", nil] + def get_line + buffer = '' + loop do + char = readchar rescue return + if SEP.include? char.chr + buffer << $/ + break + else + buffer << char + end + end + buffer + end + end unless defined?(PlugStream) + + def esc arg + %["#{arg.gsub('"', '\"')}"] + end + + def killall pid + pids = [pid] + if /mswin|mingw|bccwin/ =~ RUBY_PLATFORM + pids.each { |pid| Process.kill 'INT', pid.to_i rescue nil } + else + unless `which pgrep 2> /dev/null`.empty? + children = pids + until children.empty? + children = children.map { |pid| + `pgrep -P #{pid}`.lines.map { |l| l.chomp } + }.flatten + pids += children + end + end + pids.each { |pid| Process.kill 'TERM', pid.to_i rescue nil } + end + end + + def compare_git_uri a, b + regex = %r{^(?:\w+://)?(?:[^@/]*@)?([^:/]*(?::[0-9]*)?)[:/](.*?)(?:\.git)?/?$} + regex.match(a).to_a.drop(1) == regex.match(b).to_a.drop(1) + end + + require 'thread' + require 'fileutils' + require 'timeout' + running = true + iswin = VIM::evaluate('s:is_win').to_i == 1 + pull = VIM::evaluate('s:update.pull').to_i == 1 + base = VIM::evaluate('g:plug_home') + all = VIM::evaluate('s:update.todo') + limit = VIM::evaluate('get(g:, "plug_timeout", 60)') + tries = VIM::evaluate('get(g:, "plug_retries", 2)') + 1 + nthr = VIM::evaluate('s:update.threads').to_i + maxy = VIM::evaluate('winheight(".")').to_i + vim7 = VIM::evaluate('v:version').to_i <= 703 && RUBY_PLATFORM =~ /darwin/ + cd = iswin ? 'cd /d' : 'cd' + tot = VIM::evaluate('len(s:update.todo)') || 0 + bar = '' + skip = 'Already installed' + mtx = Mutex.new + take1 = proc { mtx.synchronize { running && all.shift } } + logh = proc { + cnt = bar.length + $curbuf[1] = "#{pull ? 'Updating' : 'Installing'} plugins (#{cnt}/#{tot})" + $curbuf[2] = '[' + bar.ljust(tot) + ']' + VIM::command('normal! 2G') + VIM::command('redraw') + } + where = proc { |name| (1..($curbuf.length)).find { |l| $curbuf[l] =~ /^[-+x*] #{name}:/ } } + log = proc { |name, result, type| + mtx.synchronize do + ing = ![true, false].include?(type) + bar += type ? '=' : 'x' unless ing + b = case type + when :install then '+' when :update then '*' + when true, nil then '-' else + VIM::command("call add(s:update.errors, '#{name}')") + 'x' + end + result = + if type || type.nil? + ["#{b} #{name}: #{result.lines.to_a.last || 'OK'}"] + elsif result =~ /^Interrupted|^Timeout/ + ["#{b} #{name}: #{result}"] + else + ["#{b} #{name}"] + result.lines.map { |l| " " << l } + end + if lnum = where.call(name) + $curbuf.delete lnum + lnum = 4 if ing && lnum > maxy + end + result.each_with_index do |line, offset| + $curbuf.append((lnum || 4) - 1 + offset, line.gsub(/\e\[./, '').chomp) + end + logh.call + end + } + bt = proc { |cmd, name, type, cleanup| + tried = timeout = 0 + begin + tried += 1 + timeout += limit + fd = nil + data = '' + if iswin + Timeout::timeout(timeout) do + tmp = VIM::evaluate('tempname()') + system("(#{cmd}) > #{tmp}") + data = File.read(tmp).chomp + File.unlink tmp rescue nil + end + else + fd = IO.popen(cmd).extend(PlugStream) + first_line = true + log_prob = 1.0 / nthr + while line = Timeout::timeout(timeout) { fd.get_line } + data << line + log.call name, line.chomp, type if name && (first_line || rand < log_prob) + first_line = false + end + fd.close + end + [$? == 0, data.chomp] + rescue Timeout::Error, Interrupt => e + if fd && !fd.closed? + killall fd.pid + fd.close + end + cleanup.call if cleanup + if e.is_a?(Timeout::Error) && tried < tries + 3.downto(1) do |countdown| + s = countdown > 1 ? 's' : '' + log.call name, "Timeout. Will retry in #{countdown} second#{s} ...", type + sleep 1 + end + log.call name, 'Retrying ...', type + retry + end + [false, e.is_a?(Interrupt) ? "Interrupted!" : "Timeout!"] + end + } + main = Thread.current + threads = [] + watcher = Thread.new { + if vim7 + while VIM::evaluate('getchar(1)') + sleep 0.1 + end + else + require 'io/console' # >= Ruby 1.9 + nil until IO.console.getch == 3.chr + end + mtx.synchronize do + running = false + threads.each { |t| t.raise Interrupt } unless vim7 + end + threads.each { |t| t.join rescue nil } + main.kill + } + refresh = Thread.new { + while true + mtx.synchronize do + break unless running + VIM::command('noautocmd normal! a') + end + sleep 0.2 + end + } if VIM::evaluate('s:mac_gui') == 1 + + clone_opt = VIM::evaluate('s:clone_opt') + progress = VIM::evaluate('s:progress_opt(1)') + nthr.times do + mtx.synchronize do + threads << Thread.new { + while pair = take1.call + name = pair.first + dir, uri, tag = pair.last.values_at *%w[dir uri tag] + exists = File.directory? dir + ok, result = + if exists + chdir = "#{cd} #{iswin ? dir : esc(dir)}" + ret, data = bt.call "#{chdir} && git rev-parse --abbrev-ref HEAD 2>&1 && git config -f .git/config remote.origin.url", nil, nil, nil + current_uri = data.lines.to_a.last + if !ret + if data =~ /^Interrupted|^Timeout/ + [false, data] + else + [false, [data.chomp, "PlugClean required."].join($/)] + end + elsif !compare_git_uri(current_uri, uri) + [false, ["Invalid URI: #{current_uri}", + "Expected: #{uri}", + "PlugClean required."].join($/)] + else + if pull + log.call name, 'Updating ...', :update + fetch_opt = (tag && File.exist?(File.join(dir, '.git/shallow'))) ? '--depth 99999999' : '' + bt.call "#{chdir} && git fetch #{fetch_opt} #{progress} 2>&1", name, :update, nil + else + [true, skip] + end + end + else + d = esc dir.sub(%r{[\\/]+$}, '') + log.call name, 'Installing ...', :install + bt.call "git clone #{clone_opt unless tag} #{progress} #{uri} #{d} 2>&1", name, :install, proc { + FileUtils.rm_rf dir + } + end + mtx.synchronize { VIM::command("let s:update.new['#{name}'] = 1") } if !exists && ok + log.call name, result, ok + end + } if running + end + end + threads.each { |t| t.join rescue nil } + logh.call + refresh.kill if refresh + watcher.kill +EOF +endfunction + +function! s:shellesc_cmd(arg) + let escaped = substitute(a:arg, '[&|<>()@^]', '^&', 'g') + let escaped = substitute(escaped, '%', '%%', 'g') + let escaped = substitute(escaped, '"', '\\^&', 'g') + let escaped = substitute(escaped, '\(\\\+\)\(\\^\)', '\1\1\2', 'g') + return '^"'.substitute(escaped, '\(\\\+\)$', '\1\1', '').'^"' +endfunction + +function! s:shellesc(arg) + if &shell =~# 'cmd.exe$' + return s:shellesc_cmd(a:arg) + endif + return shellescape(a:arg) +endfunction + +function! s:glob_dir(path) + return map(filter(s:glob(a:path, '**'), 'isdirectory(v:val)'), 's:dirpath(v:val)') +endfunction + +function! s:progress_bar(line, bar, total) + call setline(a:line, '[' . s:lpad(a:bar, a:total) . ']') +endfunction + +function! s:compare_git_uri(a, b) + " See `git help clone' + " https:// [user@] github.com[:port] / junegunn/vim-plug [.git] + " [git@] github.com[:port] : junegunn/vim-plug [.git] + " file:// / junegunn/vim-plug [/] + " / junegunn/vim-plug [/] + let pat = '^\%(\w\+://\)\='.'\%([^@/]*@\)\='.'\([^:/]*\%(:[0-9]*\)\=\)'.'[:/]'.'\(.\{-}\)'.'\%(\.git\)\=/\?$' + let ma = matchlist(a:a, pat) + let mb = matchlist(a:b, pat) + return ma[1:2] ==# mb[1:2] +endfunction + +function! s:format_message(bullet, name, message) + if a:bullet != 'x' + return [printf('%s %s: %s', a:bullet, a:name, s:lastline(a:message))] + else + let lines = map(s:lines(a:message), '" ".v:val') + return extend([printf('x %s:', a:name)], lines) + endif +endfunction + +function! s:with_cd(cmd, dir) + return printf('cd%s %s && %s', s:is_win ? ' /d' : '', s:shellesc(a:dir), a:cmd) +endfunction + +function! s:system(cmd, ...) + try + let [sh, shellcmdflag, shrd] = s:chsh(1) + let cmd = a:0 > 0 ? s:with_cd(a:cmd, a:1) : a:cmd + if s:is_win + let batchfile = tempname().'.bat' + call writefile(["@echo off\r", cmd . "\r"], batchfile) + let cmd = batchfile + endif + return system(s:is_win ? '('.cmd.')' : cmd) + finally + let [&shell, &shellcmdflag, &shellredir] = [sh, shellcmdflag, shrd] + if s:is_win + call delete(batchfile) + endif + endtry +endfunction + +function! s:system_chomp(...) + let ret = call('s:system', a:000) + return v:shell_error ? '' : substitute(ret, '\n$', '', '') +endfunction + +function! s:git_validate(spec, check_branch) + let err = '' + if isdirectory(a:spec.dir) + let result = s:lines(s:system('git rev-parse --abbrev-ref HEAD 2>&1 && git config -f .git/config remote.origin.url', a:spec.dir)) + let remote = result[-1] + if v:shell_error + let err = join([remote, 'PlugClean required.'], "\n") + elseif !s:compare_git_uri(remote, a:spec.uri) + let err = join(['Invalid URI: '.remote, + \ 'Expected: '.a:spec.uri, + \ 'PlugClean required.'], "\n") + elseif a:check_branch && has_key(a:spec, 'commit') + let result = s:lines(s:system('git rev-parse HEAD 2>&1', a:spec.dir)) + let sha = result[-1] + if v:shell_error + let err = join(add(result, 'PlugClean required.'), "\n") + elseif !s:hash_match(sha, a:spec.commit) + let err = join([printf('Invalid HEAD (expected: %s, actual: %s)', + \ a:spec.commit[:6], sha[:6]), + \ 'PlugUpdate required.'], "\n") + endif + elseif a:check_branch + let branch = result[0] + " Check tag + if has_key(a:spec, 'tag') + let tag = s:system_chomp('git describe --exact-match --tags HEAD 2>&1', a:spec.dir) + if a:spec.tag !=# tag && a:spec.tag !~ '\*' + let err = printf('Invalid tag: %s (expected: %s). Try PlugUpdate.', + \ (empty(tag) ? 'N/A' : tag), a:spec.tag) + endif + " Check branch + elseif a:spec.branch !=# branch + let err = printf('Invalid branch: %s (expected: %s). Try PlugUpdate.', + \ branch, a:spec.branch) + endif + if empty(err) + let [ahead, behind] = split(s:lastline(s:system(printf( + \ 'git rev-list --count --left-right HEAD...origin/%s', + \ a:spec.branch), a:spec.dir)), '\t') + if !v:shell_error && ahead + if behind + " Only mention PlugClean if diverged, otherwise it's likely to be + " pushable (and probably not that messed up). + let err = printf( + \ "Diverged from origin/%s (%d commit(s) ahead and %d commit(s) behind!\n" + \ .'Backup local changes and run PlugClean and PlugUpdate to reinstall it.', a:spec.branch, ahead, behind) + else + let err = printf("Ahead of origin/%s by %d commit(s).\n" + \ .'Cannot update until local changes are pushed.', + \ a:spec.branch, ahead) + endif + endif + endif + endif + else + let err = 'Not found' + endif + return [err, err =~# 'PlugClean'] +endfunction + +function! s:rm_rf(dir) + if isdirectory(a:dir) + call s:system((s:is_win ? 'rmdir /S /Q ' : 'rm -rf ') . s:shellesc(a:dir)) + endif +endfunction + +function! s:clean(force) + call s:prepare() + call append(0, 'Searching for invalid plugins in '.g:plug_home) + call append(1, '') + + " List of valid directories + let dirs = [] + let errs = {} + let [cnt, total] = [0, len(g:plugs)] + for [name, spec] in items(g:plugs) + if !s:is_managed(name) + call add(dirs, spec.dir) + else + let [err, clean] = s:git_validate(spec, 1) + if clean + let errs[spec.dir] = s:lines(err)[0] + else + call add(dirs, spec.dir) + endif + endif + let cnt += 1 + call s:progress_bar(2, repeat('=', cnt), total) + normal! 2G + redraw + endfor + + let allowed = {} + for dir in dirs + let allowed[s:dirpath(fnamemodify(dir, ':h:h'))] = 1 + let allowed[dir] = 1 + for child in s:glob_dir(dir) + let allowed[child] = 1 + endfor + endfor + + let todo = [] + let found = sort(s:glob_dir(g:plug_home)) + while !empty(found) + let f = remove(found, 0) + if !has_key(allowed, f) && isdirectory(f) + call add(todo, f) + call append(line('$'), '- ' . f) + if has_key(errs, f) + call append(line('$'), ' ' . errs[f]) + endif + let found = filter(found, 'stridx(v:val, f) != 0') + end + endwhile + + 4 + redraw + if empty(todo) + call append(line('$'), 'Already clean.') + else + let s:clean_count = 0 + call append(3, ['Directories to delete:', '']) + redraw! + if a:force || s:ask_no_interrupt('Delete all directories?') + call s:delete([6, line('$')], 1) + else + call setline(4, 'Cancelled.') + nnoremap d :set opfunc=delete_opg@ + nmap dd d_ + xnoremap d :call delete_op(visualmode(), 1) + echo 'Delete the lines (d{motion}) to delete the corresponding directories' + endif + endif + 4 + setlocal nomodifiable +endfunction + +function! s:delete_op(type, ...) + call s:delete(a:0 ? [line("'<"), line("'>")] : [line("'["), line("']")], 0) +endfunction + +function! s:delete(range, force) + let [l1, l2] = a:range + let force = a:force + while l1 <= l2 + let line = getline(l1) + if line =~ '^- ' && isdirectory(line[2:]) + execute l1 + redraw! + let answer = force ? 1 : s:ask('Delete '.line[2:].'?', 1) + let force = force || answer > 1 + if answer + call s:rm_rf(line[2:]) + setlocal modifiable + call setline(l1, '~'.line[1:]) + let s:clean_count += 1 + call setline(4, printf('Removed %d directories.', s:clean_count)) + setlocal nomodifiable + endif + endif + let l1 += 1 + endwhile +endfunction + +function! s:upgrade() + echo 'Downloading the latest version of vim-plug' + redraw + let tmp = tempname() + let new = tmp . '/plug.vim' + + try + let out = s:system(printf('git clone --depth 1 %s %s', s:plug_src, tmp)) + if v:shell_error + return s:err('Error upgrading vim-plug: '. out) + endif + + if readfile(s:me) ==# readfile(new) + echo 'vim-plug is already up-to-date' + return 0 + else + call rename(s:me, s:me . '.old') + call rename(new, s:me) + unlet g:loaded_plug + echo 'vim-plug has been upgraded' + return 1 + endif + finally + silent! call s:rm_rf(tmp) + endtry +endfunction + +function! s:upgrade_specs() + for spec in values(g:plugs) + let spec.frozen = get(spec, 'frozen', 0) + endfor +endfunction + +function! s:status() + call s:prepare() + call append(0, 'Checking plugins') + call append(1, '') + + let ecnt = 0 + let unloaded = 0 + let [cnt, total] = [0, len(g:plugs)] + for [name, spec] in items(g:plugs) + let is_dir = isdirectory(spec.dir) + if has_key(spec, 'uri') + if is_dir + let [err, _] = s:git_validate(spec, 1) + let [valid, msg] = [empty(err), empty(err) ? 'OK' : err] + else + let [valid, msg] = [0, 'Not found. Try PlugInstall.'] + endif + else + if is_dir + let [valid, msg] = [1, 'OK'] + else + let [valid, msg] = [0, 'Not found.'] + endif + endif + let cnt += 1 + let ecnt += !valid + " `s:loaded` entry can be missing if PlugUpgraded + if is_dir && get(s:loaded, name, -1) == 0 + let unloaded = 1 + let msg .= ' (not loaded)' + endif + call s:progress_bar(2, repeat('=', cnt), total) + call append(3, s:format_message(valid ? '-' : 'x', name, msg)) + normal! 2G + redraw + endfor + call setline(1, 'Finished. '.ecnt.' error(s).') + normal! gg + setlocal nomodifiable + if unloaded + echo "Press 'L' on each line to load plugin, or 'U' to update" + nnoremap L :call status_load(line('.')) + xnoremap L :call status_load(line('.')) + end +endfunction + +function! s:extract_name(str, prefix, suffix) + return matchstr(a:str, '^'.a:prefix.' \zs[^:]\+\ze:.*'.a:suffix.'$') +endfunction + +function! s:status_load(lnum) + let line = getline(a:lnum) + let name = s:extract_name(line, '-', '(not loaded)') + if !empty(name) + call plug#load(name) + setlocal modifiable + call setline(a:lnum, substitute(line, ' (not loaded)$', '', '')) + setlocal nomodifiable + endif +endfunction + +function! s:status_update() range + let lines = getline(a:firstline, a:lastline) + let names = filter(map(lines, 's:extract_name(v:val, "[x-]", "")'), '!empty(v:val)') + if !empty(names) + echo + execute 'PlugUpdate' join(names) + endif +endfunction + +function! s:is_preview_window_open() + silent! wincmd P + if &previewwindow + wincmd p + return 1 + endif +endfunction + +function! s:find_name(lnum) + for lnum in reverse(range(1, a:lnum)) + let line = getline(lnum) + if empty(line) + return '' + endif + let name = s:extract_name(line, '-', '') + if !empty(name) + return name + endif + endfor + return '' +endfunction + +function! s:preview_commit() + if b:plug_preview < 0 + let b:plug_preview = !s:is_preview_window_open() + endif + + let sha = matchstr(getline('.'), '^ \X*\zs[0-9a-f]\{7,9}') + if empty(sha) + return + endif + + let name = s:find_name(line('.')) + if empty(name) || !has_key(g:plugs, name) || !isdirectory(g:plugs[name].dir) + return + endif + + if exists('g:plug_pwindow') && !s:is_preview_window_open() + execute g:plug_pwindow + execute 'e' sha + else + execute 'pedit' sha + wincmd P + endif + setlocal previewwindow filetype=git buftype=nofile nobuflisted modifiable + try + let [sh, shellcmdflag, shrd] = s:chsh(1) + let cmd = 'cd '.s:shellesc(g:plugs[name].dir).' && git show --no-color --pretty=medium '.sha + if s:is_win + let batchfile = tempname().'.bat' + call writefile(["@echo off\r", cmd . "\r"], batchfile) + let cmd = batchfile + endif + execute 'silent %!' cmd + finally + let [&shell, &shellcmdflag, &shellredir] = [sh, shellcmdflag, shrd] + if s:is_win + call delete(batchfile) + endif + endtry + setlocal nomodifiable + nnoremap q :q + wincmd p +endfunction + +function! s:section(flags) + call search('\(^[x-] \)\@<=[^:]\+:', a:flags) +endfunction + +function! s:format_git_log(line) + let indent = ' ' + let tokens = split(a:line, nr2char(1)) + if len(tokens) != 5 + return indent.substitute(a:line, '\s*$', '', '') + endif + let [graph, sha, refs, subject, date] = tokens + let tag = matchstr(refs, 'tag: [^,)]\+') + let tag = empty(tag) ? ' ' : ' ('.tag.') ' + return printf('%s%s%s%s%s (%s)', indent, graph, sha, tag, subject, date) +endfunction + +function! s:append_ul(lnum, text) + call append(a:lnum, ['', a:text, repeat('-', len(a:text))]) +endfunction + +function! s:diff() + call s:prepare() + call append(0, ['Collecting changes ...', '']) + let cnts = [0, 0] + let bar = '' + let total = filter(copy(g:plugs), 's:is_managed(v:key) && isdirectory(v:val.dir)') + call s:progress_bar(2, bar, len(total)) + for origin in [1, 0] + let plugs = reverse(sort(items(filter(copy(total), (origin ? '' : '!').'(has_key(v:val, "commit") || has_key(v:val, "tag"))')))) + if empty(plugs) + continue + endif + call s:append_ul(2, origin ? 'Pending updates:' : 'Last update:') + for [k, v] in plugs + let range = origin ? '..origin/'.v.branch : 'HEAD@{1}..' + let cmd = 'git log --graph --color=never '.join(map(['--pretty=format:%x01%h%x01%d%x01%s%x01%cr', range], 's:shellesc(v:val)')) + if has_key(v, 'rtp') + let cmd .= ' -- '.s:shellesc(v.rtp) + endif + let diff = s:system_chomp(cmd, v.dir) + if !empty(diff) + let ref = has_key(v, 'tag') ? (' (tag: '.v.tag.')') : has_key(v, 'commit') ? (' '.v.commit) : '' + call append(5, extend(['', '- '.k.':'.ref], map(s:lines(diff), 's:format_git_log(v:val)'))) + let cnts[origin] += 1 + endif + let bar .= '=' + call s:progress_bar(2, bar, len(total)) + normal! 2G + redraw + endfor + if !cnts[origin] + call append(5, ['', 'N/A']) + endif + endfor + call setline(1, printf('%d plugin(s) updated.', cnts[0]) + \ . (cnts[1] ? printf(' %d plugin(s) have pending updates.', cnts[1]) : '')) + + if cnts[0] || cnts[1] + nnoremap (plug-preview) :silent! call preview_commit() + if empty(maparg("\", 'n')) + nmap (plug-preview) + endif + if empty(maparg('o', 'n')) + nmap o (plug-preview) + endif + endif + if cnts[0] + nnoremap X :call revert() + echo "Press 'X' on each block to revert the update" + endif + normal! gg + setlocal nomodifiable +endfunction + +function! s:revert() + if search('^Pending updates', 'bnW') + return + endif + + let name = s:find_name(line('.')) + if empty(name) || !has_key(g:plugs, name) || + \ input(printf('Revert the update of %s? (y/N) ', name)) !~? '^y' + return + endif + + call s:system('git reset --hard HEAD@{1} && git checkout '.s:esc(g:plugs[name].branch).' --', g:plugs[name].dir) + setlocal modifiable + normal! "_dap + setlocal nomodifiable + echo 'Reverted' +endfunction + +function! s:snapshot(force, ...) abort + call s:prepare() + setf vim + call append(0, ['" Generated by vim-plug', + \ '" '.strftime("%c"), + \ '" :source this file in vim to restore the snapshot', + \ '" or execute: vim -S snapshot.vim', + \ '', '', 'PlugUpdate!']) + 1 + let anchor = line('$') - 3 + let names = sort(keys(filter(copy(g:plugs), + \'has_key(v:val, "uri") && !has_key(v:val, "commit") && isdirectory(v:val.dir)'))) + for name in reverse(names) + let sha = s:system_chomp('git rev-parse --short HEAD', g:plugs[name].dir) + if !empty(sha) + call append(anchor, printf("silent! let g:plugs['%s'].commit = '%s'", name, sha)) + redraw + endif + endfor + + if a:0 > 0 + let fn = expand(a:1) + if filereadable(fn) && !(a:force || s:ask(a:1.' already exists. Overwrite?')) + return + endif + call writefile(getline(1, '$'), fn) + echo 'Saved as '.a:1 + silent execute 'e' s:esc(fn) + setf vim + endif +endfunction + +function! s:split_rtp() + return split(&rtp, '\\\@ *(.+)$") + +file_content = [] +try: + with open(filename, "r") as vim_buffer: + file_content = vim_buffer.readlines() +except: + exit() + +headers = [] +depth = [0] +inChunk = False +curChunk = None +for lnum, line in enumerate(file_content): + newline = [] + tag = "" + signature = "" + options = "" + # Headers + if re_header.match(line) and not inChunk: + level = len(re_header.match(line).group(1)) + tag = re_header.match(line).group(2).strip() + newline.append(tag) + newline.append(filename) + newline.append('/^' + line.rstrip("\n") + '$/;"') + newline.append("h") + newline.append("line:" + str(lnum+1)) + # header + while (level <= depth[len(depth) -1]): + headers.pop() + depth.pop() + if len(headers) > 0: + options = "header:" + "&&&".join(headers) + headers.append(tag) + depth.append(level) + # signature + if re_header.match(line).group(3): + signature = "(" + re_header.match(line).group(3).strip("{}") + ")" + options = options + "\tsignature:" + signature + # Print + newline.append(options) + print("\t".join(newline)) + # Chunks + if re_chunk.match(line): + inChunk = True + curChunk = re_chunk.match(line).group(1).strip() + newline.append(re_chunk.match(line).group(1).strip()) + newline.append(filename) + newline.append('/^' + line.rstrip("\n") + '$/;"') + newline.append("c") + newline.append("line:" + str(lnum+1)) + if len(headers) > 0: + options = "header:" + "&&&".join(headers) + if re_chunk.match(line).group(2): + signature = "(" + re_chunk.match(line).group(2).lstrip(", ") + ")" + options = options + "\tsignature:" + signature + # Print + newline.append(options) + print("\t".join(newline)) + if line == "```\n": + inChunk = False + curChunk = None + # Functions + if re_function.match(line) and inChunk: + newline.append(re_function.match(line).group(1).strip()) + newline.append(filename) + newline.append('/^' + line.rstrip("\n") + '$/;"') + newline.append("f") + newline.append("line:" + str(lnum+1)) + print("\t".join(newline)) + # elif (re_variable1.match(line) or re_variable2.match(line)) and inChunk: + # tag = re_variable1.match(line) or re_variable2.match(line) + # tag = tag.group(1).strip() + # newline.append(tag) + # newline.append(filename) + # newline.append('/^' + line.rstrip("\n") + '$/;"') + # newline.append("v") + # newline.append("line:" + str(lnum+1)) + # print("\t".join(newline)) + diff --git a/.config/nvim/gentags/vwtags.py b/.config/nvim/gentags/vwtags.py new file mode 100755 index 0000000..23698e1 --- /dev/null +++ b/.config/nvim/gentags/vwtags.py @@ -0,0 +1,82 @@ +#! /usr/bin/env python +# -*- coding: utf-8 -*- + +from __future__ import print_function + +help_text = """ +Extracts tags from Vimwiki files. Useful for the Tagbar plugin. + +Usage: +Install Tagbar (http://majutsushi.github.io/tagbar/). Then, put this file +anywhere and add the following to your .vimrc: + +let g:tagbar_type_vimwiki = { + \ 'ctagstype':'vimwiki' + \ , 'kinds':['h:header'] + \ , 'sro':'&&&' + \ , 'kind2scope':{'h':'header'} + \ , 'sort':0 + \ , 'ctagsbin':'/path/to/vwtags.py' + \ , 'ctagsargs': 'default' + \ } + +The value of ctagsargs must be one of 'default', 'markdown' or 'media', +whatever syntax you use. However, if you use multiple wikis with different +syntaxes, you can, as a workaround, use the value 'all' instead. Then, Tagbar +will show markdown style headers as well as default/mediawiki style headers, +but there might be erroneously shown headers. +""" + +import sys +import re + +if len(sys.argv) < 3: + print(help_text) + exit() + +syntax = sys.argv[1] +filename = sys.argv[2] +rx_default_media = r"^\s*(={1,6})([^=].*[^=])\1\s*$" +rx_markdown = r"^\s*(#{1,6})([^#].*)$" + +if syntax in ("default", "media"): + rx_header = re.compile(rx_default_media) +elif syntax == "markdown": + rx_header = re.compile(rx_markdown) +else: + rx_header = re.compile(rx_default_media + "|" + rx_markdown) + +file_content = [] +try: + with open(filename, "r") as vim_buffer: + file_content = vim_buffer.readlines() +except: + exit() + +state = [""]*6 +for lnum, line in enumerate(file_content): + + match_header = rx_header.match(line) + + if not match_header: + continue + + match_lvl = match_header.group(1) or match_header.group(3) + match_tag = match_header.group(2) or match_header.group(4) + + cur_lvl = len(match_lvl) + cur_tag = match_tag.strip() + cur_searchterm = "^" + match_header.group(0).rstrip("\r\n") + "$" + cur_kind = "h" + + state[cur_lvl-1] = cur_tag + for i in range(cur_lvl, 6): + state[i] = "" + + scope = "&&&".join( + [state[i] for i in range(0, cur_lvl-1) if state[i] != ""]) + if scope: + scope = "\theader:" + scope + + print('{0}\t{1}\t/{2}/;"\t{3}\tline:{4}{5}'.format( + cur_tag, filename, cur_searchterm, cur_kind, str(lnum+1), scope)) diff --git a/.config/nvim/init.d/keys.vim b/.config/nvim/init.d/keys.vim new file mode 100644 index 0000000..d334692 --- /dev/null +++ b/.config/nvim/init.d/keys.vim @@ -0,0 +1,121 @@ +" Map leader +map +map +let mapleader = " " + +map :hi Normal ctermbg=NONE:hi EndOfBuffer ctermbg=NONE + +" Quickfix navigation +noremap :cprev +noremap :cnext +" Play default macro +noremap q @q + +" Bepo mappings +noremap t h +noremap r l +noremap T H +noremap R L +noremap L D +noremap h r +noremap H R +noremap j t +noremap l d + +" Scrolling +noremap +noremap + +" Movements (by displayed line) +noremap d gk +noremap s gj + +" Swap display line behavior +noremap gd k +noremap gs j +noremap 0 g0 +noremap g0 0 +noremap $ g$ +noremap g$ $ +noremap ^ g^ +noremap g^ ^ + +" Page up/down +noremap D +noremap S + +" Next and previous in 'f' search to match standard scheme +noremap , ; +noremap ; , + +" Windows +nmap é +noremap h sj +noremap v v +noremap é + +noremap / 4< +noremap * 4> +noremap + 4+ +noremap - 4- + +noremap t h +noremap r l +noremap d k +noremap s j + +noremap T H +noremap R L +noremap D K +noremap S J + +noremap n :vnew +noremap f :vsplitgf + +" Tabs +nnoremap ggt gt +nnoremap ggl :tabclose +nnoremap ggn :tabnew + +" buffers as tabs +nnoremap gt :bnext +nnoremap gT :bprevious +nnoremap gn :enew +nnoremap gl :bprevious:bdelete # +nnoremap gL :bprevious:bdelete! # + +" fold navigation +noremap zs zj +noremap zd zk +noremap zt zm +noremap zT zM + +" Spell errors navigation +noremap zv [s +noremap zl ]s + +" Insert lines +noremap o o +noremap O O + +" follow links, C-] is impossible to type +noremap _ + +" disable Ex mode +noremap Q + +" have Y work like D and C (ie: yank the line right of the cursor) +nnoremap Y y$ + +" remap ii to Esc in insert mode, easier ! +inoremap ii + +" Write with root privileges +command! WW execute "w suda://%" +command! W execute "w" + +" Edit vimrc +nnoremap $ :e $MYVIMRC + +" Exit terminal +tnoremap ii diff --git a/.config/nvim/init.d/options.vim b/.config/nvim/init.d/options.vim new file mode 100644 index 0000000..688cac3 --- /dev/null +++ b/.config/nvim/init.d/options.vim @@ -0,0 +1,115 @@ +set background=dark " Dark theme for the colorscheme +colorscheme hybrid " Colorscheme + +set ruler " Show the cursor position all the time +set cursorline " Highlight current line +set number relativenumber " Line numbers, current and relative + +set updatetime=100 " Shorten update time to 100ms instead of 4 + +set listchars=tab:▸·,trail:-,nbsp:· +set list " Display tabs and trailing spaces +set linebreak " Break lines with wrap on word separators +set breakindent " Indent the wrapped line +set breakindentopt=shift:2,sbr " Indent by 2 and draw the break char +set showbreak=↳ +highlight Normal ctermbg=NONE guibg=NONE " transparent background +highlight EndOfBuffer ctermbg=NONE +highlight List ctermbg=NONE ctermfg=darkred guibg=lightgray " Listchars highlight +match List /\%xa0/ +2match List / \+$/ + +highlight DiffText ctermbg=104 ctermfg=220 +highlight LineNr ctermfg=darkgrey +highlight Comment cterm=italic " Comments in italics +highlight MatchParen ctermbg = 11 " Match parenthesis in bright yellow +highlight Conceal ctermbg=NONE ctermfg=grey +highlight Visual ctermbg=darkgrey +highlight Pmenu ctermbg=darkgrey + +set showcmd " Show visual selection size + +set splitright " Vertical split to the right +set fillchars=vert:⎢ " Vertical line for splits + +set laststatus=2 " Always display status bar + +set timeoutlen=300 " Set key timeout + +set hidden " Enable buffers to be hidden even if modified + +set fileencoding=utf-8 " Encoding +scriptencoding utf-8 + +set autochdir " Auto change directory to current file + +set undofile undodir=~/.config/nvim/undodir/ " Permanent undo +set backup backupdir=~/.config/nvim/backupdir " Set backup folder +set swapfile directory=~/.config/nvim/swap " Swapfile +set updatecount=10 " Write to swap every 10 chars + +set foldmethod=syntax " Fold with syntax +set foldlevelstart=99 + +set completeopt=noinsert,menuone " Display a completion menu, don't insert anything till selected + +set wildmenu " Autocomplete in command mode +set wildmode=list:longest,full " First show list of matches without replacing, then completion +set wildignore+=*.bmp,*.gif,*.ico,*.jpg,*.png,*.ico " Skip those filetypes and directories +set wildignore+=*.mkv,*.mp4,*.avi +set wildignore+=.cache/*,Private/*,Documents/*,Downloads/*,Jeux/*,node_modules/*,old_desktop/*,R/* +set wildignorecase " Ignore case when searching for files + +set cpoptions+=$ " Display $ in change mode +set backspace=indent,eol,start " Allow backspace to erase indent,eol, before start + +set history=50 " Keep 50 lines of command line history + +set gdefault " s///g by default +set incsearch " Do incremental searching +set hlsearch " Highlight searches +set ignorecase smartcase " Smartcase +set inccommand=nosplit " Preview replace +highlight Search cterm=bold,underline ctermfg=NONE ctermbg=NONE " Search results in underlined bold + +set spelllang=en_us " Correct spelling in English by default + +set mouse=a " Enable mouse + +set autoindent " Indent like previous line +set smartindent " Also indent in code blocks + +set scrolloff=10 " Vertical scroll offset +set sidescroll=1 " Scroll horizontally one line at a time +set sidescrolloff=1000 " Horizontal scroll offset (keep cursor in middle) + +set expandtab " Use spaces instead of tabs +set tabstop=2 " Use 2 spaces for one tab +set softtabstop=2 " Use 2 spaces for soft tabs +set shiftwidth=2 " Shift by 2 spaces when indenting + +set formatoptions+=j " Delete comment character when joining comment lines +set diffopt=filler,vertical,foldcolumn:0 +set clipboard^=unnamed,unnamedplus "default clipboard to X clipboard + +set diffopt=filler,vertical + +augroup Resource + autocmd! + + autocmd! bufwritepost ~/.config/nvim/init.* + \ source ~/.config/nvim/init.vim " Reload .vimrc after editing +augroup END + +augroup templates + autocmd! + + autocmd! BufNewFile *.md 0r ~/.config/nvim/templates/template.md + autocmd! BufNewFile *.Rmd 0r ~/.config/nvim/templates/template.Rmd +augroup END + +augroup ncm2start + autocmd! + + autocmd! BufEnter * call ncm2#enable_for_buffer() +augroup END diff --git a/.config/nvim/init.d/plugins.vim b/.config/nvim/init.d/plugins.vim new file mode 100644 index 0000000..21f603f --- /dev/null +++ b/.config/nvim/init.d/plugins.vim @@ -0,0 +1,145 @@ +" elm +let g:elm_make_output_file = "index.html" +let g:elm_make_show_warnings = 1 +let g:elm_format_autosave = 1 +let g:elm_format_fail_silently = 1 +let g:elm_jump_to_error = 0 +let g:elm_setup_keybindings = 0 +let g:elm_detailed_complete = 1 +let g:elm_browser_command = "qutebrowser" + +" vim-pandoc +let g:pandoc#filetypes#handled = ["markdown"] +let g:pandoc#modules#enabled = ["bibliographies", "toc", "completion"] +let g:pandoc#biblio#use_bibtool = 1 + +" 고요 and Limelight +let g:goyo_width = 100 +let g:goyo_height = 95 + +" Nvim-R +let R_rconsole_height = 25 +let R_nvimpager="vertical" +let R_args_in_stline = 1 +let r_syntax_folding = 0 +let R_rconsole_width = 0 +let R_close_term = 1 +let R_assign = 3 +let R_objbr_opendf = 0 +let R_start_libs = 'base,stats,graphics,grDevices,utils,methods,dplyr,tidyr,ggplot2,stringr,forcats,lubridate,purrr' + +" easymotion +let g:EasyMotion_smartcase = 1 +let g:EasyMotion_keys = 'auiecmtsrn' +let g:EasyMotion_use_upper = 1 + +" Autopairs +let g:AutoPairsMultilineClose = 0 + +" vim-airline options +set noshowmode +let g:airline_powerline_fonts=1 + +" vim-workspace +let g:workspace_powerline_separators = 1 +let g:workspace_tab_icon = "#" +function! g:WorkspaceSetCustomColors() + hi! WorkspaceBufferTruncDefault cterm=bold ctermbg=10 ctermfg=8 guibg=#999999 guifg=#000000 + hi! WorkspaceIconDefault cterm=NONE ctermbg=5 ctermfg=10 guibg=#FF0000 guifg=#999999 + + highlight WorkspaceBufferCurrent ctermbg=green ctermfg=black guibg=green + highlight WorkspaceBufferActive ctermbg=darkgreen ctermfg=black guibg=darkgreen + highlight WorkspaceBufferHidden ctermbg=black ctermfg=white guibg=black + highlight WorkspaceTabHidden ctermbg=darkblue ctermfg=black guibg=darkblue + highlight WorkspaceTabCurrent ctermbg=blue ctermfg=white guibg=black + highlight WorkspaceFill ctermbg=black ctermfg=white guibg=black +endfunction + +function! s:goyo_enter() + highlight EndOfBuffer ctermbg=NONE + Limelight +endfunction + +function! s:goyo_leave() + highlight Comment cterm=italic + highlight List ctermbg=NONE ctermfg=darkred guibg=gray + + highlight EndOfBuffer ctermbg=235 + highlight Search cterm=bold,underline ctermfg=NONE ctermbg=NONE + highlight MatchParen ctermbg = 11 + + Limelight! +endfunction + +augroup Goyo + autocmd! + + autocmd! User GoyoEnter nested call goyo_enter() + autocmd! User GoyoLeave nested call goyo_leave() +augroup END + +" vimwiki +let g:vimwiki_folding='expr:quick' +let g:vimwiki_list = [{'path': '~/Private/vimwiki/', + \ 'template_path': '~/Private/vimwiki/templates/', + \ 'template_default': 'default', + \ 'template_ext': '.tpl', + \ 'ext': '.wiki', + \ 'path_html': '~/Private/vimwiki/html/'}, + \ {'path': '~/Projects/z_Perso/website/content/page/', + \ 'index': 'pages', + \ 'syntax': 'markdown', + \ 'ext': '.md'}] + +" Tagbar +let g:tagbar_foldlevel=0 +let g:tagbar_autoshowtag=1 +let g:tagbar_iconchars = ['▸', '▾'] +let g:tagbar_autofocus=1 +let g:tagbar_compact=1 +let g:tagbar_width=40 + +let g:tagbar_type_elm = { + \ 'ctagstype':'elm' + \ , 'kinds':['h:header', 'i:import', 't:type', 'f:function', 'e:exposing'] + \ , 'sro':'&&&' + \ , 'kind2scope':{ 'h':'header', 'i':'import'} + \ , 'sort':0 + \ , 'ctagsbin':'~/.config/nvim/gentags/elmtags.py' + \ , 'ctagsargs': '' + \ } + +let g:tagbar_type_vimwiki = { + \ 'ctagstype':'vimwiki' + \ , 'kinds':['h:header'] + \ , 'sro':'&&&' + \ , 'kind2scope':{'h':'header'} + \ , 'sort':0 + \ , 'ctagsbin':'~/.config/nvim/gentags/vwtags.py' + \ , 'ctagsargs': 'default' + \ } + +let g:tagbar_type_rmd = { + \ 'ctagstype':'rmd' + \ , 'kinds':['h:header', 'c:chunk', 'f:function'] + \ , 'sro':'&&&' + \ , 'kind2scope':{'h':'header', 'c':'chunk'} + \ , 'sort':0 + \ , 'ctagsbin':'~/.config/nvim/gentags/rmdtags.py' + \ , 'ctagsargs': '' + \ } + +let g:tagbar_type_r = { + \ 'ctagstype' : 'r', + \ 'kinds' : [ + \ 'f:Functions', + \ 'g:GlobalVariables', + \ 'v:FunctionVariables', + \ ] +\ } + +augroup Tagbar + autocmd! + + autocmd! FileType vimwiki nested :TagbarOpen +augroup END diff --git a/.config/nvim/init.d/plugkeys.vim b/.config/nvim/init.d/plugkeys.vim new file mode 100644 index 0000000..8b9ad21 --- /dev/null +++ b/.config/nvim/init.d/plugkeys.vim @@ -0,0 +1,80 @@ +" NCM +inoremap pumvisible() ? "\" : "\" +inoremap pumvisible() ? "\" : "\" +" inoremap ncm2_ultisnips#expand_or("\", 'n') + +" Ale +nmap ld (ale_previous_wrap) +nmap ls (ale_next_wrap) +nmap la (ale_detail) +nmap lt (ale_toggle) + +" Tagbar +nnoremap tt :TagbarOpen fjc +let g:tagbar_map_togglesort = "S" +let g:tagbar_map_nextfold = "zs" +let g:tagbar_map_prevfold = "zd" +let g:tagbar_map_incrementfold = "zr" +let g:tagbar_map_decrementfold = "zt" +let g:tagbar_map_openallfolds = "zR" +let g:tagbar_map_closeallfolds = "zT" + +" Elm +nmap em (elm-make) +nmap er (elm-repl) +nmap ee (elm-error-detail) +nmap ed (elm-show-docs) + +" Loupe +nmap ÷ (LoupeClearHighlight) + +" Ultisnips +" let g:UltiSnipsExpandTrigger="" +let g:UltiSnipsJumpForwardTrigger="" +let g:UltiSnipsJumpBackwardTrigger="" + +" 고요 and Limelight +noremap d :Goyo +noremap D :Limelight!! + +" Fugitive +noremap g :Gstatus +noremap gp :Git push +noremap ga :Git add % -f + +" Gitv +let g:Gitv_CustomMappings = { + \'prevCommit': 's', + \'nextCommit': 'd', + \'vdiff': 'D', + \'delete': 'l', + \'quit': 'q', + \'editCommit': '', + \'vertSplitCommit': 'S', + \'nextBranch': 'x', + \'prevBranch': 'X', + \'vcherryPick': 'cp' + \} + +" Nvim-R +nmap RHelp +nmap RStart +nmap RUpdateObjBrowser +nmap RDSendLine +vmap REDSendSelection + +" vim-lion +let g:lion_create_maps = 1 +let g:lion_map_right = "a" +let g:lion_map_left = "A" + +" UndoTree +nnoremap u :UndotreeToggle :UndotreeFocus + +" vim-surround +au vimenter * unmap ds +nmap ls Dsurround + +" vim-ranger +let g:ranger_map_keys = 0 +map F :Ranger diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim new file mode 100644 index 0000000..6cfd9ca --- /dev/null +++ b/.config/nvim/init.vim @@ -0,0 +1,63 @@ +if !exists("g:syntax_on") + syntax enable "detect syntax +endif +filetype plugin indent on "filetype plugins + indentation + +call plug#begin('~/.config/nvim/plugged') +" Sudo replacement + Plug 'lambdalisue/suda.vim' +" Appearance + Plug 'bagrat/vim-workspace' + Plug 'w0ng/vim-hybrid' + Plug 'bling/vim-airline' + Plug 'junegunn/goyo.vim' + Plug 'junegunn/limelight.vim' + Plug 'wincent/loupe' +" Git + Plug 'tpope/vim-fugitive' + Plug 'airblade/vim-gitgutter' + Plug 'gregsexton/gitv' +" Elm + Plug 'elmcast/elm-vim' +" vimwiki + Plug 'vimwiki/vimwiki' + Plug 'majutsushi/tagbar' +" Python + Plug 'davidhalter/jedi' + Plug 'jalvesaq/vimcmdline' +" HTML/JS + Plug 'pangloss/vim-javascript' + Plug 'rstacruz/sparkup' +" R/Rmd + Plug 'jalvesaq/Nvim-R' + Plug 'vim-pandoc/vim-pandoc' + Plug 'vim-pandoc/vim-pandoc-syntax' +" All purpose + Plug 'w0rp/ale' + Plug 'SirVer/ultisnips' + Plug 'reedes/vim-wordy' + Plug 'junegunn/vim-peekaboo' + Plug 'tpope/vim-surround' + Plug 'wellle/targets.vim' + Plug 'tommcdo/vim-lion' + Plug 'tpope/vim-repeat' + Plug 'tpope/vim-commentary' + Plug 'mbbill/undotree' + Plug 'easymotion/vim-easymotion' +" Ranger + Plug 'francoiscabrol/ranger.vim' + Plug 'rbgrouleff/bclose.vim' +" NCM2 + Plug 'ncm2/ncm2' + Plug 'roxma/nvim-yarp' + Plug 'ncm2/ncm2-path' + Plug 'ncm2/ncm2-bufword' + Plug 'ncm2/ncm2-jedi' + Plug 'ncm2/ncm2-ultisnips' + Plug 'gaalcaras/ncm-R' +call plug#end() + +source $HOME/.config/nvim/init.d/keys.vim +source $HOME/.config/nvim/init.d/plugins.vim +source $HOME/.config/nvim/init.d/plugkeys.vim +source $HOME/.config/nvim/init.d/options.vim diff --git a/.config/nvim/templates/template.Rmd b/.config/nvim/templates/template.Rmd new file mode 100644 index 0000000..70f3b07 --- /dev/null +++ b/.config/nvim/templates/template.Rmd @@ -0,0 +1,23 @@ +--- +title: +output: + html_document: + toc: true + toc_float: true +--- + +```{r init, echo = F, message = F, warning = F} +library(tidyverse) +library(knitr) +library(DT) + +opts_chunk$set(echo = F, + message = F, + warning = F) + +options(DT.options = list(paging = F, + searching = T, + info = F, + dom = "Bfrtip", + buttons = c("copy", "excel"))) +``` diff --git a/.config/nvim/templates/template.md b/.config/nvim/templates/template.md new file mode 100644 index 0000000..4f61ad8 --- /dev/null +++ b/.config/nvim/templates/template.md @@ -0,0 +1,9 @@ +--- +title: +authors: ['maximewack'] +date: '' +slug: +draft: true +categories: [] +tags: [] +--- diff --git a/.config/qutebrowser/config.py b/.config/qutebrowser/config.py new file mode 100644 index 0000000..1db30f9 --- /dev/null +++ b/.config/qutebrowser/config.py @@ -0,0 +1,1538 @@ +# Autogenerated config.py +# Documentation: +# qute://help/configuring.html +# qute://help/settings.html + +# This is here so configs done via the GUI are still loaded. +# Remove it to not load settings done via the GUI. +# config.load_autoconfig() + +# Aliases for commands. The keys of the given dictionary are the +# aliases, while the values are the commands they map to. +# Type: Dict +c.aliases = {'w': 'session-save', + 'q': 'quit', + 'wq': 'quit --save', + 'ff': 'spawn firefox {url}', + 'q': 'quit', + 'tor': 'config-cycle -p content.proxy socks://localhost:9050/ system', + 'toroff': 'set content.proxy system', + 'toron': 'set content.proxy socks://localhost:9050', + 'zotero': 'spawn --userscript zotero', + 'zotero_link': 'hint links userscript zotero' + } + +# How often (in milliseconds) to auto-save config/cookies/etc. +# Type: Int +c.auto_save.interval = 15000 + +# Always restore open sites when qutebrowser is reopened. +# Type: Bool +c.auto_save.session = True + +# The backend to use to display websites. qutebrowser supports two +# different web rendering engines / backends, QtWebKit and QtWebEngine. +# QtWebKit was discontinued by the Qt project with Qt 5.6, but picked up +# as a well maintained fork: https://github.com/annulen/webkit/wiki - +# qutebrowser only supports the fork. QtWebEngine is Qt's official +# successor to QtWebKit. It's slightly more resource hungry that +# QtWebKit and has a couple of missing features in qutebrowser, but is +# generally the preferred choice. This setting requires a restart. +# Type: String +# Valid values: +# - webengine: Use QtWebEngine (based on Chromium) +# - webkit: Use QtWebKit (based on WebKit, similar to Safari) +c.backend = 'webengine' + +# This setting can be used to map keys to other keys. When the key used +# as dictionary-key is pressed, the binding for the key used as +# dictionary-value is invoked instead. This is useful for global +# remappings of keys, for example to map Ctrl-[ to Escape. Note that +# when a key is bound (via `bindings.default` or `bindings.commands`), +# the mapping is ignored. +# Type: Dict +c.bindings.key_mappings = {'': '', '': '', '': '', '': '', '': '', '': '', '': '', '': ''} + +# Background color of the completion widget category headers. +# Type: QssColor +c.colors.completion.category.bg = 'qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #888888, stop:1 #505050)' + +# Bottom border color of the completion widget category headers. +# Type: QssColor +c.colors.completion.category.border.bottom = 'black' + +# Top border color of the completion widget category headers. +# Type: QssColor +c.colors.completion.category.border.top = 'black' + +# Foreground color of completion widget category headers. +# Type: QtColor +c.colors.completion.category.fg = 'white' + +# Background color of the completion widget for even rows. +# Type: QssColor +c.colors.completion.even.bg = '#333333' + +# Text color of the completion widget. +# Type: QtColor +c.colors.completion.fg = 'white' + +# Background color of the selected completion item. +# Type: QssColor +c.colors.completion.item.selected.bg = '#e8c000' + +# Bottom border color of the selected completion item. +# Type: QssColor +c.colors.completion.item.selected.border.bottom = '#bbbb00' + +# Top border color of the completion widget category headers. +# Type: QssColor +c.colors.completion.item.selected.border.top = '#bbbb00' + +# Foreground color of the selected completion item. +# Type: QtColor +c.colors.completion.item.selected.fg = 'black' + +# Foreground color of the matched text in the completion. +# Type: QssColor +c.colors.completion.match.fg = '#ff4444' + +# Background color of the completion widget for odd rows. +# Type: QssColor +c.colors.completion.odd.bg = '#444444' + +# Color of the scrollbar in completion view +# Type: QssColor +c.colors.completion.scrollbar.bg = '#333333' + +# Color of the scrollbar handle in completion view. +# Type: QssColor +c.colors.completion.scrollbar.fg = 'white' + +# Background color for the download bar. +# Type: QssColor +c.colors.downloads.bar.bg = 'black' + +# Background color for downloads with errors. +# Type: QtColor +c.colors.downloads.error.bg = 'red' + +# Foreground color for downloads with errors. +# Type: QtColor +c.colors.downloads.error.fg = 'white' + +# Color gradient start for download backgrounds. +# Type: QtColor +c.colors.downloads.start.bg = '#0000aa' + +# Color gradient start for download text. +# Type: QtColor +c.colors.downloads.start.fg = 'white' + +# Color gradient stop for download backgrounds. +# Type: QtColor +c.colors.downloads.stop.bg = '#00aa00' + +# Color gradient end for download text. +# Type: QtColor +c.colors.downloads.stop.fg = 'white' + +# Color gradient interpolation system for download backgrounds. +# Type: ColorSystem +# Valid values: +# - rgb: Interpolate in the RGB color system. +# - hsv: Interpolate in the HSV color system. +# - hsl: Interpolate in the HSL color system. +# - none: Don't show a gradient. +c.colors.downloads.system.bg = 'rgb' + +# Color gradient interpolation system for download text. +# Type: ColorSystem +# Valid values: +# - rgb: Interpolate in the RGB color system. +# - hsv: Interpolate in the HSV color system. +# - hsl: Interpolate in the HSL color system. +# - none: Don't show a gradient. +c.colors.downloads.system.fg = 'rgb' + +# Background color for hints. Note that you can use a `rgba(...)` value +# for transparency. +# Type: QssColor +c.colors.hints.bg = 'rgba(0,0,0,128)' + +# Font color for hints. +# Type: QssColor +c.colors.hints.fg = 'white' + +# Font color for the matched part of hints. +# Type: QssColor +c.colors.hints.match.fg = 'rgba(0,0,0,128)' + +# Background color of the keyhint widget. +# Type: QssColor +c.colors.keyhint.bg = 'rgba(0, 0, 0, 80%)' + +# Text color for the keyhint widget. +# Type: QssColor +c.colors.keyhint.fg = '#FFFFFF' + +# Highlight color for keys to complete the current keychain. +# Type: QssColor +c.colors.keyhint.suffix.fg = '#FFFF00' + +# Background color of an error message. +# Type: QssColor +c.colors.messages.error.bg = 'red' + +# Border color of an error message. +# Type: QssColor +c.colors.messages.error.border = '#bb0000' + +# Foreground color of an error message. +# Type: QssColor +c.colors.messages.error.fg = 'white' + +# Background color of an info message. +# Type: QssColor +c.colors.messages.info.bg = 'black' + +# Border color of an info message. +# Type: QssColor +c.colors.messages.info.border = '#333333' + +# Foreground color an info message. +# Type: QssColor +c.colors.messages.info.fg = 'white' + +# Background color of a warning message. +# Type: QssColor +c.colors.messages.warning.bg = 'darkorange' + +# Border color of a warning message. +# Type: QssColor +c.colors.messages.warning.border = '#d47300' + +# Foreground color a warning message. +# Type: QssColor +c.colors.messages.warning.fg = 'white' + +# Background color for prompts. +# Type: QssColor +c.colors.prompts.bg = '#444444' + +# Border used around UI elements in prompts. +# Type: String +c.colors.prompts.border = '1px solid gray' + +# Foreground color for prompts. +# Type: QssColor +c.colors.prompts.fg = 'white' + +# Background color for the selected item in filename prompts. +# Type: QssColor +c.colors.prompts.selected.bg = 'grey' + +# Background color of the statusbar in caret mode. +# Type: QssColor +c.colors.statusbar.caret.bg = 'purple' + +# Foreground color of the statusbar in caret mode. +# Type: QssColor +c.colors.statusbar.caret.fg = 'white' + +# Background color of the statusbar in caret mode with a selection. +# Type: QssColor +c.colors.statusbar.caret.selection.bg = '#a12dff' + +# Foreground color of the statusbar in caret mode with a selection. +# Type: QssColor +c.colors.statusbar.caret.selection.fg = 'white' + +# Background color of the statusbar in command mode. +# Type: QssColor +c.colors.statusbar.command.bg = 'black' + +# Foreground color of the statusbar in command mode. +# Type: QssColor +c.colors.statusbar.command.fg = 'white' + +# Background color of the statusbar in private browsing + command mode. +# Type: QssColor +c.colors.statusbar.command.private.bg = 'grey' + +# Foreground color of the statusbar in private browsing + command mode. +# Type: QssColor +c.colors.statusbar.command.private.fg = 'white' + +# Background color of the statusbar in insert mode. +# Type: QssColor +c.colors.statusbar.insert.bg = 'darkgreen' + +# Foreground color of the statusbar in insert mode. +# Type: QssColor +c.colors.statusbar.insert.fg = 'white' + +# Background color of the statusbar. +# Type: QssColor +c.colors.statusbar.normal.bg = 'black' + +# Foreground color of the statusbar. +# Type: QssColor +c.colors.statusbar.normal.fg = 'white' + +# Background color of the statusbar in private browsing mode. +# Type: QssColor +c.colors.statusbar.private.bg = '#666666' + +# Foreground color of the statusbar in private browsing mode. +# Type: QssColor +c.colors.statusbar.private.fg = 'white' + +# Background color of the progress bar. +# Type: QssColor +c.colors.statusbar.progress.bg = 'white' + +# Foreground color of the URL in the statusbar on error. +# Type: QssColor +c.colors.statusbar.url.error.fg = 'orange' + +# Default foreground color of the URL in the statusbar. +# Type: QssColor +c.colors.statusbar.url.fg = 'white' + +# Foreground color of the URL in the statusbar for hovered links. +# Type: QssColor +c.colors.statusbar.url.hover.fg = 'aqua' + +# Foreground color of the URL in the statusbar on successful load +# (http). +# Type: QssColor +c.colors.statusbar.url.success.http.fg = 'white' + +# Foreground color of the URL in the statusbar on successful load +# (https). +# Type: QssColor +c.colors.statusbar.url.success.https.fg = 'lime' + +# Foreground color of the URL in the statusbar when there's a warning. +# Type: QssColor +c.colors.statusbar.url.warn.fg = 'yellow' + +# Background color of the tab bar. +# Type: QtColor +c.colors.tabs.bar.bg = '#555555' + +# Background color of unselected even tabs. +# Type: QtColor +c.colors.tabs.even.bg = 'darkgrey' + +# Foreground color of unselected even tabs. +# Type: QtColor +c.colors.tabs.even.fg = 'white' + +# Color for the tab indicator on errors. +# Type: QtColor +c.colors.tabs.indicator.error = '#ff0000' + +# Color gradient start for the tab indicator. +# Type: QtColor +c.colors.tabs.indicator.start = '#0000aa' + +# Color gradient end for the tab indicator. +# Type: QtColor +c.colors.tabs.indicator.stop = '#00aa00' + +# Color gradient interpolation system for the tab indicator. +# Type: ColorSystem +# Valid values: +# - rgb: Interpolate in the RGB color system. +# - hsv: Interpolate in the HSV color system. +# - hsl: Interpolate in the HSL color system. +# - none: Don't show a gradient. +c.colors.tabs.indicator.system = 'rgb' + +# Background color of unselected odd tabs. +# Type: QtColor +c.colors.tabs.odd.bg = 'grey' + +# Foreground color of unselected odd tabs. +# Type: QtColor +c.colors.tabs.odd.fg = 'white' + +# Background color of selected even tabs. +# Type: QtColor +c.colors.tabs.selected.even.bg = 'black' + +# Foreground color of selected even tabs. +# Type: QtColor +c.colors.tabs.selected.even.fg = 'white' + +# Background color of selected odd tabs. +# Type: QtColor +c.colors.tabs.selected.odd.bg = 'black' + +# Foreground color of selected odd tabs. +# Type: QtColor +c.colors.tabs.selected.odd.fg = 'white' + +# Background color for webpages if unset (or empty to use the theme's +# color) +# Type: QtColor +c.colors.webpage.bg = 'white' + +# How many commands to save in the command history. 0: no history / -1: +# unlimited +# Type: Int +c.completion.cmd_history_max_items = 100 + +# The height of the completion, in px or as percentage of the window. +# Type: PercOrInt +c.completion.height = '30%' + +# Move on to the next part when there's only one possible completion +# left. +# Type: Bool +c.completion.quick = True + +# Padding of scrollbar handle in the completion window (in px). +# Type: Int +c.completion.scrollbar.padding = 2 + +# Width of the scrollbar in the completion window (in px). +# Type: Int +c.completion.scrollbar.width = 12 + +# When to show the autocompletion window. +# Type: String +# Valid values: +# - always: Whenever a completion is available. +# - auto: Whenever a completion is requested. +# - never: Never. +c.completion.show = 'auto' + +# Shrink the completion to be smaller than the configured size if there +# are no scrollbars. +# Type: Bool +c.completion.shrink = False + +# How to format timestamps (e.g. for the history completion). +# Type: TimestampTemplate +c.completion.timestamp_format = '%Y-%m-%d' + +# How many URLs to show in the web history. 0: no history / -1: +# unlimited +# Type: Int +c.completion.web_history.max_items = -1 + +# Whether quitting the application requires a confirmation. +# Type: ConfirmQuit +# Valid values: +# - always: Always show a confirmation. +# - multiple-tabs: Show a confirmation if multiple tabs are opened. +# - downloads: Show a confirmation if downloads are running +# - never: Never show a confirmation. +c.confirm_quit = ['downloads'] + +# Whether support for the HTML 5 web application cache feature is +# enabled. An application cache acts like an HTTP cache in some sense. +# For documents that use the application cache via JavaScript, the +# loader engine will first ask the application cache for the contents, +# before hitting the network. +# Type: Bool +c.content.cache.appcache = True + +# The maximum number of pages to hold in the global memory page cache. +# The Page Cache allows for a nicer user experience when navigating +# forth or back to pages in the forward/back history, by pausing and +# resuming up to _n_ pages. For more information about the feature, +# please refer to: http://webkit.org/blog/427/webkit-page-cache-i-the- +# basics/ +# Type: Int +c.content.cache.maximum_pages = 0 + +# Size of the HTTP network cache. Null to use the default value. +# Type: Int +c.content.cache.size = None + +# Control which cookies to accept. +# Type: String +# Valid values: +# - all: Accept all cookies. +# - no-3rdparty: Accept cookies from the same origin only. +# - no-unknown-3rdparty: Accept cookies from the same origin only, unless a cookie is already set for the domain. +# - never: Don't accept cookies at all. +c.content.cookies.accept = 'no-3rdparty' + +# Store cookies. Note this option needs a restart with QtWebEngine on Qt +# < 5.9. +# Type: Bool +c.content.cookies.store = True + +# Default encoding to use for websites. The encoding must be a string +# describing an encoding such as _utf-8_, _iso-8859-1_, etc. +# Type: String +c.content.default_encoding = 'iso-8859-1' + +# Try to pre-fetch DNS entries to speed up browsing. +# Type: Bool +c.content.dns_prefetch = True + +# Expand each subframe to its contents. This will flatten all the frames +# to become one scrollable page. +# Type: Bool +c.content.frame_flattening = False + +# Allow websites to request geolocations. +# Type: BoolAsk +# Valid values: +# - true +# - false +# - ask +c.content.geolocation = 'ask' + +# Value to send in the `Accept-Language` header. +# Type: String +c.content.headers.accept_language = 'en-US,en' + +# Set custom headers for qutebrowser HTTP requests. +# Type: Dict +c.content.headers.custom = {} + +# Value to send in the `DNT` header. When this is set to true, +# qutebrowser asks websites to not track your identity. If set to null, +# the DNT header is not sent at all. +# Type: Bool +c.content.headers.do_not_track = True + +# Send the Referer header. The Referer header tells websites from which +# website you were coming from when visting them. +# Type: String +# Valid values: +# - always: Always send the Referer. +# - never: Never send the Referer. This is not recommended, as some sites may break. +# - same-domain: Only send the Referer for the same domain. This will still protect your privacy, but shouldn't break any sites. +c.content.headers.referer = 'same-domain' + +# User agent to send. Unset to send the default. +# Type: String +c.content.headers.user_agent = None + +# Whether host blocking is enabled. +# Type: Bool +c.content.host_blocking.enabled = True + +# List of URLs of lists which contain hosts to block. The file can be +# in one of the following formats: - An `/etc/hosts`-like file - One +# host per line - A zip-file of any of the above, with either only one +# file, or a file named `hosts` (with any extension). +# Type: List of Url +c.content.host_blocking.lists = ['https://www.malwaredomainlist.com/hostslist/hosts.txt', 'http://someonewhocares.org/hosts/hosts', 'http://winhelp2002.mvps.org/hosts.zip', 'http://malwaredomains.lehigh.edu/files/justdomains.zip', 'https://pgl.yoyo.org/adservers/serverlist.php?hostformat=hosts&mimetype=plaintext'] + +# List of domains that should always be loaded, despite being ad- +# blocked. Domains may contain * and ? wildcards and are otherwise +# required to exactly match the requested domain. Local domains are +# always exempt from hostblocking. +# Type: List of String +c.content.host_blocking.whitelist = ['piwik.org'] + +# Enable or disable hyperlink auditing (``). +# Type: Bool +c.content.hyperlink_auditing = False + +# Whether images are automatically loaded in web pages. +# Type: Bool +c.content.images = True + +# Show javascript alerts. +# Type: Bool +c.content.javascript.alert = True + +# Whether JavaScript can read from or write to the clipboard. With +# QtWebEngine, writing the clipboard as response to a user interaction +# is always allowed. +# Type: Bool +c.content.javascript.can_access_clipboard = False + +# Whether JavaScript can close tabs. +# Type: Bool +c.content.javascript.can_close_tabs = False + +# Whether JavaScript can open new tabs without user interaction. +# Type: Bool +c.content.javascript.can_open_tabs_automatically = False + +# Enables or disables JavaScript. +# Type: Bool +c.content.javascript.enabled = True + +# Log levels to use for JavaScript console logging messages. When a +# JavaScript message with the level given in the dictionary key is +# logged, the corresponding dictionary value selects the qutebrowser +# logger to use. On QtWebKit, the "unknown" setting is always used. +# Type: Dict +c.content.javascript.log = {'unknown': 'debug', 'info': 'debug', 'warning': 'debug', 'error': 'debug'} + +# Use the standard JavaScript modal dialog for `alert()` and `confirm()` +# Type: Bool +c.content.javascript.modal_dialog = True + +# Show javascript prompts. +# Type: Bool +c.content.javascript.prompt = True + +# Whether locally loaded documents are allowed to access other local +# urls. +# Type: Bool +c.content.local_content_can_access_file_urls = True + +# Whether locally loaded documents are allowed to access remote urls. +# Type: Bool +c.content.local_content_can_access_remote_urls = False + +# Whether support for HTML 5 local storage and Web SQL is enabled. +# Type: Bool +c.content.local_storage = True + +# Allow websites to record audio/video. +# Type: BoolAsk +# Valid values: +# - true +# - false +# - ask +c.content.media_capture = 'ask' + +# Location of a netrc-file for HTTP authentication. If unset, `~/.netrc` +# is used. +# Type: File +c.content.netrc_file = None + +# Allow websites to show notifications. +# Type: BoolAsk +# Valid values: +# - true +# - false +# - ask +c.content.notifications = 'ask' + +# Enable pdf.js to view PDF files in the browser. Note that the files +# can still be downloaded by clicking the download button in the pdf.js +# viewer. +# Type: Bool +c.content.pdfjs = False + +# Enables or disables plugins in Web pages. +# Type: Bool +c.content.plugins = False + +# Whether the background color and images are also drawn when the page +# is printed. +# Type: Bool +c.content.print_element_backgrounds = True + +# Open new windows in private browsing mode which does not record +# visited pages. +# Type: Bool +c.content.private_browsing = False + +# The proxy to use. In addition to the listed values, you can use a +# `socks://...` or `http://...` URL. +# Type: Proxy +# Valid values: +# - system: Use the system wide proxy. +# - none: Don't use any proxy +c.content.proxy = 'system' + +# Send DNS requests over the configured proxy. +# Type: Bool +c.content.proxy_dns_requests = True + +# Validate SSL handshakes. +# Type: BoolAsk +# Valid values: +# - true +# - false +# - ask +c.content.ssl_strict = False + +# A list of user stylesheet filenames to use. +# Type: List of File, or File +c.content.user_stylesheets = None + +# Enables or disables WebGL. +# Type: Bool +c.content.webgl = True + +# Whether load requests should be monitored for cross-site scripting +# attempts. Suspicious scripts will be blocked and reported in the +# inspector's JavaScript console. Enabling this feature might have an +# impact on performance. +# Type: Bool +c.content.xss_auditing = True + +# The directory to save downloads to. If unset, a sensible os-specific +# default is used. +# Type: Directory +c.downloads.location.directory = '~/Downloads' + +# Prompt the user for the download location. If set to false, +# `downloads.location.directory` will be used. +# Type: Bool +c.downloads.location.prompt = False + +# Remember the last used download directory. +# Type: Bool +c.downloads.location.remember = True + +# What to display in the download filename input. +# Type: String +# Valid values: +# - path: Show only the download path. +# - filename: Show only download filename. +# - both: Show download path and filename. +c.downloads.location.suggestion = 'path' + +# The default program used to open downloads. If null, the default +# internal handler is used. Any `{}` in the string will be expanded to +# the filename, else the filename will be appended. +# Type: String +c.downloads.open_dispatcher = None + +# Where to show the downloaded files. +# Type: VerticalPosition +# Valid values: +# - top +# - bottom +c.downloads.position = 'top' + +# Number of milliseconds to wait before removing finished downloads. If +# set to -1, downloads are never removed. +# Type: Int +c.downloads.remove_finished = 1000 + +# The editor (and arguments) to use for the `open-editor` command. `{}` +# gets replaced by the filename of the file to be edited. +# Type: ShellCommand +c.editor.command = ['kitty', 'nvim', '-f', '{file}'] + +# Encoding to use for the editor. +# Type: Encoding +c.editor.encoding = 'utf-8' + +# Font used in the completion categories. +# Type: Font +c.fonts.completion.category = 'bold 10pt monospace' + +# Font used in the completion widget. +# Type: Font +c.fonts.completion.entry = '10pt monospace' + +# Font used for the debugging console. +# Type: QtFont +c.fonts.debug_console = '10pt monospace' + +# Font used for the downloadbar. +# Type: Font +c.fonts.downloads = '10pt monospace' + +# Font used for the hints. +# Type: Font +c.fonts.hints = 'bold 12pt monospace' + +# Font used in the keyhint widget. +# Type: Font +c.fonts.keyhint = '10pt monospace' + +# Font used for error messages. +# Type: Font +c.fonts.messages.error = '10pt monospace' + +# Font used for info messages. +# Type: Font +c.fonts.messages.info = '10pt monospace' + +# Font used for warning messages. +# Type: Font +c.fonts.messages.warning = '10pt monospace' + +# Default monospace fonts. Whenever "monospace" is used in a font +# setting, it's replaced with the fonts listed here. +# Type: Font +c.fonts.monospace = '"Monofur for Powerline", Monospace, "DejaVu Sans Mono", Monaco, "Bitstream Vera Sans Mono", "Andale Mono", "Courier New", Courier, "Liberation Mono", monospace, Fixed, Consolas, Terminal' + +# Font used for prompts. +# Type: Font +c.fonts.prompts = '10pt monospace' + +# Font used in the statusbar. +# Type: Font +c.fonts.statusbar = '10pt monospace' + +# Font used in the tab bar. +# Type: QtFont +c.fonts.tabs = '10pt monospace' + +# Font family for cursive fonts. +# Type: FontFamily +c.fonts.web.family.cursive = '' + +# Font family for fantasy fonts. +# Type: FontFamily +c.fonts.web.family.fantasy = '' + +# Font family for fixed fonts. +# Type: FontFamily +c.fonts.web.family.fixed = '' + +# Font family for sans-serif fonts. +# Type: FontFamily +c.fonts.web.family.sans_serif = '' + +# Font family for serif fonts. +# Type: FontFamily +c.fonts.web.family.serif = '' + +# Font family for standard fonts. +# Type: FontFamily +c.fonts.web.family.standard = '' + +# The default font size for regular text. +# Type: Int +c.fonts.web.size.default = 16 + +# The default font size for fixed-pitch text. +# Type: Int +c.fonts.web.size.default_fixed = 13 + +# The hard minimum font size. +# Type: Int +c.fonts.web.size.minimum = 0 + +# The minimum logical font size that is applied when zooming out. +# Type: Int +c.fonts.web.size.minimum_logical = 6 + +# Controls when a hint can be automatically followed without pressing +# Enter. +# Type: String +# Valid values: +# - always: Auto-follow whenever there is only a single hint on a page. +# - unique-match: Auto-follow whenever there is a unique non-empty match in either the hint string (word mode) or filter (number mode). +# - full-match: Follow the hint when the user typed the whole hint (letter, word or number mode) or the element's text (only in number mode). +# - never: The user will always need to press Enter to follow a hint. +c.hints.auto_follow = 'unique-match' + +# A timeout (in milliseconds) to ignore normal-mode key bindings after a +# successful auto-follow. +# Type: Int +c.hints.auto_follow_timeout = 0 + +# CSS border value for hints. +# Type: String +c.hints.border = '1px solid black' + +# Chars used for hint strings. +# Type: UniqueCharString +c.hints.chars = 'tsrn' + +# The dictionary file to be used by the word hints. +# Type: File +c.hints.dictionary = '/usr/share/dict/words' + +# Which implementation to use to find elements to hint. +# Type: String +# Valid values: +# - javascript: Better but slower +# - python: Slightly worse but faster +c.hints.find_implementation = 'python' + +# Hide unmatched hints in rapid mode. +# Type: Bool +c.hints.hide_unmatched_rapid_hints = True + +# Minimum number of chars used for hint strings. +# Type: Int +c.hints.min_chars = 1 + +# Mode to use for hints. +# Type: String +# Valid values: +# - number: Use numeric hints. (In this mode you can also type letters from the hinted element to filter and reduce the number of elements that are hinted.) +# - letter: Use the chars in the `hints.chars` setting. +# - word: Use hints words based on the html elements and the extra words. +c.hints.mode = 'letter' + +# A comma-separated list of regexes to use for 'next' links. +# Type: List of Regex +c.hints.next_regexes = ['\\bnext\\b', '\\bmore\\b', '\\bnewer\\b', '\\b[>→≫]\\b', '\\b(>>|»)\\b', '\\bcontinue\\b'] + +# A comma-separated list of regexes to use for 'prev' links. +# Type: List of Regex +c.hints.prev_regexes = ['\\bprev(ious)?\\b', '\\bback\\b', '\\bolder\\b', '\\b[<←≪]\\b', '\\b(<<|«)\\b'] + +# Scatter hint key chains (like Vimium) or not (like dwb). Ignored for +# number hints. +# Type: Bool +c.hints.scatter = False + +# Make chars in hint strings uppercase. +# Type: Bool +c.hints.uppercase = False + +# The maximum time in minutes between two history items for them to be +# considered being from the same browsing session. Items with less time +# between them are grouped when being displayed in `:history`. Use -1 to +# disable separation. +# Type: Int +c.history_gap_interval = 30 + +# Find text on a page case-insensitively. +# Type: String +# Valid values: +# - always: Search case-insensitively +# - never: Search case-sensitively +# - smart: Search case-sensitively if there are capital chars +c.search.ignore_case = 'smart' + +# Forward unbound keys to the webview in normal mode. +# Type: String +# Valid values: +# - all: Forward all unbound keys. +# - auto: Forward unbound non-alphanumeric keys. +# - none: Don't forward any keys. +c.input.forward_unbound_keys = 'auto' + +# Leave insert mode if a non-editable element is clicked. +# Type: Bool +c.input.insert_mode.auto_leave = True + +# Automatically enter insert mode if an editable element is focused +# after loading the page. +# Type: Bool +c.input.insert_mode.auto_load = False + +# Switch to insert mode when clicking flash and other plugins. +# Type: Bool +c.input.insert_mode.plugins = False + +# Include hyperlinks in the keyboard focus chain when tabbing. +# Type: Bool +c.input.links_included_in_focus_chain = True + +# Timeout (in milliseconds) for partially typed key bindings. If the +# current input forms only partial matches, the keystring will be +# cleared after this time. +# Type: Int +c.input.partial_timeout = 5000 + +# Enable Opera-like mouse rocker gestures. This disables the context +# menu. +# Type: Bool +c.input.rocker_gestures = False + +# Enable Spatial Navigation. Spatial navigation consists in the ability +# to navigate between focusable elements in a Web page, such as +# hyperlinks and form controls, by using Left, Right, Up and Down arrow +# keys. For example, if a user presses the Right key, heuristics +# determine whether there is an element he might be trying to reach +# towards the right and which element he probably wants. +# Type: Bool +c.input.spatial_navigation = False + +# Keychains that shouldn't be shown in the keyhint dialog. Globs are +# supported, so `;*` will blacklist all keychains starting with `;`. Use +# `*` to disable keyhints. +# Type: List of String +c.keyhint.blacklist = [] + +# Time from pressing a key to seeing the keyhint dialog (ms). +# Type: Int +c.keyhint.delay = 500 + +# Time (in ms) to show messages in the statusbar for. Set to 0 to never +# clear messages. +# Type: Int +c.messages.timeout = 2000 + +# How to open links in an existing instance if a new one is launched. +# This happens when e.g. opening a link from a terminal. See +# `new_instance_open_target_window` to customize in which window the +# link is opened in. +# Type: String +# Valid values: +# - tab: Open a new tab in the existing window and activate the window. +# - tab-bg: Open a new background tab in the existing window and activate the window. +# - tab-silent: Open a new tab in the existing window without activating the window. +# - tab-bg-silent: Open a new background tab in the existing window without activating the window. +# - window: Open in a new window. +c.new_instance_open_target = 'tab' + +# Which window to choose when opening links as new tabs. When +# `new_instance_open_target` is not set to `window`, this is ignored. +# Type: String +# Valid values: +# - first-opened: Open new tabs in the first (oldest) opened window. +# - last-opened: Open new tabs in the last (newest) opened window. +# - last-focused: Open new tabs in the most recently focused window. +# - last-visible: Open new tabs in the most recently visible window. +c.new_instance_open_target_window = 'last-focused' + +# Show a filebrowser in upload/download prompts. +# Type: Bool +c.prompt.filebrowser = True + +# The rounding radius for the edges of prompts. +# Type: Int +c.prompt.radius = 8 + +# Additional arguments to pass to Qt, without leading `--`. With +# QtWebEngine, some Chromium arguments (see +# https://peter.sh/experiments/chromium-command-line-switches/ for a +# list) will work. This setting requires a restart. +# Type: List of String +c.qt.args = [] + +# Force a Qt platform to use. This sets the `QT_QPA_PLATFORM` +# environment variable and is useful to force using the XCB plugin when +# running QtWebEngine on Wayland. +# Type: String +c.qt.force_platform = None + +# Force software rendering for QtWebEngine. This is needed for +# QtWebEngine to work with Nouveau drivers. This setting requires a +# restart. +# Type: Bool +c.qt.force_software_rendering = "none" + +# Show a scrollbar. +# Type: Bool +c.scrolling.bar = "when-searching" + +# Enable smooth scrolling for web pages. Note smooth scrolling does not +# work with the `:scroll-px` command. +# Type: Bool +c.scrolling.smooth = True + +# The name of the session to save by default. If this is set to null, +# the session which was last loaded is saved. +# Type: SessionName +c.session.default_name = None + +# Spell checking languages. You can check for available languages and +# install dictionaries using scripts/install_dict.py. Run the script +# with -h/--help for instructions. +# Type: List of String +# Valid values: +# - af-ZA: Afrikaans (South Africa) +# - bg-BG: Bulgarian (Bulgaria) +# - ca-ES: Catalan (Spain) +# - cs-CZ: Czech (Czech Republic) +# - da-DK: Danish (Denmark) +# - de-DE: German (Germany) +# - el-GR: Greek (Greece) +# - en-CA: English (Canada) +# - en-GB: English (United Kingdom) +# - en-US: English (United States) +# - es-ES: Spanish (Spain) +# - et-EE: Estonian (Estonia) +# - fa-IR: Farsi (Iran) +# - fo-FO: Faroese (Faroe Islands) +# - fr-FR: French (France) +# - he-IL: Hebrew (Israel) +# - hi-IN: Hindi (India) +# - hr-HR: Croatian (Croatia) +# - hu-HU: Hungarian (Hungary) +# - id-ID: Indonesian (Indonesia) +# - it-IT: Italian (Italy) +# - ko: Korean +# - lt-LT: Lithuanian (Lithuania) +# - lv-LV: Latvian (Latvia) +# - nb-NO: Norwegian (Norway) +# - nl-NL: Dutch (Netherlands) +# - pl-PL: Polish (Poland) +# - pt-BR: Portuguese (Brazil) +# - pt-PT: Portuguese (Portugal) +# - ro-RO: Romanian (Romania) +# - ru-RU: Russian (Russia) +# - sh: Serbo-Croatian +# - sk-SK: Slovak (Slovakia) +# - sl-SI: Slovenian (Slovenia) +# - sq: Albanian +# - sr: Serbian +# - sv-SE: Swedish (Sweden) +# - ta-IN: Tamil (India) +# - tg-TG: Tajik (Tajikistan) +# - tr-TR: Turkish (Turkey) +# - uk-UA: Ukrainian (Ukraine) +# - vi-VN: Vietnamese (Viet Nam) +c.spellcheck.languages = ["en-US", "fr-FR"] + +# Hide the statusbar unless a message is shown. +# Type: Bool +c.statusbar.hide = False + +# Padding for the statusbar. +# Type: Padding +c.statusbar.padding = {'top': 1, 'bottom': 1, 'left': 0, 'right': 0} + +# The position of the status bar. +# Type: VerticalPosition +# Valid values: +# - top +# - bottom +c.statusbar.position = 'bottom' + +# Open new tabs (middleclick/ctrl+click) in the background. +# Type: Bool +c.tabs.background = True + +# On which mouse button to close tabs. +# Type: String +# Valid values: +# - right: Close tabs on right-click. +# - middle: Close tabs on middle-click. +# - none: Don't close tabs using the mouse. +c.tabs.close_mouse_button = 'middle' + +# Scaling for favicons in the tab bar. The tab size is unchanged, so big +# favicons also require extra `tabs.padding`. +# Type: Float +c.tabs.favicons.scale = 1.2 + +# Show favicons in the tab bar. +# Type: Bool +c.tabs.favicons.show = 'always' + +# Padding for tab indicators +# Type: Padding +c.tabs.indicator.padding = {'top': 2, 'bottom': 2, 'left': 0, 'right': 4} + +# Behavior when the last tab is closed. +# Type: String +# Valid values: +# - ignore: Don't do anything. +# - blank: Load a blank page. +# - startpage: Load the start page. +# - default-page: Load the default page. +# - close: Close the window. +c.tabs.last_close = 'ignore' + +# Switch between tabs using the mouse wheel. +# Type: Bool +c.tabs.mousewheel_switching = True + +# How new tabs opened from another tab are positioned. +# Type: NewTabPosition +# Valid values: +# - prev: Before the current tab. +# - next: After the current tab. +# - first: At the beginning. +# - last: At the end. +c.tabs.new_position.related = 'next' + +# How new tabs which aren't opened from another tab are positioned. +# Type: NewTabPosition +# Valid values: +# - prev: Before the current tab. +# - next: After the current tab. +# - first: At the beginning. +# - last: At the end. +c.tabs.new_position.unrelated = 'next' + +# Padding around text for tabs +# Type: Padding +c.tabs.padding = {'top': 0, 'bottom': 0, 'left': 5, 'right': 5} + +# The position of the tab bar. +# Type: Position +# Valid values: +# - top +# - bottom +# - left +# - right +c.tabs.position = 'top' + +# Which tab to select when the focused tab is removed. +# Type: SelectOnRemove +# Valid values: +# - prev: Select the tab which came before the closed one (left in horizontal, above in vertical). +# - next: Select the tab which came after the closed one (right in horizontal, below in vertical). +# - last-used: Select the previously selected tab. +c.tabs.select_on_remove = 'last-used' + +# When to show the tab bar. +# Type: String +# Valid values: +# - always: Always show the tab bar. +# - never: Always hide the tab bar. +# - multiple: Hide the tab bar if only one tab is open. +# - switching: Show the tab bar when switching tabs. +c.tabs.show = 'always' + +# Time to show the tab bar before hiding it when tabs.show is set to +# 'switching'. +# Type: Int +c.tabs.show_switching_delay = 800 + +# Open a new window for every tab. +# Type: Bool +c.tabs.tabs_are_windows = False + +# Alignment of the text inside of tabs. +# Type: TextAlignment +# Valid values: +# - left +# - right +# - center +c.tabs.title.alignment = 'left' + +# The format to use for the tab title. The following placeholders are +# defined: * `{perc}`: The percentage as a string like `[10%]`. * +# `{perc_raw}`: The raw percentage, e.g. `10` * `{title}`: The title of +# the current web page * `{title_sep}`: The string ` - ` if a title is +# set, empty otherwise. * `{index}`: The index of this tab. * `{id}`: +# The internal tab ID of this tab. * `{scroll_pos}`: The page scroll +# position. * `{host}`: The host of the current web page. * `{backend}`: +# Either ''webkit'' or ''webengine'' * `{private}` : Indicates when +# private mode is enabled. +# Type: FormatString +c.tabs.title.format = '{title}' + +# The format to use for the tab title for pinned tabs. The same +# placeholders like for `tabs.title.format` are defined. +# Type: FormatString +c.tabs.title.format_pinned = '' + +# The width of the tab bar if it's vertical, in px or as percentage of +# the window. +# Type: PercOrInt +c.tabs.width = '20%' + +# Width of the progress indicator (0 to disable). +# Type: Int +c.tabs.indicator.width = 0 + +# Whether to wrap when changing tabs. +# Type: Bool +c.tabs.wrap = True + +# Whether to start a search when something else than a URL is entered. +# Type: String +# Valid values: +# - naive: Use simple/naive check. +# - dns: Use DNS requests (might be slow!). +# - never: Never search automatically. +c.url.auto_search = 'naive' + +# The page to open if :open -t/-b/-w is used without URL. Use +# `about:blank` for a blank page. +# Type: FuzzyUrl +c.url.default_page = 'https://start.duckduckgo.com/' + +# The URL segments where `:navigate increment/decrement` will search for +# a number. +# Type: FlagList +# Valid values: +# - host +# - path +# - query +# - anchor +c.url.incdec_segments = ['path', 'query'] + +# Definitions of search engines which can be used via the address bar. +# Maps a searchengine name (such as `DEFAULT`, or `ddg`) to a URL with a +# `{}` placeholder. The placeholder will be replaced by the search term, +# use `{{` and `}}` for literal `{`/`}` signs. The searchengine named +# `DEFAULT` is used when `url.auto_search` is turned on and something +# else than a URL was entered to be opened. Other search engines can be +# used by prepending the search engine name to the search term, e.g. +# `:open google qutebrowser`. +# Type: Dict +c.url.searchengines = {'DEFAULT': 'https://duckduckgo.com/?q={}'} + +# The page(s) to open at the start. +# Type: List of FuzzyUrl, or FuzzyUrl +c.url.start_pages = 'https://start.duckduckgo.com' + +# The URL parameters to strip with `:yank url`. +# Type: List of String +c.url.yank_ignored_parameters = ['ref', 'utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content'] + +# Hide the window decoration when using wayland (requires restart) +# Type: Bool +c.window.hide_decoration = False + +# The format to use for the window title. The following placeholders are +# defined: * `{perc}`: The percentage as a string like `[10%]`. * +# `{perc_raw}`: The raw percentage, e.g. `10` * `{title}`: The title of +# the current web page * `{title_sep}`: The string ` - ` if a title is +# set, empty otherwise. * `{id}`: The internal window ID of this window. +# * `{scroll_pos}`: The page scroll position. * `{host}`: The host of +# the current web page. * `{backend}`: Either ''webkit'' or +# ''webengine'' * `{private}` : Indicates when private mode is enabled. +# Type: FormatString +c.window.title_format = '{perc}{title}' + +# The default zoom level. +# Type: Perc +c.zoom.default = '100%' + +# The available zoom levels. +# Type: List of Perc +c.zoom.levels = ['25%', '33%', '50%', '67%', '75%', '90%', '100%', '110%', '125%', '150%', '175%', '200%', '250%', '300%', '400%', '500%'] + +# How much to divide the mouse wheel movements to translate them into +# zoom increments. +# Type: Int +c.zoom.mouse_divider = 512 + +# Whether the zoom factor on a frame applies only to the text or to all +# content. +# Type: Bool +c.zoom.text_only = False + +# Bindings for normal mode +config.bind("P", 'spawn mpv {url}') +config.bind("P", 'hint links spawn mpv {hint-url}') +config.bind("", 'spawn --userscript password_fill') +config.bind("'", 'enter-mode jump_mark') +config.bind('+', 'zoom-in') +config.bind('-', 'zoom-out') +config.bind('.', 'repeat-command') +config.bind('/', 'set-cmd-text /') +config.bind(':', 'set-cmd-text :') +config.bind(';I', 'hint images tab') +config.bind(';O', 'hint links fill :open -t -r {hint-url}') +config.bind(';R', 'hint --rapid links window') +config.bind(';Y', 'hint links yank-primary') +config.bind(';b', 'hint all tab-bg') +config.bind(';d', 'hint links download') +config.bind(';r', 'hint all tab-fg') +config.bind(';h', 'hint all hover') +config.bind(';i', 'hint images') +config.bind(';o', 'hint links fill :open {hint-url}') +config.bind(';f', 'hint --rapid links tab-bg') +config.bind(';t', 'hint inputs') +config.bind(';y', 'hint links yank') +config.bind('', 'tab-focus 1') +config.bind('', 'tab-focus 2') +config.bind('', 'tab-focus 3') +config.bind('', 'tab-focus 4') +config.bind('', 'tab-focus 5') +config.bind('', 'tab-focus 6') +config.bind('', 'tab-focus 7') +config.bind('', 'tab-focus 8') +config.bind('', 'tab-focus -1') +config.bind('', 'navigate increment') +config.bind('', 'print') +config.bind('', 'scroll-page 0 -1') +config.bind('S', 'scroll-page 0 0.5') +config.bind('', 'reload -f') +config.bind('', 'scroll-page 0 1') +config.bind('', 'open -w') +config.bind('l', 'tab-next') +config.bind('v', 'tab-prev') +config.bind('', 'quit') +config.bind('', 'follow-selected -t') +config.bind('', 'open -p') +config.bind('', 'undo') +config.bind('', 'close') +config.bind('', 'open -t') +config.bind('', 'tab-focus last') +config.bind('D', 'scroll-page 0 -0.5') +config.bind('', 'enter-mode passthrough') +config.bind('', 'tab-close') +config.bind('', 'navigate decrement') +config.bind('', 'tab-focus last') +config.bind('', 'home') +config.bind('', 'tab-pin') +config.bind('', 'stop') +config.bind('', 'clear-keychain ;; search ;; fullscreen --leave') +config.bind('', 'fullscreen') +config.bind('m', 'reload') +config.bind('', 'follow-selected') +config.bind('', 'back') +config.bind('', 'forward') +config.bind('=', 'zoom') +config.bind('?', 'set-cmd-text ?') +config.bind('@', 'run-macro') +config.bind('B', 'set-cmd-text -s :quickmark-load -t') +config.bind('F', 'hint all tab') +config.bind('G', 'scroll-to-perc') +config.bind('gt', 'back') +config.bind('gr', 'forward') +config.bind('M', 'bookmark-add') +config.bind('N', 'search-prev') +config.bind('j', 'set-cmd-text -s :open -t ') +config.bind('PP', 'open -t -- {primary}') +config.bind('Pp', 'open -t -- {clipboard}') +config.bind('l', 'tab-focus') +config.bind('ZQ', 'quit') +config.bind('ZZ', 'quit --save') +config.bind('[[', 'navigate prev') +config.bind(']]', 'navigate next') +config.bind('`', 'enter-mode set_mark') +config.bind('ad', 'download-cancel') +config.bind('b', 'set-cmd-text -s :quickmark-load') +config.bind('cd', 'download-clear') +config.bind('q', 'tab-close') +config.bind('f', 'hint') +config.bind('g$', 'tab-focus -1') +config.bind('g0', 'tab-focus 1') +config.bind('gB', 'set-cmd-text -s :bookmark-load -t') +config.bind('gc', 'tab-clone') +config.bind('gO', 'set-cmd-text :open -t -r {url:pretty}') +config.bind('gU', 'navigate up -t') +config.bind('g^', 'tab-focus 1') +config.bind('ga', 'open -t') +config.bind('gb', 'set-cmd-text -s :bookmark-load') +config.bind('gd', 'download') +config.bind('gf', 'view-source') +config.bind('gg', 'scroll-to-perc 0') +config.bind('gv', 'tab-move -') +config.bind('gm', 'tab-move') +config.bind('go', 'set-cmd-text :open {url:pretty}') +config.bind('gl', 'tab-move +') +config.bind('gu', 'navigate up') +config.bind('t', 'scroll left') +config.bind('i', 'enter-mode insert') +config.bind('s', 'scroll down') +config.bind('d', 'scroll up') +config.bind('r', 'scroll right') +config.bind('M', 'quickmark-save') +config.bind('n', 'search-next') +config.bind('J', 'set-cmd-text -s :open ') +config.bind('pP', 'open -- {primary}') +config.bind('pp', 'open -- {clipboard}') +config.bind('gT', 'back -t') +config.bind('gR', 'forward -t') +config.bind('h', 'undo') +config.bind('c', 'enter-mode caret') +config.bind('wB', 'set-cmd-text -s :bookmark-load -w') +config.bind('wO', 'set-cmd-text :open -w {url:pretty}') +config.bind('wP', 'open -w -- {primary}') +config.bind('wb', 'set-cmd-text -s :quickmark-load -w') +config.bind('wf', 'hint all window') +config.bind('gw', 'back -w') +config.bind('wi', 'inspector') +config.bind('wl', 'forward -w') +config.bind('wo', 'set-cmd-text -s :open -w') +config.bind('wp', 'open -w -- {clipboard}') +config.bind('xO', 'set-cmd-text :open -b -r {url:pretty}') +config.bind('xb', 'config-cycle statusbar.hide') +config.bind('xo', 'set-cmd-text -s :open -b') +config.bind('xt', 'config-cycle tabs.show always switching') +config.bind('xx', 'config-cycle statusbar.hide ;; config-cycle tabs.show always switching') +config.bind('yD', 'yank domain -s') +config.bind('yP', 'yank pretty-url -s') +config.bind('yT', 'yank title -s') +config.bind('yY', 'yank -s') +config.bind('yd', 'yank domain') +config.bind('yp', 'yank pretty-url') +config.bind('yt', 'yank title') +config.bind('yy', 'yank') +config.bind('{{', 'navigate prev -t') +config.bind('}}', 'navigate next -t') + +# Bindings for caret mode +config.bind('$', 'move-to-end-of-line', mode='caret') +config.bind('0', 'move-to-start-of-line', mode='caret') +config.bind('', 'drop-selection', mode='caret') +config.bind('', 'leave-mode', mode='caret') +config.bind('', 'yank selection', mode='caret') +config.bind('', 'toggle-selection', mode='caret') +config.bind('G', 'move-to-end-of-document', mode='caret') +config.bind('H', 'scroll left', mode='caret') +config.bind('J', 'scroll down', mode='caret') +config.bind('K', 'scroll up', mode='caret') +config.bind('L', 'scroll right', mode='caret') +config.bind('Y', 'yank selection -s', mode='caret') +config.bind('[', 'move-to-start-of-prev-block', mode='caret') +config.bind(']', 'move-to-start-of-next-block', mode='caret') +config.bind('b', 'move-to-prev-word', mode='caret') +config.bind('c', 'enter-mode normal', mode='caret') +config.bind('e', 'move-to-end-of-word', mode='caret') +config.bind('gg', 'move-to-start-of-document', mode='caret') +config.bind('h', 'move-to-prev-char', mode='caret') +config.bind('j', 'move-to-next-line', mode='caret') +config.bind('k', 'move-to-prev-line', mode='caret') +config.bind('l', 'move-to-next-char', mode='caret') +config.bind('v', 'toggle-selection', mode='caret') +config.bind('w', 'move-to-next-word', mode='caret') +config.bind('y', 'yank selection', mode='caret') +config.bind('{', 'move-to-end-of-prev-block', mode='caret') +config.bind('}', 'move-to-end-of-next-block', mode='caret') + +# Bindings for command mode +config.bind('', 'rl-backward-word', mode='command') +config.bind('', 'rl-backward-kill-word', mode='command') +config.bind('', 'rl-kill-word', mode='command') +config.bind('', 'rl-forward-word', mode='command') +config.bind('', 'rl-delete-char', mode='command') +config.bind('', 'rl-beginning-of-line', mode='command') +config.bind('', 'rl-backward-char', mode='command') +config.bind('', 'completion-item-del', mode='command') +config.bind('', 'rl-end-of-line', mode='command') +config.bind('', 'rl-forward-char', mode='command') +config.bind('', 'rl-backward-delete-char', mode='command') +config.bind('', 'rl-kill-line', mode='command') +config.bind('', 'command-history-next', mode='command') +config.bind('', 'command-history-prev', mode='command') +config.bind('', 'completion-item-focus prev-category', mode='command') +config.bind('', 'completion-item-focus next-category', mode='command') +config.bind('', 'rl-unix-line-discard', mode='command') +config.bind('', 'rl-unix-word-rubout', mode='command') +config.bind('', 'rl-yank', mode='command') +config.bind('', 'command-history-next', mode='command') +config.bind('', 'leave-mode', mode='command') +config.bind('', 'command-accept', mode='command') +config.bind('', 'completion-item-del', mode='command') +config.bind('', 'completion-item-focus prev', mode='command') +config.bind('', 'completion-item-focus next', mode='command') +config.bind('', 'command-history-prev', mode='command') + +# Bindings for hint mode +config.bind('', 'hint all tab-bg', mode='hint') +config.bind('', 'hint links', mode='hint') +config.bind('', 'hint --rapid links tab-bg', mode='hint') +config.bind('', 'leave-mode', mode='hint') +config.bind('', 'follow-hint', mode='hint') + +# Bindings for insert mode +config.bind('', 'open-editor', mode='insert') +config.bind('', 'leave-mode', mode='insert') +config.bind('', 'insert-text {primary}', mode='insert') + +# Bindings for passthrough mode +config.bind('', 'leave-mode', mode='passthrough') + +# Bindings for prompt mode +config.bind('', 'rl-backward-word', mode='prompt') +config.bind('', 'rl-backward-kill-word', mode='prompt') +config.bind('', 'rl-kill-word', mode='prompt') +config.bind('', 'rl-forward-word', mode='prompt') +config.bind('', 'rl-delete-char', mode='prompt') +config.bind('', 'rl-beginning-of-line', mode='prompt') +config.bind('', 'rl-backward-char', mode='prompt') +config.bind('', 'rl-end-of-line', mode='prompt') +config.bind('', 'rl-forward-char', mode='prompt') +config.bind('', 'rl-backward-delete-char', mode='prompt') +config.bind('', 'rl-kill-line', mode='prompt') +config.bind('', 'rl-unix-line-discard', mode='prompt') +config.bind('', 'rl-unix-word-rubout', mode='prompt') +config.bind('', 'prompt-open-download', mode='prompt') +config.bind('', 'rl-yank', mode='prompt') +config.bind('', 'prompt-item-focus next', mode='prompt') +config.bind('', 'leave-mode', mode='prompt') +config.bind('', 'prompt-accept', mode='prompt') +config.bind('', 'prompt-item-focus prev', mode='prompt') +config.bind('', 'prompt-item-focus next', mode='prompt') +config.bind('', 'prompt-item-focus prev', mode='prompt') +config.bind('n', 'prompt-accept no', mode='prompt') +config.bind('y', 'prompt-accept yes', mode='prompt') + +# Bindings for register mode +config.bind('', 'leave-mode', mode='register') + +# Zotero Bindings +config.bind('zz', 'zotero') +config.bind('zf', 'zotero_link') diff --git a/.config/qutebrowser/keys.conf b/.config/qutebrowser/keys.conf new file mode 100644 index 0000000..0d108e8 --- /dev/null +++ b/.config/qutebrowser/keys.conf @@ -0,0 +1,697 @@ +# vim: ft=conf +# +# In this config file, qutebrowser's key bindings are configured. +# The format looks like this: +# +# [keymode] +# +# command +# keychain +# keychain2 +# ... +# +# All blank lines and lines starting with '#' are ignored. +# Inline-comments are not permitted. +# +# keymode is a comma separated list of modes in which the key binding should be +# active. If keymode starts with !, the key binding is active in all modes +# except the listed modes. +# +# For special keys (can't be part of a keychain), enclose them in `<`...`>`. +# For modifiers, you can use either `-` or `+` as delimiters, and these names: +# +# * Control: `Control`, `Ctrl` +# * Meta: `Meta`, `Windows`, `Mod4` +# * Alt: `Alt`, `Mod1` +# * Shift: `Shift` +# +# For simple keys (no `<>`-signs), a capital letter means the key is pressed +# with Shift. For special keys (with `<>`-signs), you need to explicitly add +# `Shift-` to match a key pressed with shift. +# +# Note that default keybindings are always bound, and need to be explicitly +# unbound if you wish to remove them: +# +# +# keychain +# keychain2 +# ... + +[!normal] + +leave-mode + + + +[normal] +# Keybindings for normal mode. + +clear-keychain ;; search ;; fullscreen --leave + + +set-cmd-text -s :open + J + +set-cmd-text :open {url} + go + +set-cmd-text -s :open -t + j + +set-cmd-text :open -t {url} + gO + +set-cmd-text -s :open -b + xo + +set-cmd-text :open -b {url} + xO + +set-cmd-text -s :open -w + wo + +set-cmd-text :open -w {url} + wO + +open -t + ga + + +tab-close + q + + +tab-only + co + +tab-focus + l + +tab-move + gm + +tab-move - + gv + +tab-move + + gl + +tab-prev + v + +tab-clone + gC + +reload + m + +reload -f + R + +back + gt + +back -t + gT + +back -w + gW + +forward + gr + +forward -t + gR + +forward -w + gw + +fullscreen + + +hint + f + +hint all tab + F + +hint all window + wf + +hint all tab-bg + ;b + +hint all tab-fg + ;r + +hint all hover + ;h + +hint images + ;i + +hint images tab + ;I + +hint images tab-bg + .i + +hint links fill :open {hint-url} + ;o + +hint links fill :open -t {hint-url} + ;O + +hint links fill :open -b {hint-url} + .o + +hint links yank + ;y + +hint links yank-primary + ;Y + +hint --rapid links tab-bg + ;f + +hint --rapid links window + ;R + +hint links download + ;d + +scroll left + t + +scroll down + s + +scroll up + d + +scroll right + r + +undo + h + + +scroll-perc 0 + gg + +scroll-perc + G + +search-next + n + +search-prev + N + +enter-mode insert + i + +enter-mode caret + c + +yank + yy + +yank -s + yY + +yank title + yt + +yank title -s + yT + +yank domain + yd + +yank domain -s + yD + +open -- {clipboard} + pp + +open -- {primary} + pP + +open -t -- {clipboard} + Pp + +open -t -- {primary} + PP + +open -w -- {clipboard} + wp + +open -w -- {primary} + wP + +set-cmd-text -s :quickmark-load + b + +set-cmd-text -s :quickmark-load -t + B + +set-cmd-text -s :quickmark-load -w + wb + +set-cmd-text -s :bookmark-load + gb + +set-cmd-text -s :bookmark-load -t + gB + +set-cmd-text -s :bookmark-load -w + wB + +zoom-out + - + zo + +zoom-in + + + zi + +zoom + = + zz + +navigate prev + [[ + +navigate next + ]] + +navigate prev -t + {{ + +navigate next -t + }} + +navigate up + gu + +navigate up -t + gU + +navigate increment + + +navigate decrement + + +inspector + wi + +download + gd + +download-cancel + ad + +download-clear + cd + +view-source + gf + +tab-focus last + + +enter-mode passthrough + + +quit + + +scroll-page 0 1 + + +scroll-page 0 -1 + + +scroll-page 0 0.5 + S + +scroll-page 0 -0.5 + D + +tab-focus 1 + + +tab-focus 2 + + +tab-focus 3 + + +tab-focus 4 + + +tab-focus 5 + + +tab-focus 6 + + +tab-focus 7 + + +tab-focus 8 + + +tab-focus 9 + + +home + + +stop + + +print + + +follow-selected + + + + + + + +follow-selected -t + + + + + ss + sl + sk + Ss + sf + +spawn mpv {url} + p + +quickmark-save + M + +hint links spawn mpv {hint-url} + P + +open -w + + +enter-mode set_mark + ` + +enter-mode jump_mark + ' + +yank pretty-url + yp + +yank pretty-url -s + yP + +hint inputs + ;t + +repeat-command + . + +yank selection + y + +spawn --userscript password_fill + + +set-cmd-text / + / + +set-cmd-text ? + ? + +set-cmd-text : + : + +tab-next + + +run-macro + @ + +wq + ZZ + +tab-focus -1 + g$ + +tab-pin + + +[insert] +# Keybindings for insert mode. +# Since normal keypresses are passed through, only special keys are +# supported in this mode. +# Useful hidden commands to map in this section: +# * `open-editor`: Open a texteditor with the focused field. +# * `paste-primary`: Paste primary selection at cursor position. + +open-editor + + +insert-text {primary} + + +[hint] +# Keybindings for hint mode. +# Since normal keypresses are passed through, only special keys are +# supported in this mode. +# Useful hidden commands to map in this section: +# * `follow-hint`: Follow the currently selected hint. + +follow-hint + + + + + + + +hint --rapid links download + + +hint all tab-bg + + +hint --rapid links tab-bg + + +hint links + + +[command] +# Keybindings for command mode. +# Since normal keypresses are passed through, only special keys are +# supported in this mode. +# Useful hidden commands to map in this section: +# * `command-history-prev`: Switch to previous command in history. +# * `command-history-next`: Switch to next command in history. +# * `completion-item-focus`: Select another item in completion. +# * `command-accept`: Execute the command currently in the commandline. + +command-history-prev + + +command-history-next + + +completion-item-focus prev + + + +completion-item-focus next + + + +completion-item-del + + +command-accept + + + + + + + +completion-item-focus next-category + + +completion-item-focus prev-category + + +[prompt] +# Keybindings for prompts in the status line. +# You can bind normal keys in this mode, but they will be only active +# when a yes/no-prompt is asked. For other prompt modes, you can only +# bind special keys. +# Useful hidden commands to map in this section: +# * `prompt-accept`: Confirm the entered value. +# * `prompt-accept yes`: Answer yes to a yes/no question. +# * `prompt-accept no`: Answer no to a yes/no question. + +prompt-accept + + + + + + + +prompt-accept yes + y + +prompt-accept no + n + +prompt-open-download + + +prompt-item-focus prev + + + +prompt-item-focus next + + + +[command,prompt] + +rl-backward-char + + +rl-forward-char + + +rl-backward-word + + +rl-forward-word + + +rl-beginning-of-line + + +rl-end-of-line + + +rl-unix-line-discard + + +rl-kill-line + + +rl-kill-word + + +rl-unix-word-rubout + + + +rl-yank + + +rl-delete-char + + +rl-backward-delete-char + + +[caret] + +toggle-selection + v + + +drop-selection + + +enter-mode normal + c + +move-to-next-line + j + +move-to-prev-line + k + +move-to-next-char + l + +move-to-prev-char + h + +move-to-end-of-word + e + +move-to-next-word + w + +move-to-prev-word + b + +move-to-start-of-next-block + ] + +move-to-start-of-prev-block + [ + +move-to-end-of-next-block + } + +move-to-end-of-prev-block + { + +move-to-start-of-line + 0 + +move-to-end-of-line + $ + +move-to-start-of-document + gg + +move-to-end-of-document + G + +yank selection -s + Y + +yank selection + y + + + + + + + +scroll left + H + +scroll down + J + +scroll up + K + +scroll right + L + diff --git a/.config/qutebrowser/quickmarks b/.config/qutebrowser/quickmarks new file mode 100644 index 0000000..35824e1 --- /dev/null +++ b/.config/qutebrowser/quickmarks @@ -0,0 +1,199 @@ +Billets de Train pas chers sur Troc des Trains: Bon plan pour billets de train à petits prix. http://trocdestrains.com/ +Blogs/Bret Victor, beast of burden http://worrydream.com/ +Blogs/Grise Bouille http://grisebouille.net/ +Blogs/Hackery, Math & Design — Acko.net http://acko.net/ +Blogs/Home - colah's blog https://colah.github.io/ +Blogs/I’m a data scientist – mind if I do surgery on your heart? | Simply Statistics http://simplystatistics.org/?p=4068# +Blogs/Le blog d'un odieux connard | Qu'il est bon d'être mauvais. http://unodieuxconnard.com/ +Blogs/Merlanfrit http://www.merlanfrit.net/ +Blogs/Nioutaik, le blog de l'inutile indispensable totalement... indispensable ! http://nioutaik.fr/ +Blogs/OWNI, News, Augmented http://owni.fr/ +Blogs/Personal Registry Editor http://www.nicolasbize.com/blog/ +Blogs/The Daily WTF: Curious Perversions in Information Technology http://thedailywtf.com/ +Blogs/The X Bar · A Statistics Blog http://jhonaker.github.io/ +Blogs/Things Of Interest @ Things Of Interest http://qntm.org/ +Blogs/Variance Explained http://varianceexplained.org/ +Blogs/Wait But Why http://waitbutwhy.com/ +Blogs/ploum.net | Le blog de Lionel Dricot http://ploum.net/ +Cyberplus https://www.icgauth.banquepopulaire.fr/WebSSO_BP/_14707/index.html?transactionID=dacs210adac554204c52a2914e98ced03f59 +DBMI/Avillach Lab http://avillach-lab.hms.harvard.edu/ +DBMI/HMS Secure File Transfer Server https://transfer.med.harvard.edu/courier/web/1000@/wmLogin.html? +DBMI/Home | Caleydo http://www.caleydo.org/ +DBMI/Secure Access SSL VPN - Home https://secure.med.harvard.edu/dana/home/index.cgi +DBMI/Top 10 data mining algorithms in plain English | rayli.net http://rayli.net/blog/data/top-10-data-mining-algorithms-in-plain-english/ +DBMI/WebEx | Harvard Medical School https://hms.webex.com/mw3000/mywebex/cmr/cmr.do?siteurl=hms&AT=meet&username=PAvillach +DBMI/parklab/refinery-platform https://github.com/parklab/refinery-platform +Dev/A successful Git branching model » nvie.com http://nvie.com/posts/a-successful-git-branching-model/ +Dev/CodeMirror http://codemirror.net/ +Dev/D3/Connecting… http://chimera.labs.oreilly.com/books/1230000000345/ch11.html#_force_layout +Dev/D3/Mike Bostock http://bost.ocks.org/mike/ +Dev/D3/SVG Attribute reference - SVG | MDN https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute +Dev/Git Reference http://gitref.org/ +Dev/Guide ABS - traduction française http://abs.traduc.org/ +Dev/Learn Git Branching http://pcottle.github.io/learnGitBranching/ +Dev/Programmer's Learning Machine http://www.loria.fr/~quinson/Teaching/PLM/ +Dev/Programming Languages - Hyperpolyglot http://hyperpolyglot.org/ +Dev/The Elements of Computing Systems / Nisan & Schocken http://www.nand2tetris.org/course.php +Dev/bayandin/awesome-awesomeness https://github.com/bayandin/awesome-awesomeness +Dev/deeplearning/CS231n Convolutional Neural Networks Stanford http://cs231n.stanford.edu/ +Dev/deeplearning/deeplearningbook http://www.deeplearningbook.org/ +Divers/50YearsDataScience.pdf https://dl.dropboxusercontent.com/u/23421017/50YearsDataScience.pdf +Divers/A Good Movie to Watch - Highly-Rated, Little-Known Film Suggestions http://agoodmovietowatch.com/ +Divers/A step by step backpropagation example http://mattmazur.com/2015/03/17/a-step-by-step-backpropagation-example/ +Divers/BetterExplained | Friendly lessons for lasting insight. http://betterexplained.com/ +Divers/CLIapps http://www.jaredandcoralee.com/CLIapps.html +Divers/Dave Conservatoire http://www.daveconservatoire.org/course/introduction-to-sonic-pi +Divers/DotShare.it http://dotshare.it/ +Divers/Exploring the Hacker Tools of Mr Robot | HackerTarget.com https://hackertarget.com/hacker-tools-mr-robot// +Divers/Fellows | Mozilla Science Lab https://www.mozillascience.org/fellows +Divers/Font Awesome Cheatsheet http://fortawesome.github.io/Font-Awesome/cheatsheet/ +Divers/Gnod - The Global Network of Discovery http://www.gnod.com/ +Divers/Graph TV http://graphtv.kevinformatics.com/ +Divers/Implementing a Neural Network from Scratch – An Introduction | WildML http://www.wildml.com/2015/09/implementing-a-neural-network-from-scratch/ +Divers/Index of /~miriah/cs6630/lectures http://www.sci.utah.edu/~miriah/cs6630/lectures/ +Divers/Learning how to code neural networks https://medium.com/learning-new-stuff/how-to-learn-neural-networks-758b78f2736e#.ca646g6j2 +Divers/Machine learning - overview and applications - YouTube https://www.youtube.com/watch?v=yDLKJtOVx5c&list=PLD0F06AA0D2E8FFBA +Divers/Method of Action http://method.ac/ +Divers/Missing Value Treatment - r-statistics.co http://r-statistics.co/Missing-Value-Treatment-With-R.html +Divers/Navigating the massive world of reddit: using backbone networks to map user interests in social media [ PeerJ ] https://peerj.com/articles/cs-4/ +Divers/PLOS Computational Biology: Ten Simple Rules for the Care and Feeding of Scientific Data http://journals.plos.org/ploscompbiol/article?id=10.1371/journal.pcbi.1003542 +Divers/Part2 - I was asked to crack a program in a job interview ! http://erenyagdiran.github.io/I-was-just-asked-to-crack-a-program-Part-2/ +Divers/Shodan https://www.shodan.io/ +Divers/Statistical Graphics and Visualization course materials | Civil Statistician http://civilstat.com/2015/10/statistical-graphics-and-visualization-course-materials/ +Divers/TasteKid | Recommends music, movies, TV shows, books, games http://www.tastekid.com/ +Divers/The Second Intelligent Species by Marshall Brain http://marshallbrain.com/second-intelligent-species.htm +Divers/The Wub Machine https://the.wubmachine.com/ +Divers/ZeroNet: Decentralized websites using Bitcoin crypto and the BitTorrent network http://zeronet.io/ +Divers/http://nbviewer.ipython.org/gist/msund/d3e00e5e27dff31a7b6d http://nbviewer.ipython.org/gist/msund/d3e00e5e27dff31a7b6d +Divers/jlevy/the-art-of-command-line https://github.com/jlevy/the-art-of-command-line +Divers/paulfitz/daff https://github.com/paulfitz/daff +Download/Download YIFY Torrent for YIFY Movies faster - yify-torrent.org http://www.yify-torrent.org/ +Download/Links to help you find college textbooks, because they are expensive as hell. - Imgur http://imgur.com/gallery/2PS74yj +Jeux/Abandonware/Abandonia - Home of abandonware DOS games http://www.abandonia.com/index2.php +Jeux/Abandonware/Home of the Underdogs http://www.homeoftheunderdogs.net/ +Jeux/Abandonware/LTF Lost Treasures Fr Abandonware France, l'histoire des vieux jeux video http://www.abandonware-france.org/ +Jeux/Consoles/Automation Atari ST CD Catalog http://steem.atari.st/automation.htm +Jeux/Consoles/PSP/PSP-GENERATION http://www.pspgen.com/ +Jeux/Consoles/PSP/PSX2PSP/PSX on PSP Compatibility List - TheGamersPress http://www.gamerspress.com/index.php?title=PSX_on_PSP_Compatibility_List +Jeux/Consoles/PSP/PSX2PSP/PSXPSP Manuals http://www.psxpspmanuals.com/ +Jeux/Consoles/PSP/PSX2PSP/PopStation ImagePacks http://popsdb.twystneko.com/ +Jeux/Consoles/PSP/PSX2PSP/Sony Index Homepage http://www.sonyindex.com/ +Jeux/Consoles/Roms/GBA Roms, NDS Roms, We have all the Roms - The Epitome of Emulation! http://www.romulation.net/ +Jeux/Consoles/Roms/Mondemul.net : Emulateurs, roms et jeux vidéo. http://www.mondemul.net/ +Jeux/Consoles/Roms/Playstation paradize - Le site des RPG Playstation http://www.psxrenzukoken.com/nk/ +Jeux/Consoles/VGMaps.com: The Video Game Atlas http://www.vgmaps.com/ +Jeux/CrossCode http://cross-code.com/en/home#download +Jeux/Download the latest indie games - itch.io http://itch.io/ +Jeux/Frontierverse > Missions http://www.sharoma.com/frontierverse/missions.htm +Jeux/Jeux et Stratégie, les ressources du web - Vox http://laurent36.vox.com/library/post/jeux-et-strat%C3%A9gie-les-ressources-du-web.html +Jeux/Koikou/Base de test http://francknet.net/koikou/ +Jeux/Koikou/liste des jeux du koikoukèsse =) - Forum de Nolife http://www.nolife-tv.com/forum/showthread.php?t=966 +Jeux/Linux/Free Gamer - Open Source Games http://freegamer.blogspot.com/ +Jeux/Linux/FreeGameDev Planet - Games http://planet.freegamedev.net/ +Jeux/Linux/Gameolith - The Linux® Game Download Store http://www.gameolith.com/ +Jeux/Linux/Independent Video Games - Wolfire Games http://www.wolfire.com/ +Jeux/Linux/Libregamewiki http://libregamewiki.org/Main_Page +Jeux/Linux/Linux Games | Indie Game Reviewer http://www.indiegamereviewer.com/category/platforms/linux/ +Jeux/Linux/The Linux Game Tome http://happypenguin.org/ +Jeux/Main | EteRNA http://eterna.cmu.edu/htmls/action.html?pagedata=Action +Jeux/TIGSource http://www.tigsource.com/ +Jeux/TIGTumblr http://tigsource.tumblr.com/ +Jeux/The Humble Indie Bundle http://www.humblebundle.com/ +Jeux/The Let's Play Archive http://lparchive.org/ +Jeux/Upcoming/Among The Sleep http://www.krillbite.com/ats/ +Jeux/Upcoming/Heart Machine http://www.heart-machine.com/ +Jeux/Upcoming/Miegakure: A puzzle-platforming game in four dimensions http://marctenbosch.com/miegakure/ +M2IBM/DailyMed http://dailymed.nlm.nih.gov/dailymed/index.cfm +M2IBM/Elearning Smbh https://campusvirtuel.smbh.univ-paris13.fr/index.php?category=M2ibm +M2IBM/Thesorimed http://theso.prod-deux.thesorimed.org/ +Médecine/BioMart http://www.biomart.org/index.html +Médecine/Juste après dresseuse d'ours http://www.jaddo.fr/ +Médecine/Le grand dictionnaire terminologique http://www.granddictionnaire.com/ +Médecine/Le journal d’un interne en médecine générale, un peu remplaçant aussi | Parce qu’il y a des choses que j’ai envie de partager http://drfoulard.fr/ +Médecine/Sous la blouse http://sous-la-blouse.blogspot.com/ +Médecine/Thériaque http://www.theriaque.org/ +Toys and Games/3D Logic II http://www.jeuxvideo-flash.com/jeu-3172-3d-logic-ii.php +Toys and Games/Canvas Cycle: True 8-bit Color Cycling with HTML5 http://www.effectgames.com/demos/canvascycle/?sound=0 +Toys and Games/Cardboard Box Assembler http://games.adultswim.com/cardboard-box-assembler-puzzle-online-game.html +Toys and Games/Chargement… http://www.nitrome.com/games/faultline/ +Toys and Games/Coccinelles http://www.koreus.com/jeu/coccinelles.html +Toys and Games/D I N O * R U N - http://www.pixeljam.com/dinorun/ +Toys and Games/DOFI-BLOG どふぃぶろぐ Cat on a Dolphin http://ishi.blog2.fc2.com/blog-entry-213.html +Toys and Games/Enough Plumbers - Play it on Not Doppler http://www.notdoppler.com/enoughplumbers.php +Toys and Games/Epsilon | Armor Games http://armorgames.com/play/1642/epsilon +Toys and Games/Free Online Game - Give Up Robot 2 from Adult Swim http://games.adultswim.com/give-up-robot-2-online-game.html +Toys and Games/Game about Squares http://gameaboutsquares.com/ +Toys and Games/I Love Traffic | Armor Games http://armorgames.com/play/3515/i-love-traffic +Toys and Games/Ice Breaker - Nitrome - Play Free Games http://www.nitrome.com/games/icebreaker/ +Toys and Games/Instants! Collection http://instantsfun.es/ +Toys and Games/Knuckleheads - Nitrome - Play Free Games http://www.nitrome.com/games/knuckleheads/ +Toys and Games/Kongregate: Play Fancy Pants Adventure: World 2 http://www.kongregate.com/games/DrNeroCF/fancy-pants-adventure-world-2 +Toys and Games/Kongregate: Play Fold http://www.kongregate.com/games/joelesler/fold/?referrer=Jayisgames +Toys and Games/Need For Madness - Car Racing Game, Car Crashing and Stunt Cars Game http://www.radicalplay.com/madness/ +Toys and Games/OLE Coordinate System - Fun-Motion Physics Games Forum http://www.fun-motion.com/forums/showthread.php?t=1260 +Toys and Games/OneMoreLevel.com - Sling Jumper http://www.onemorelevel.com/game/sling_jumper +Toys and Games/OneMoreLevel.com - Spin the Black Circle http://onemorelevel.com/game/spin_the_black_circle +Toys and Games/Open Doors http://www.koreus.com/jeu/open-doors.html +Toys and Games/Orbitrunner | Games | Orbitrunner Online Gravitation Game | Free Online Games At Gamezhero.com http://www.gamezhero.com/online-games/sports-games/orbitrunner-games.html +Toys and Games/Pica Pic | retro handheld games collection http://www.pica-pic.com/# +Toys and Games/Pixel http://hp.vector.co.jp/authors/VA022293/ +Toys and Games/Play Chronotron, a free online game on Kongregate http://www.kongregate.com/games/Scarybug/chronotron +Toys and Games/Play Impasse, a free online game on Kongregate http://www.kongregate.com/games/wanderlands/impasse +Toys and Games/Polluted Planet Demo http://pollutedplanet.googlepages.com/pollutedplanet.html +Toys and Games/Portal: The Flash Version http://www.newgrounds.com/portal/view/404612# +Toys and Games/RRRR : Keep Talking http://www.rrrrthats5rs.com/games/keep-talking/ +Toys and Games/Red Rogue http://www.newgrounds.com/portal/view/607114 +Toys and Games/SeppuKuties | Armor Games http://armorgames.com/play/2565/seppukuties +Toys and Games/Spiderling http://www.newgrounds.com/portal/view/636477 +Toys and Games/Splitter http://www.freewebarcade.com/game/splitter/ +Toys and Games/Tactical Assassin http://files.jeuxvideo-flash.com/3b304ed6735bb32204b423e935c3c532/4857fc89/1701.swf +Toys and Games/The Cryptic Canvas | 50 Movies Hidden In A Painting | Empire | www.empireonline.com http://www.empireonline.com/crypticcanvas/ +Toys and Games/The World's Hardest Game - Free Arcade & Classic Game from AddictingGames http://www.addictinggames.com/theworldshardestgame.html +Toys and Games/Yin Yang - Nitrome - Play Free Games http://www.nitrome.com/games/yinyang/index.html +Toys and Games/as3sfxr http://www.superflashbros.net/as3sfxr/ +Toys and Games/deepnight.net | Proletarian Ninja X http://deepnight.net/games/proletarian-ninja-x/ +Toys and Games/pandemic2.swf (Objet application/x-shockwave-flash) http://www.crazymonkeygames.com/jkf6Tr/pandemic2.swf +Toys and Games/tacticalassassin2.swf (Objet application/x-shockwave-flash) http://www.crazymonkeygames.com/jkf6Tr/tacticalassassin2.swf +Toys and Games/zoomquilt2.swf (Objet application/x-shockwave-flash) http://zoomquilt2.madmindworx.com/zoomquilt2.swf +SNCF http://www.voyages-sncf.com/ +The Pirate Bay onion http://uj3wazyk5u4hnvtk.onion/ +The art of unix programming (unix philosophy) http://www.catb.org/esr/writings/taoup/html/index.html +Rmarkdown website http://rmarkdown.rstudio.com/rmarkdown_websites.html +WHO motor development milestones http://www.who.int/childgrowth/standards/motor_milestones/en/ +équipe22/réservation salle https://docs.google.com/spreadsheets/d/18wHLTwPtasB_QkhsQLUc0DPIEyCV-Gq6Zf_pCsMSe-o/edit#gid=2080891252 +vape http://torontovaporizer.ca/vaporizer/utillian-721.html +git cheatsheet https://github.com/k88hudson/git-flight-rules +APK downloader https://apps.evozi.com/apk-downloader/?id=com.citymapper.app.release +apkpure https://apkpure.com/search?q=alarm+droid +R to python http://n-s-f.github.io/2017/03/25/r-to-python.html +ggplot2 publication ggpubr http://www.sthda.com/english/articles/24-ggpubr-publication-ready-plots/ +korean vocabulary practice https://freshkorean.com/2015/01/03/korean-vocabulary-practice-writing-worksheet-1/ +detective poe http://webtoon.daum.net/webtoon/viewer/37685 +grey hack http://www.moddb.com/games/grey-hack +hegp/galaxy http://egp-galaxy1.egp.aphp.fr:8123/login?redirect=%2F +hegp/redcap dev http://egp-svldcarp3.egp.aphp.fr:81/redcap/ +hegp/redcap https://egp-svwacarp4.egp.aphp.fr/redcap/ +hegp/intranet http://portail-cms.aphp.fr/hupo/ +hegp/i2b2 https://cdw.egp.aphp.fr/ +hegp/rstudio http://egp-svlwstat1.egp.aphp.fr:8787/ +hegp/shiny http://egp-svlwstat1.egp.aphp.fr:3838/users/mwk/01_hello/ +eliquid https://www.eliquidandco.com/ +hegp/email https://courriel-bsr.aphp.fr/ +hegp/ent https://ent.parisdescartes.fr/ +hegp/id_map http://egp-sdlatran2.egp.aphp.fr/id_map/ +Sci-hub onion http://scihub22266oqcxt.onion/ +hegp/NAS http://egp-nascarp1.egp.aphp.fr:5000/ +SIGAPS https://sigaps.aphp.fr/ +jane http://jane.biosemantics.org/index.php +Oralia https://myoralia.fr/extranet/monenvironnement_location.php?Urlhash=3505e7b895b5950578e57969f9115505e7b8789578196979792929515e6e6e6e69694989e9915e0e0e0e09694919e9515e3e3e3e39694949f971 +qutebrowser arch forum https://bbs.archlinux.org/viewtopic.php?id=191076&p=27 +vim galore https://github.com/mhinz/vim-galore/blob/master/README.md +Blogs/wlroots https://drewdevault.com/ +Terminal.sexy https://terminal.sexy/#ICAgzMzMZmZmRSAglt5P5c41ZpnMmWbMZsyZzMzMmZmZc0ByzP-Z__2Amcz_zJn_mf_M8PDw +torrent https://torrent.maximewack.com/transmission/web/ +selfhosted https://github.com/Kickball/awesome-selfhosted +git pretty http://justinhileman.info/article/git-pretty/ +dataviz https://datavizproject.com/ +one piece http://www.onepiece-streaming.com/streaming/saga-quatre-empereurs +blog/R art https://fronkonstin.com/ +parcours cal https://docs.google.com/spreadsheets/d/17z0eg8EoKjRfguWKNvxZO0RCl50RDtYZ2zmwMu_BL_g/edit?ts=5bb76a7e#gid=0 diff --git a/.config/qutebrowser/qutebrowser.conf b/.config/qutebrowser/qutebrowser.conf new file mode 100644 index 0000000..ec427e7 --- /dev/null +++ b/.config/qutebrowser/qutebrowser.conf @@ -0,0 +1,1594 @@ +# vim: ft=dosini + +# Configfile for qutebrowser. +# +# This configfile is parsed by python's configparser in extended +# interpolation mode. The format is very INI-like, so there are +# categories like [general] with "key = value"-pairs. +# +# Note that you shouldn't add your own comments, as this file is +# regenerated every time the config is saved. +# +# Interpolation looks like ${value} or ${section:value} and will be +# replaced by the respective value. +# +# Some settings will expand environment variables. Note that, since +# interpolation is run first, you will need to escape the $ char as +# described below. +# +# This is the default config, so if you want to remove anything from +# here (as opposed to change/add), for example a key binding, set it to +# an empty value. +# +# You will need to escape the following values: +# - # at the start of the line (at the first position of the key) (\#) +# - $ in a value ($$) + + +# General/miscellaneous options. +[general] + +# ignore-case (IgnoreCase): +# Whether to find text on a page case-insensitively. +# true: Search case-insensitively +# false: Search case-sensitively +# smart: Search case-sensitively if there are capital chars +# Default: smart +ignore-case = smart + +# startpage (List of String): +# The default page(s) to open at the start, separated by commas. +# Default: https://start.duckduckgo.com +startpage = https://duckduckgo.com + +# yank-ignored-url-parameters (List of String): +# The URL parameters to strip with :yank url, separated by commas. +# Default: +# ref,utm_source,utm_medium,utm_campaign,utm_term,utm_content +yank-ignored-url-parameters = ref,utm_source,utm_medium,utm_campaign,utm_term,utm_content + +# default-open-dispatcher (String): +# The default program used to open downloads. Set to an empty string +# to use the default internal handler. +# Any {} in the string will be expanded to the filename, else the +# filename will be appended. +# Default: +default-open-dispatcher = + +# default-page (FuzzyUrl): +# The page to open if :open -t/-b/-w is used without URL. Use +# `about:blank` for a blank page. +# Default: ${startpage} +default-page = ${startpage} + +# auto-search (AutoSearch): +# Whether to start a search when something else than a URL is +# entered. +# naive: Use simple/naive check. +# dns: Use DNS requests (might be slow!). +# false: Never search automatically. +# Default: naive +auto-search = naive + +# auto-save-config (Bool): +# Whether to save the config automatically on quit. +# Valid values: true, false +# Default: true +auto-save-config = true + +# auto-save-interval (Int): +# How often (in milliseconds) to auto-save config/cookies/etc. +# Default: 15000 +auto-save-interval = 15000 + +# editor (ShellCommand): +# The editor (and arguments) to use for the `open-editor` command. +# The arguments get split like in a shell, so you can use `"` or `'` +# to quote them. +# `{}` gets replaced by the filename of the file to be edited. +# Default: gvim -f "{}" +editor = urxvt -e nvim -f "{}" + +# editor-encoding (Encoding): +# Encoding to use for editor. +# Default: utf-8 +editor-encoding = utf-8 + +# private-browsing (Bool): +# Open new windows in private browsing mode which does not record +# visited pages. +# Valid values: true, false +# Default: false +private-browsing = false + +# developer-extras (Bool): +# Enable extra tools for Web developers. +# This needs to be enabled for `:inspector` to work and also adds an +# _Inspect_ entry to the context menu. For QtWebEngine, see +# 'qutebrowser --help' instead. +# Valid values: true, false +# Default: false +developer-extras = true + +# print-element-backgrounds (Bool): +# Whether the background color and images are also drawn when the +# page is printed. +# This setting only works with Qt 5.8 or newer when using the +# QtWebEngine backend. +# Valid values: true, false +# Default: true +print-element-backgrounds = true + +# xss-auditing (Bool): +# Whether load requests should be monitored for cross-site scripting +# attempts. +# Suspicious scripts will be blocked and reported in the inspector's +# JavaScript console. Enabling this feature might have an impact on +# performance. +# Valid values: true, false +# Default: false +xss-auditing = true + +# default-encoding (String): +# Default encoding to use for websites. +# The encoding must be a string describing an encoding such as +# _utf-8_, _iso-8859-1_, etc. +# Default: iso-8859-1 +default-encoding = iso-8859-1 + +# new-instance-open-target (String): +# How to open links in an existing instance if a new one is +# launched. +# tab: Open a new tab in the existing window and activate the +# window. +# tab-bg: Open a new background tab in the existing window and +# activate the window. +# tab-silent: Open a new tab in the existing window without +# activating the window. +# tab-bg-silent: Open a new background tab in the existing +# window without activating the window. +# window: Open in a new window. +# Default: tab +new-instance-open-target = tab + +# new-instance-open-target.window (String): +# Which window to choose when opening links as new tabs. +# first-opened: Open new tabs in the first (oldest) opened +# window. +# last-opened: Open new tabs in the last (newest) opened window. +# last-focused: Open new tabs in the most recently focused +# window. +# last-visible: Open new tabs in the most recently visible +# window. +# Default: last-focused +new-instance-open-target.window = last-focused + +# log-javascript-console (String): +# How to log javascript console messages. +# none: Don't log messages. +# debug: Log messages with debug level. +# info: Log messages with info level. +# Default: debug +log-javascript-console = debug + +# save-session (Bool): +# Whether to always save the open pages. +# Valid values: true, false +# Default: false +save-session = true + +# session-default-name (SessionName): +# The name of the session to save by default, or empty for the last +# loaded session. +# Default: +session-default-name = + +# url-incdec-segments (FlagList): +# The URL segments where `:navigate increment/decrement` will search +# for a number. +# Valid values: host, path, query, anchor +# Default: path,query +url-incdec-segments = path,query + + +# General options related to the user interface. +[ui] + +# history-session-interval (Int): +# The maximum time in minutes between two history items for them to +# be considered being from the same session. Use -1 to disable +# separation. +# Default: 30 +history-session-interval = 30 + +# zoom-levels (List of Perc): +# The available zoom levels, separated by commas. +# Default: +# 25%,33%,50%,67%,75%,90%,100%,110%,125%,150%,175%,200%,250%,300%,400%,500% +zoom-levels = 25%,33%,50%,67%,75%,90%,100%,110%,125%,150%,175%,200%,250%,300%,400%,500% + +# default-zoom (Perc): +# The default zoom level. +# Default: 100% +default-zoom = 100% + +# downloads-position (VerticalPosition): +# Where to show the downloaded files. +# Valid values: top, bottom +# Default: top +downloads-position = top + +# status-position (VerticalPosition): +# The position of the status bar. +# Valid values: top, bottom +# Default: bottom +status-position = bottom + +# message-timeout (Int): +# Time (in ms) to show messages in the statusbar for. +# Set to 0 to never clear messages. +# Default: 2000 +message-timeout = 2000 + +# message-unfocused (Bool): +# Whether to show messages in unfocused windows. +# Valid values: true, false +# Default: false +message-unfocused = false + +# confirm-quit (ConfirmQuit): +# Whether to confirm quitting the application. +# always: Always show a confirmation. +# multiple-tabs: Show a confirmation if multiple tabs are +# opened. +# downloads: Show a confirmation if downloads are running +# never: Never show a confirmation. +# Default: never +confirm-quit = downloads + +# zoom-text-only (Bool): +# Whether the zoom factor on a frame applies only to the text or to +# all content. +# Valid values: true, false +# Default: false +zoom-text-only = false + +# frame-flattening (Bool): +# Whether to expand each subframe to its contents. +# This will flatten all the frames to become one scrollable page. +# Valid values: true, false +# Default: false +frame-flattening = false + +# user-stylesheet (File): +# User stylesheet to use (absolute filename or filename relative to +# the config directory). Will expand environment variables. +# Default: +user-stylesheet = + +# hide-scrollbar (Bool): +# Hide the main scrollbar. +# Valid values: true, false +# Default: true +hide-scrollbar = true + +# smooth-scrolling (Bool): +# Whether to enable smooth scrolling for web pages. Note smooth +# scrolling does not work with the :scroll-px command. +# Valid values: true, false +# Default: false +smooth-scrolling = true + +# remove-finished-downloads (Int): +# Number of milliseconds to wait before removing finished downloads. +# Will not be removed if value is -1. +# Default: -1 +remove-finished-downloads = 1000 + +# hide-statusbar (Bool): +# Whether to hide the statusbar unless a message is shown. +# Valid values: true, false +# Default: false +hide-statusbar = false + +# statusbar-padding (Padding): +# Padding for statusbar (top, bottom, left, right). +# Default: 1,1,0,0 +statusbar-padding = 1,1,0,0 + +# window-title-format (FormatString): +# The format to use for the window title. The following placeholders +# are defined: +# * `{perc}`: The percentage as a string like `[10%]`. +# * `{perc_raw}`: The raw percentage, e.g. `10` +# * `{title}`: The title of the current web page +# * `{title_sep}`: The string ` - ` if a title is set, empty +# otherwise. +# * `{id}`: The internal window ID of this window. +# * `{scroll_pos}`: The page scroll position. +# * `{host}`: The host of the current web page. +# * `{backend}`: Either 'webkit' or 'webengine' +# * `{private}` : Indicates when private mode is enabled. +# Default: {perc}{title}{title_sep}qutebrowser +window-title-format = {perc}{title} + +# modal-js-dialog (Bool): +# Use standard JavaScript modal dialog for alert() and confirm() +# Valid values: true, false +# Default: false +modal-js-dialog = true + +# hide-wayland-decoration (Bool): +# Hide the window decoration when using wayland (requires restart) +# Valid values: true, false +# Default: false +hide-wayland-decoration = false + +# keyhint-blacklist (List of String): +# Keychains that shouldn't be shown in the keyhint dialog +# Globs are supported, so ';*' will blacklist all keychainsstarting +# with ';'. Use '*' to disable keyhints +# Default: +keyhint-blacklist = + +# keyhint-delay (Int): +# Time from pressing a key to seeing the keyhint dialog (ms) +# Default: 500 +keyhint-delay = 500 + +# prompt-radius (Int): +# The rounding radius for the edges of prompts. +# Default: 8 +prompt-radius = 8 + +# prompt-filebrowser (Bool): +# Show a filebrowser in upload/download prompts. +# Valid values: true, false +# Default: true +prompt-filebrowser = true + + +# Settings related to the network. +[network] + +# do-not-track (Bool): +# Value to send in the `DNT` header. +# Valid values: true, false +# Default: true +do-not-track = true + +# accept-language (String): +# Value to send in the `accept-language` header. +# Default: en-US,en +accept-language = en-US,en + +# referer-header (String): +# Send the Referer header +# always: Always send. +# never: Never send; this is not recommended, as some sites may +# break. +# same-domain: Only send for the same domain. This will still +# protect your privacy, but shouldn't break any sites. +# Default: same-domain +referer-header = same-domain + +# user-agent (UserAgent): +# User agent to send. Empty to send the default. +# Default: +user-agent = Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:47.0) Gecko/20100101 Firefox/47.0 + +# proxy (Proxy): +# The proxy to use. +# In addition to the listed values, you can use a `socks://...` or +# `http://...` URL. +# system: Use the system wide proxy. +# none: Don't use any proxy +# Default: system +proxy = system + +# proxy-dns-requests (Bool): +# Whether to send DNS requests over the configured proxy. +# Valid values: true, false +# Default: true +proxy-dns-requests = true + +# ssl-strict (BoolAsk): +# Whether to validate SSL handshakes. +# Valid values: true, false, ask +# Default: ask +ssl-strict = true + +# dns-prefetch (Bool): +# Whether to try to pre-fetch DNS entries to speed up browsing. +# Valid values: true, false +# Default: true +dns-prefetch = true + +# custom-headers (HeaderDict): +# Set custom headers for qutebrowser HTTP requests. +# Default: +custom-headers = + +# netrc-file (File): +# Set location of a netrc-file for HTTP authentication. If empty, +# ~/.netrc is used. +# Default: +netrc-file = + + +# Options related to completion and command history. +[completion] + +# show (String): +# When to show the autocompletion window. +# always: Whenever a completion is available. +# auto: Whenever a completion is requested. +# never: Never. +# Default: always +show = auto + +# download-path-suggestion (String): +# What to display in the download filename input. +# path: Show only the download path. +# filename: Show only download filename. +# both: Show download path and filename. +# Default: path +download-path-suggestion = path + +# timestamp-format (TimestampTemplate): +# How to format timestamps (e.g. for history) +# Default: %Y-%m-%d +timestamp-format = %Y-%m-%d + +# height (PercOrInt): +# The height of the completion, in px or as percentage of the +# window. +# Default: 50% +height = 30% + +# cmd-history-max-items (Int): +# How many commands to save in the command history. +# 0: no history / -1: unlimited +# Default: 100 +cmd-history-max-items = -1 + +# web-history-max-items (Int): +# How many URLs to show in the web history. +# 0: no history / -1: unlimited +# Default: 1000 +web-history-max-items = -1 + +# quick-complete (Bool): +# Whether to move on to the next part when there's only one possible +# completion left. +# Valid values: true, false +# Default: true +quick-complete = true + +# shrink (Bool): +# Whether to shrink the completion to be smaller than the configured +# size if there are no scrollbars. +# Valid values: true, false +# Default: false +shrink = false + +# scrollbar-width (Int): +# Width of the scrollbar in the completion window (in px). +# Default: 12 +scrollbar-width = 12 + +# scrollbar-padding (Int): +# Padding of scrollbar handle in completion window (in px). +# Default: 2 +scrollbar-padding = 2 + + +# Options related to input modes. +[input] + +# timeout (Int): +# Timeout (in milliseconds) for ambiguous key bindings. +# If the current input forms both a complete match and a partial +# match, the complete match will be executed after this time. +# Default: 500 +timeout = 500 + +# partial-timeout (Int): +# Timeout (in milliseconds) for partially typed key bindings. +# If the current input forms only partial matches, the keystring +# will be cleared after this time. +# Default: 5000 +partial-timeout = 5000 + +# insert-mode-on-plugins (Bool): +# Whether to switch to insert mode when clicking flash and other +# plugins. +# Valid values: true, false +# Default: false +insert-mode-on-plugins = false + +# auto-leave-insert-mode (Bool): +# Whether to leave insert mode if a non-editable element is clicked. +# Valid values: true, false +# Default: true +auto-leave-insert-mode = true + +# auto-insert-mode (Bool): +# Whether to automatically enter insert mode if an editable element +# is focused after page load. +# Valid values: true, false +# Default: false +auto-insert-mode = false + +# forward-unbound-keys (String): +# Whether to forward unbound keys to the webview in normal mode. +# all: Forward all unbound keys. +# auto: Forward unbound non-alphanumeric keys. +# none: Don't forward any keys. +# Default: auto +forward-unbound-keys = none + +# spatial-navigation (Bool): +# Enables or disables the Spatial Navigation feature. +# Spatial navigation consists in the ability to navigate between +# focusable elements in a Web page, such as hyperlinks and form +# controls, by using Left, Right, Up and Down arrow keys. For +# example, if a user presses the Right key, heuristics determine +# whether there is an element he might be trying to reach towards +# the right and which element he probably wants. +# Valid values: true, false +# Default: false +spatial-navigation = false + +# links-included-in-focus-chain (Bool): +# Whether hyperlinks should be included in the keyboard focus chain. +# Valid values: true, false +# Default: true +links-included-in-focus-chain = true + +# rocker-gestures (Bool): +# Whether to enable Opera-like mouse rocker gestures. This disables +# the context menu. +# Valid values: true, false +# Default: false +rocker-gestures = false + +# mouse-zoom-divider (Int): +# How much to divide the mouse wheel movements to translate them +# into zoom increments. +# Default: 512 +mouse-zoom-divider = 1 + + +# Configuration of the tab bar. +[tabs] + +# background-tabs (Bool): +# Whether to open new tabs (middleclick/ctrl+click) in background. +# Valid values: true, false +# Default: false +background-tabs = true + +# select-on-remove (SelectOnRemove): +# Which tab to select when the focused tab is removed. +# prev: Select the tab which came before the closed one (left in +# horizontal, above in vertical). +# next: Select the tab which came after the closed one (right in +# horizontal, below in vertical). +# last-used: Select the previously selected tab. +# Default: next +select-on-remove = last-used + +# new-tab-position (NewTabPosition): +# How new tabs are positioned. +# prev: Before the current tab. +# next: After the current tab. +# first: At the beginning. +# last: At the end. +# Default: next +new-tab-position = next + +# new-tab-position-explicit (NewTabPosition): +# How new tabs opened explicitly are positioned. +# prev: Before the current tab. +# next: After the current tab. +# first: At the beginning. +# last: At the end. +# Default: last +new-tab-position-explicit = next + +# last-close (String): +# Behavior when the last tab is closed. +# ignore: Don't do anything. +# blank: Load a blank page. +# startpage: Load the start page. +# default-page: Load the default page. +# close: Close the window. +# Default: ignore +last-close = ignore + +# show (String): +# When to show the tab bar +# always: Always show the tab bar. +# never: Always hide the tab bar. +# multiple: Hide the tab bar if only one tab is open. +# switching: Show the tab bar when switching tabs. +# Default: always +show = always + +# show-switching-delay (Int): +# Time to show the tab bar before hiding it when tabs->show is set +# to 'switching'. +# Default: 800 +show-switching-delay = 800 + +# wrap (Bool): +# Whether to wrap when changing tabs. +# Valid values: true, false +# Default: true +wrap = true + +# movable (Bool): +# Whether tabs should be movable. +# Valid values: true, false +# Default: true +movable = true + +# close-mouse-button (String): +# On which mouse button to close tabs. +# right: Close tabs on right-click. +# middle: Close tabs on middle-click. +# none: Don't close tabs using the mouse. +# Default: middle +close-mouse-button = middle + +# position (Position): +# The position of the tab bar. +# Valid values: top, bottom, left, right +# Default: top +position = top + +# show-favicons (Bool): +# Whether to show favicons in the tab bar. +# Valid values: true, false +# Default: true +show-favicons = true + +# favicon-scale (Float): +# Scale for favicons in the tab bar. The tab size is unchanged, so +# big favicons also require extra `tabs->padding`. +# Default: 1.0 +favicon-scale = 1.2 + +# width (PercOrInt): +# The width of the tab bar if it's vertical, in px or as percentage +# of the window. +# Default: 20% +width = 20% + +# pinned-width (Int): +# The width for pinned tabs with a horizontal tabbar, in px. +# Default: 43 +pinned-width = 10 + +# indicator-width (Int): +# Width of the progress indicator (0 to disable). +# Default: 3 +indicator-width = 0 + +# tabs-are-windows (Bool): +# Whether to open windows instead of tabs. +# Valid values: true, false +# Default: false +tabs-are-windows = false + +# title-format (FormatString): +# The format to use for the tab title. The following placeholders +# are defined: +# * `{perc}`: The percentage as a string like `[10%]`. +# * `{perc_raw}`: The raw percentage, e.g. `10` +# * `{title}`: The title of the current web page +# * `{title_sep}`: The string ` - ` if a title is set, empty +# otherwise. +# * `{index}`: The index of this tab. +# * `{id}`: The internal tab ID of this tab. +# * `{scroll_pos}`: The page scroll position. +# * `{host}`: The host of the current web page. +# * `{backend}`: Either 'webkit' or 'webengine' +# * `{private}` : Indicates when private mode is enabled. +# Default: {index}: {title} +title-format = {title} + +# title-format-pinned (FormatString): +# The format to use for the tab title for pinned tabs. The same +# placeholders like for title-format are defined. +# Default: {index} +title-format-pinned = + +# title-alignment (TextAlignment): +# Alignment of the text inside of tabs +# Valid values: left, right, center +# Default: left +title-alignment = left + +# mousewheel-tab-switching (Bool): +# Switch between tabs using the mouse wheel. +# Valid values: true, false +# Default: true +mousewheel-tab-switching = true + +# padding (Padding): +# Padding for tabs (top, bottom, left, right). +# Default: 0,0,5,5 +padding = 0,0,5,5 + +# indicator-padding (Padding): +# Padding for indicators (top, bottom, left, right). +# Default: 2,2,0,4 +indicator-padding = 2,2,0,4 + + +# Settings related to cache and storage. +[storage] + +# download-directory (Directory): +# The directory to save downloads to. An empty value selects a +# sensible os-specific default. Will expand environment variables. +# Default: +download-directory = + +# prompt-download-directory (Bool): +# Whether to prompt the user for the download location. +# If set to false, 'download-directory' will be used. +# Valid values: true, false +# Default: true +prompt-download-directory = false + +# remember-download-directory (Bool): +# Whether to remember the last used download directory. +# Valid values: true, false +# Default: true +remember-download-directory = true + +# maximum-pages-in-cache (Int): +# The maximum number of pages to hold in the global memory page +# cache. +# The Page Cache allows for a nicer user experience when navigating +# forth or back to pages in the forward/back history, by pausing and +# resuming up to _n_ pages. +# For more information about the feature, please refer to: +# http://webkit.org/blog/427/webkit-page-cache-i-the-basics/ +# Default: 0 +maximum-pages-in-cache = 0 + +# offline-web-application-cache (Bool): +# Whether support for the HTML 5 web application cache feature is +# enabled. +# An application cache acts like an HTTP cache in some sense. For +# documents that use the application cache via JavaScript, the +# loader engine will first ask the application cache for the +# contents, before hitting the network. +# The feature is described in details at: +# http://dev.w3.org/html5/spec/Overview.html#appcache +# Valid values: true, false +# Default: true +offline-web-application-cache = true + +# local-storage (Bool): +# Whether support for HTML 5 local storage and Web SQL is enabled. +# Valid values: true, false +# Default: true +local-storage = true + +# cache-size (Int): +# Size of the HTTP network cache. Empty to use the default value. +# Default: +cache-size = 52428800 + + +# Loaded plugins/scripts and allowed actions. +[content] + +# allow-images (Bool): +# Whether images are automatically loaded in web pages. +# Valid values: true, false +# Default: true +allow-images = true + +# allow-javascript (Bool): +# Enables or disables the running of JavaScript programs. +# Valid values: true, false +# Default: true +allow-javascript = true + +# allow-plugins (Bool): +# Enables or disables plugins in Web pages. +# Qt plugins with a mimetype such as "application/x-qt-plugin" are +# not affected by this setting. +# Valid values: true, false +# Default: false +allow-plugins = true + +# webgl (Bool): +# Enables or disables WebGL. +# Valid values: true, false +# Default: true +webgl = true + +# hyperlink-auditing (Bool): +# Enable or disable hyperlink auditing (). +# Valid values: true, false +# Default: false +hyperlink-auditing = false + +# geolocation (BoolAsk): +# Allow websites to request geolocations. +# Valid values: true, false, ask +# Default: ask +geolocation = ask + +# notifications (BoolAsk): +# Allow websites to show notifications. +# Valid values: true, false, ask +# Default: ask +notifications = ask + +# media-capture (BoolAsk): +# Allow websites to record audio/video. +# Valid values: true, false, ask +# Default: ask +media-capture = ask + +# javascript-can-open-windows-automatically (Bool): +# Whether JavaScript programs can open new windows without user +# interaction. +# Valid values: true, false +# Default: false +javascript-can-open-windows-automatically = true + +# javascript-can-close-windows (Bool): +# Whether JavaScript programs can close windows. +# Valid values: true, false +# Default: false +javascript-can-close-windows = false + +# javascript-can-access-clipboard (Bool): +# Whether JavaScript programs can read or write to the clipboard. +# With QtWebEngine, writing the clipboard as response to a user +# interaction is always allowed. +# Valid values: true, false +# Default: false +javascript-can-access-clipboard = false + +# ignore-javascript-prompt (Bool): +# Whether all javascript prompts should be ignored. +# Valid values: true, false +# Default: false +ignore-javascript-prompt = false + +# ignore-javascript-alert (Bool): +# Whether all javascript alerts should be ignored. +# Valid values: true, false +# Default: false +ignore-javascript-alert = false + +# local-content-can-access-remote-urls (Bool): +# Whether locally loaded documents are allowed to access remote +# urls. +# Valid values: true, false +# Default: false +local-content-can-access-remote-urls = false + +# local-content-can-access-file-urls (Bool): +# Whether locally loaded documents are allowed to access other local +# urls. +# Valid values: true, false +# Default: true +local-content-can-access-file-urls = true + +# cookies-accept (String): +# Control which cookies to accept. +# all: Accept all cookies. +# no-3rdparty: Accept cookies from the same origin only. +# no-unknown-3rdparty: Accept cookies from the same origin only, +# unless a cookie is already set for the domain. +# never: Don't accept cookies at all. +# Default: no-3rdparty +cookies-accept = no-3rdparty + +# cookies-store (Bool): +# Whether to store cookies. Note this option needs a restart with +# QtWebEngine on Qt < 5.9. +# Valid values: true, false +# Default: true +cookies-store = true + +# host-block-lists (List of Url): +# List of URLs of lists which contain hosts to block. +# The file can be in one of the following formats: +# - An '/etc/hosts'-like file +# - One host per line +# - A zip-file of any of the above, with either only one file, or a +# file named 'hosts' (with any extension). +# Default: +# https://www.malwaredomainlist.com/hostslist/hosts.txt,http://someonewhocares.org/hosts/hosts,http://winhelp2002.mvps.org/hosts.zip,http://malwaredomains.lehigh.edu/files/justdomains.zip,https://pgl.yoyo.org/adservers/serverlist.php?hostformat=hosts&mimetype=plaintext +host-block-lists = http://www.malwaredomainlist.com/hostslist/hosts.txt,http://someonewhocares.org/hosts/hosts,http://winhelp2002.mvps.org/hosts.zip,http://malwaredomains.lehigh.edu/files/justdomains.zip,http://pgl.yoyo.org/adservers/serverlist.php?hostformat=hosts&mimetype=plaintext + +# host-blocking-enabled (Bool): +# Whether host blocking is enabled. +# Valid values: true, false +# Default: true +host-blocking-enabled = true + +# host-blocking-whitelist (List of String): +# List of domains that should always be loaded, despite being +# ad-blocked. +# Domains may contain * and ? wildcards and are otherwise required +# to exactly match the requested domain. +# Local domains are always exempt from hostblocking. +# Default: piwik.org +host-blocking-whitelist = piwik.org + +# enable-pdfjs (Bool): +# Enable pdf.js to view PDF files in the browser. +# Note that the files can still be downloaded by clicking the +# download button in the pdf.js viewer. +# Valid values: true, false +# Default: false +enable-pdfjs = true + + +# Hinting settings. +[hints] + +# border (String): +# CSS border value for hints. +# Default: 1px solid #E3BE23 +border = 1px solid black + +# mode (String): +# Mode to use for hints. +# number: Use numeric hints. (In this mode you can also type +# letters form the hinted element to filter and reduce the number of +# elements that are hinted.) +# letter: Use the chars in the hints -> chars setting. +# word: Use hints words based on the html elements and the extra +# words. +# Default: letter +mode = letter + +# chars (UniqueCharString): +# Chars used for hint strings. +# Default: asdfghjkl +chars = tsrn + +# min-chars (Int): +# Minimum number of chars used for hint strings. +# Default: 1 +min-chars = 1 + +# scatter (Bool): +# Whether to scatter hint key chains (like Vimium) or not (like +# dwb). Ignored for number hints. +# Valid values: true, false +# Default: true +scatter = false + +# uppercase (Bool): +# Make chars in hint strings uppercase. +# Valid values: true, false +# Default: false +uppercase = true + +# dictionary (File): +# The dictionary file to be used by the word hints. +# Default: /usr/share/dict/words +dictionary = /usr/share/dict/words + +# auto-follow (String): +# Controls when a hint can be automatically followed without the +# user pressing Enter. +# always: Auto-follow whenever there is only a single hint on a +# page. +# unique-match: Auto-follow whenever there is a unique non-empty +# match in either the hint string (word mode) or filter (number +# mode). +# full-match: Follow the hint when the user typed the whole hint +# (letter, word or number mode) or the element's text (only in +# number mode). +# never: The user will always need to press Enter to follow a +# hint. +# Default: unique-match +auto-follow = unique-match + +# auto-follow-timeout (Int): +# A timeout (in milliseconds) to inhibit normal-mode key bindings +# after a successful auto-follow. +# Default: 0 +auto-follow-timeout = 0 + +# next-regexes (List of Regex): +# A comma-separated list of regexes to use for 'next' links. +# Default: +# \bnext\b,\bmore\b,\bnewer\b,\b[>→≫]\b,\b(>>|»)\b,\bcontinue\b +next-regexes = \bnext\b,\bmore\b,\bnewer\b,\b[>→≫]\b,\b(>>|»)\b,\bcontinue\b + +# prev-regexes (List of Regex): +# A comma-separated list of regexes to use for 'prev' links. +# Default: \bprev(ious)?\b,\bback\b,\bolder\b,\b[<←≪]\b,\b(<<|«)\b +prev-regexes = \bprev(ious)?\b,\bback\b,\bolder\b,\b[<←≪]\b,\b(<<|«)\b + +# find-implementation (String): +# Which implementation to use to find elements to hint. +# javascript: Better but slower +# python: Slightly worse but faster +# Default: python +find-implementation = python + +# hide-unmatched-rapid-hints (Bool): +# Controls hiding unmatched hints in rapid mode. +# Valid values: true, false +# Default: true +hide-unmatched-rapid-hints = true + + +# Definitions of search engines which can be used via the address bar. +# The searchengine named `DEFAULT` is used when `general -> auto-search` +# is true and something else than a URL was entered to be opened. Other +# search engines can be used by prepending the search engine name to the +# search term, e.g. `:open google qutebrowser`. The string `{}` will be +# replaced by the search term, use `{{` and `}}` for literal `{`/`}` +# signs. +[searchengines] +DEFAULT = https://duckduckgo.com/?q={} + + +# Aliases for commands. +# By default, no aliases are defined. Example which adds a new command +# `:qtb` to open qutebrowsers website: +# `qtb = open https://www.qutebrowser.org/` +[aliases] +ff = spawn firefox {url} +toron = set network proxy socks://localhost:9050/ +toroff = set network proxy system + + +# Colors used in the UI. +# A value can be in one of the following format: +# * `#RGB`/`#RRGGBB`/`#RRRGGGBBB`/`#RRRRGGGGBBBB` +# * An SVG color name as specified in http://www.w3.org/TR/SVG/types.html#ColorKeywords[the W3C specification]. +# * transparent (no color) +# * `rgb(r, g, b)` / `rgba(r, g, b, a)` (values 0-255 or percentages) +# * `hsv(h, s, v)` / `hsva(h, s, v, a)` (values 0-255, hue 0-359) +# * A gradient as explained in http://doc.qt.io/qt-5/stylesheet-reference.html#list-of-property-types[the Qt documentation] under ``Gradient''. +# A *.system value determines the color system to use for color +# interpolation between similarly-named *.start and *.stop entries, +# regardless of how they are defined in the options. Valid values are +# 'rgb', 'hsv', and 'hsl'. +# The `hints.*` values are a special case as they're real CSS colors, not Qt-CSS colors. There, for a gradient, you need to use `-webkit-gradient`, see https://www.webkit.org/blog/175/introducing-css-gradients/[the WebKit documentation]. +[colors] + +# completion.fg (QtColor): +# Text color of the completion widget. +# Default: white +completion.fg = white + +# completion.bg (QssColor): +# Background color of the completion widget. +# Default: #333333 +completion.bg = #333333 + +# completion.alternate-bg (QssColor): +# Alternating background color of the completion widget. +# Default: #444444 +completion.alternate-bg = #444444 + +# completion.category.fg (QtColor): +# Foreground color of completion widget category headers. +# Default: white +completion.category.fg = white + +# completion.category.bg (QssColor): +# Background color of the completion widget category headers. +# Default: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #888888, +# stop:1 #505050) +completion.category.bg = qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #888888, stop:1 #505050) + +# completion.category.border.top (QssColor): +# Top border color of the completion widget category headers. +# Default: black +completion.category.border.top = black + +# completion.category.border.bottom (QssColor): +# Bottom border color of the completion widget category headers. +# Default: ${completion.category.border.top} +completion.category.border.bottom = ${completion.category.border.top} + +# completion.item.selected.fg (QtColor): +# Foreground color of the selected completion item. +# Default: black +completion.item.selected.fg = black + +# completion.item.selected.bg (QssColor): +# Background color of the selected completion item. +# Default: #e8c000 +completion.item.selected.bg = #e8c000 + +# completion.item.selected.border.top (QssColor): +# Top border color of the completion widget category headers. +# Default: #bbbb00 +completion.item.selected.border.top = #bbbb00 + +# completion.item.selected.border.bottom (QssColor): +# Bottom border color of the selected completion item. +# Default: ${completion.item.selected.border.top} +completion.item.selected.border.bottom = ${completion.item.selected.border.top} + +# completion.match.fg (QssColor): +# Foreground color of the matched text in the completion. +# Default: #ff4444 +completion.match.fg = #ff4444 + +# completion.scrollbar.fg (QssColor): +# Color of the scrollbar handle in completion view. +# Default: ${completion.fg} +completion.scrollbar.fg = ${completion.fg} + +# completion.scrollbar.bg (QssColor): +# Color of the scrollbar in completion view +# Default: ${completion.bg} +completion.scrollbar.bg = ${completion.bg} + +# statusbar.fg (QssColor): +# Foreground color of the statusbar. +# Default: white +statusbar.fg = white + +# statusbar.bg (QssColor): +# Background color of the statusbar. +# Default: black +statusbar.bg = black + +# statusbar.fg.private (QssColor): +# Foreground color of the statusbar in private browsing mode. +# Default: ${statusbar.fg} +statusbar.fg.private = ${statusbar.fg} + +# statusbar.bg.private (QssColor): +# Background color of the statusbar in private browsing mode. +# Default: #666666 +statusbar.bg.private = #666666 + +# statusbar.fg.insert (QssColor): +# Foreground color of the statusbar in insert mode. +# Default: ${statusbar.fg} +statusbar.fg.insert = ${statusbar.fg} + +# statusbar.bg.insert (QssColor): +# Background color of the statusbar in insert mode. +# Default: darkgreen +statusbar.bg.insert = darkgreen + +# statusbar.fg.command (QssColor): +# Foreground color of the statusbar in command mode. +# Default: ${statusbar.fg} +statusbar.fg.command = ${statusbar.fg} + +# statusbar.bg.command (QssColor): +# Background color of the statusbar in command mode. +# Default: ${statusbar.bg} +statusbar.bg.command = ${statusbar.bg} + +# statusbar.fg.command.private (QssColor): +# Foreground color of the statusbar in private browsing + command +# mode. +# Default: ${statusbar.fg.private} +statusbar.fg.command.private = ${statusbar.fg.private} + +# statusbar.bg.command.private (QssColor): +# Background color of the statusbar in private browsing + command +# mode. +# Default: ${statusbar.bg.private} +statusbar.bg.command.private = ${statusbar.bg.private} + +# statusbar.fg.caret (QssColor): +# Foreground color of the statusbar in caret mode. +# Default: ${statusbar.fg} +statusbar.fg.caret = ${statusbar.fg} + +# statusbar.bg.caret (QssColor): +# Background color of the statusbar in caret mode. +# Default: purple +statusbar.bg.caret = purple + +# statusbar.fg.caret-selection (QssColor): +# Foreground color of the statusbar in caret mode with a selection +# Default: ${statusbar.fg} +statusbar.fg.caret-selection = ${statusbar.fg} + +# statusbar.bg.caret-selection (QssColor): +# Background color of the statusbar in caret mode with a selection +# Default: #a12dff +statusbar.bg.caret-selection = #a12dff + +# statusbar.progress.bg (QssColor): +# Background color of the progress bar. +# Default: white +statusbar.progress.bg = white + +# statusbar.url.fg (QssColor): +# Default foreground color of the URL in the statusbar. +# Default: ${statusbar.fg} +statusbar.url.fg = ${statusbar.fg} + +# statusbar.url.fg.success (QssColor): +# Foreground color of the URL in the statusbar on successful load +# (http). +# Default: white +statusbar.url.fg.success = white + +# statusbar.url.fg.success.https (QssColor): +# Foreground color of the URL in the statusbar on successful load +# (https). +# Default: lime +statusbar.url.fg.success.https = lime + +# statusbar.url.fg.error (QssColor): +# Foreground color of the URL in the statusbar on error. +# Default: orange +statusbar.url.fg.error = orange + +# statusbar.url.fg.warn (QssColor): +# Foreground color of the URL in the statusbar when there's a +# warning. +# Default: yellow +statusbar.url.fg.warn = yellow + +# statusbar.url.fg.hover (QssColor): +# Foreground color of the URL in the statusbar for hovered links. +# Default: aqua +statusbar.url.fg.hover = aqua + +# tabs.fg.odd (QtColor): +# Foreground color of unselected odd tabs. +# Default: white +tabs.fg.odd = white + +# tabs.bg.odd (QtColor): +# Background color of unselected odd tabs. +# Default: grey +tabs.bg.odd = grey + +# tabs.fg.even (QtColor): +# Foreground color of unselected even tabs. +# Default: white +tabs.fg.even = white + +# tabs.bg.even (QtColor): +# Background color of unselected even tabs. +# Default: darkgrey +tabs.bg.even = darkgrey + +# tabs.fg.selected.odd (QtColor): +# Foreground color of selected odd tabs. +# Default: white +tabs.fg.selected.odd = white + +# tabs.bg.selected.odd (QtColor): +# Background color of selected odd tabs. +# Default: black +tabs.bg.selected.odd = black + +# tabs.fg.selected.even (QtColor): +# Foreground color of selected even tabs. +# Default: ${tabs.fg.selected.odd} +tabs.fg.selected.even = ${tabs.fg.selected.odd} + +# tabs.bg.selected.even (QtColor): +# Background color of selected even tabs. +# Default: ${tabs.bg.selected.odd} +tabs.bg.selected.even = ${tabs.bg.selected.odd} + +# tabs.bg.bar (QtColor): +# Background color of the tab bar. +# Default: #555555 +tabs.bg.bar = #555555 + +# tabs.indicator.start (QtColor): +# Color gradient start for the tab indicator. +# Default: #0000aa +tabs.indicator.start = #0000aa + +# tabs.indicator.stop (QtColor): +# Color gradient end for the tab indicator. +# Default: #00aa00 +tabs.indicator.stop = #00aa00 + +# tabs.indicator.error (QtColor): +# Color for the tab indicator on errors.. +# Default: #ff0000 +tabs.indicator.error = #ff0000 + +# tabs.indicator.system (ColorSystem): +# Color gradient interpolation system for the tab indicator. +# rgb: Interpolate in the RGB color system. +# hsv: Interpolate in the HSV color system. +# hsl: Interpolate in the HSL color system. +# none: Don't show a gradient. +# Default: rgb +tabs.indicator.system = rgb + +# hints.fg (QssColor): +# Font color for hints. +# Default: black +hints.fg = white + +# hints.bg (QssColor): +# Background color for hints. Note that you can use a `rgba(...)` +# value for transparency. +# Default: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 rgba(255, +# 247, 133, 0.8), stop:1 rgba(255, 197, 66, 0.8)) +hints.bg = rgba(0,0,0,128) + +# hints.fg.match (QssColor): +# Font color for the matched part of hints. +# Default: green +hints.fg.match = rgba(0,0,0,128) + +# downloads.bg.bar (QssColor): +# Background color for the download bar. +# Default: black +downloads.bg.bar = black + +# downloads.fg.start (QtColor): +# Color gradient start for download text. +# Default: white +downloads.fg.start = white + +# downloads.bg.start (QtColor): +# Color gradient start for download backgrounds. +# Default: #0000aa +downloads.bg.start = #0000aa + +# downloads.fg.stop (QtColor): +# Color gradient end for download text. +# Default: ${downloads.fg.start} +downloads.fg.stop = ${downloads.fg.start} + +# downloads.bg.stop (QtColor): +# Color gradient stop for download backgrounds. +# Default: #00aa00 +downloads.bg.stop = #00aa00 + +# downloads.fg.system (ColorSystem): +# Color gradient interpolation system for download text. +# rgb: Interpolate in the RGB color system. +# hsv: Interpolate in the HSV color system. +# hsl: Interpolate in the HSL color system. +# none: Don't show a gradient. +# Default: rgb +downloads.fg.system = rgb + +# downloads.bg.system (ColorSystem): +# Color gradient interpolation system for download backgrounds. +# rgb: Interpolate in the RGB color system. +# hsv: Interpolate in the HSV color system. +# hsl: Interpolate in the HSL color system. +# none: Don't show a gradient. +# Default: rgb +downloads.bg.system = rgb + +# downloads.fg.error (QtColor): +# Foreground color for downloads with errors. +# Default: white +downloads.fg.error = white + +# downloads.bg.error (QtColor): +# Background color for downloads with errors. +# Default: red +downloads.bg.error = red + +# webpage.bg (QtColor): +# Background color for webpages if unset (or empty to use the +# theme's color) +# Default: white +webpage.bg = white + +# keyhint.fg (QssColor): +# Text color for the keyhint widget. +# Default: #FFFFFF +keyhint.fg = #FFFFFF + +# keyhint.fg.suffix (CssColor): +# Highlight color for keys to complete the current keychain +# Default: #FFFF00 +keyhint.fg.suffix = #FFFF00 + +# keyhint.bg (QssColor): +# Background color of the keyhint widget. +# Default: rgba(0, 0, 0, 80%) +keyhint.bg = rgba(0, 0, 0, 80%) + +# messages.fg.error (QssColor): +# Foreground color of an error message. +# Default: white +messages.fg.error = ${statusbar.fg} + +# messages.bg.error (QssColor): +# Background color of an error message. +# Default: red +messages.bg.error = red + +# messages.border.error (QssColor): +# Border color of an error message. +# Default: #bb0000 +messages.border.error = #bb0000 + +# messages.fg.warning (QssColor): +# Foreground color a warning message. +# Default: white +messages.fg.warning = ${statusbar.fg} + +# messages.bg.warning (QssColor): +# Background color of a warning message. +# Default: darkorange +messages.bg.warning = darkorange + +# messages.border.warning (QssColor): +# Border color of an error message. +# Default: #d47300 +messages.border.warning = #d47300 + +# messages.fg.info (QssColor): +# Foreground color an info message. +# Default: white +messages.fg.info = white + +# messages.bg.info (QssColor): +# Background color of an info message. +# Default: black +messages.bg.info = black + +# messages.border.info (QssColor): +# Border color of an info message. +# Default: #333333 +messages.border.info = #333333 + +# prompts.fg (QssColor): +# Foreground color for prompts. +# Default: white +prompts.fg = ${statusbar.fg} + +# prompts.bg (QssColor): +# Background color for prompts. +# Default: darkblue +prompts.bg = darkblue + +# prompts.selected.bg (QssColor): +# Background color for the selected item in filename prompts. +# Default: #308cc6 +prompts.selected.bg = #308cc6 + + +# Fonts used for the UI, with optional style/weight/size. +# * Style: `normal`/`italic`/`oblique` +# * Weight: `normal`, `bold`, `100`..`900` +# * Size: _number_ `px`/`pt` +[fonts] + +# _monospace (Font): +# Default monospace fonts. +# Default: xos4 Terminus, Terminus, Monospace, "DejaVu Sans Mono", +# Monaco, "Bitstream Vera Sans Mono", "Andale Mono", "Courier New", +# Courier, "Liberation Mono", monospace, Fixed, Consolas, Terminal +_monospace = "Source Code Pro" + +# completion (Font): +# Font used in the completion widget. +# Default: 8pt ${_monospace} +completion = 8pt ${_monospace} + +# completion.category (Font): +# Font used in the completion categories. +# Default: bold ${completion} +completion.category = bold ${completion} + +# tabbar (QtFont): +# Font used in the tab bar. +# Default: 8pt ${_monospace} +tabbar = 8pt ${_monospace} + +# statusbar (Font): +# Font used in the statusbar. +# Default: 8pt ${_monospace} +statusbar = 8pt ${_monospace} + +# downloads (Font): +# Font used for the downloadbar. +# Default: 8pt ${_monospace} +downloads = 8pt ${_monospace} + +# hints (Font): +# Font used for the hints. +# Default: bold 13px ${_monospace} +hints = bold 13px ${_monospace} + +# debug-console (QtFont): +# Font used for the debugging console. +# Default: 8pt ${_monospace} +debug-console = 8pt ${_monospace} + +# web-family-standard (FontFamily): +# Font family for standard fonts. +# Default: +web-family-standard = + +# web-family-fixed (FontFamily): +# Font family for fixed fonts. +# Default: +web-family-fixed = + +# web-family-serif (FontFamily): +# Font family for serif fonts. +# Default: +web-family-serif = + +# web-family-sans-serif (FontFamily): +# Font family for sans-serif fonts. +# Default: +web-family-sans-serif = + +# web-family-cursive (FontFamily): +# Font family for cursive fonts. +# Default: +web-family-cursive = + +# web-family-fantasy (FontFamily): +# Font family for fantasy fonts. +# Default: +web-family-fantasy = + +# web-size-minimum (Int): +# The hard minimum font size. +# Default: 0 +web-size-minimum = 0 + +# web-size-minimum-logical (Int): +# The minimum logical font size that is applied when zooming out. +# Default: 6 +web-size-minimum-logical = 6 + +# web-size-default (Int): +# The default font size for regular text. +# Default: 16 +web-size-default = 16 + +# web-size-default-fixed (Int): +# The default font size for fixed-pitch text. +# Default: 13 +web-size-default-fixed = 13 + +# keyhint (Font): +# Font used in the keyhint widget. +# Default: 8pt ${_monospace} +keyhint = 8pt ${_monospace} + +# messages.error (Font): +# Font used for error messages. +# Default: 8pt ${_monospace} +messages.error = 8pt ${_monospace} + +# messages.warning (Font): +# Font used for warning messages. +# Default: 8pt ${_monospace} +messages.warning = 8pt ${_monospace} + +# messages.info (Font): +# Font used for info messages. +# Default: 8pt ${_monospace} +messages.info = 8pt ${_monospace} + +# prompts (Font): +# Font used for prompts. +# Default: 8pt sans-serif +prompts = 8pt sans-serif diff --git a/.config/ranger/commands.py b/.config/ranger/commands.py new file mode 100644 index 0000000..ea49467 --- /dev/null +++ b/.config/ranger/commands.py @@ -0,0 +1,161 @@ +# This is a sample commands.py. You can add your own commands here. +# +# Please refer to commands_full.py for all the default commands and a complete +# documentation. Do NOT add them all here, or you may end up with defunct +# commands when upgrading ranger. + +# You always need to import ranger.api.commands here to get the Command class: +from ranger.api.commands import * + +# A simple command for demonstration purposes follows. +#------------------------------------------------------------------------------ + +# You can import any python module as needed. +import os + +# Any class that is a subclass of "Command" will be integrated into ranger as a +# command. Try typing ":my_edit" in ranger! +class my_edit(Command): + # The so-called doc-string of the class will be visible in the built-in + # help that is accessible by typing "?c" inside ranger. + """:my_edit + + A sample command for demonstration purposes that opens a file in an editor. + """ + + # The execute method is called when you run this command in ranger. + def execute(self): + # self.arg(1) is the first (space-separated) argument to the function. + # This way you can write ":my_edit somefilename". + if self.arg(1): + # self.rest(1) contains self.arg(1) and everything that follows + target_filename = self.rest(1) + else: + # self.fm is a ranger.core.filemanager.FileManager object and gives + # you access to internals of ranger. + # self.fm.thisfile is a ranger.container.file.File object and is a + # reference to the currently selected file. + target_filename = self.fm.thisfile.path + + # This is a generic function to print text in ranger. + self.fm.notify("Let's edit the file " + target_filename + "!") + + # Using bad=True in fm.notify allows you to print error messages: + if not os.path.exists(target_filename): + self.fm.notify("The given file does not exist!", bad=True) + return + + # This executes a function from ranger.core.acitons, a module with a + # variety of subroutines that can help you construct commands. + # Check out the source, or run "pydoc ranger.core.actions" for a list. + self.fm.edit_file(target_filename) + + # The tab method is called when you press tab, and should return a list of + # suggestions that the user will tab through. + def tab(self): + # This is a generic tab-completion function that iterates through the + # content of the current directory. + return self._tab_directory_content() + +class bulkrename(Command): + """:bulkrename + + This command opens a list of selected files in an external editor. + After you edit and save the file, it will generate a shell script + which does bulk renaming according to the changes you did in the file. + + This shell script is opened in an editor for you to review. + After you close it, it will be executed. + """ + def execute(self): + import sys + import tempfile + from ranger.container.file import File + from ranger.ext.shell_escape import shell_escape as esc + py3 = sys.version_info[0] >= 3 + + # Create and edit the file list + filenames = [f.relative_path for f in self.fm.thistab.get_selection()] + listfile = tempfile.NamedTemporaryFile(delete=False) + listpath = listfile.name + + if py3: + listfile.write("\n".join(filenames).encode("utf-8")) + else: + listfile.write("\n".join(filenames)) + listfile.close() + self.fm.execute_file([File(listpath)], app='nvim') + listfile = open(listpath, 'r') + new_filenames = listfile.read().split("\n") + listfile.close() + os.unlink(listpath) + if all(a == b for a, b in zip(filenames, new_filenames)): + self.fm.notify("No renaming to be done!") + return + + # Generate script + cmdfile = tempfile.NamedTemporaryFile() + script_lines = [] + script_lines.append("# This file will be executed when you close the editor.\n") + script_lines.append("# Please double-check everything, clear the file to abort.\n") + script_lines.extend("mv -vi -- %s %s\n" % (esc(old), esc(new)) \ + for old, new in zip(filenames, new_filenames) if old != new) + script_content = "".join(script_lines) + if py3: + cmdfile.write(script_content.encode("utf-8")) + else: + cmdfile.write(script_content) + cmdfile.flush() + + # Open the script and let the user review it, then check if the script + # was modified by the user + self.fm.execute_file([File(cmdfile.name)], app='nvim') + cmdfile.seek(0) + script_was_edited = (script_content != cmdfile.read()) + + # Do the renaming + self.fm.run(['/bin/sh', cmdfile.name], flags='w') + cmdfile.close() + + # Retag the files, but only if the script wasn't changed during review, + # because only then we know which are the source and destination files. + if not script_was_edited: + tags_changed = False + for old, new in zip(filenames, new_filenames): + if old != new: + oldpath = self.fm.thisdir.path + '/' + old + newpath = self.fm.thisdir.path + '/' + new + if oldpath in self.fm.tags: + old_tag = self.fm.tags.tags[oldpath] + self.fm.tags.remove(oldpath) + self.fm.tags.tags[newpath] = old_tag + tags_changed = True + if tags_changed: + self.fm.tags.dump() + else: + fm.notify("files have not been retagged") + +class playlist(Command): + """:playlist + + This script creates a playlist for mpv from selection + """ + def execute(self): + import sys + from ranger.container.file import File + from ranger.ext.shell_escape import shell_escape as esc + py3 = sys.version_info[0] >= 3 + + # Create and edit the file list + filenames = [f.relative_path for f in self.fm.thistab.get_selection()] + listfile = open("playlist.play" ,'w') + + listfile.write("\n".join(filenames)) + + listfile.close() + + self.fm.mark_files(all=True, val=False) + self.fm.run('xdotool search --classname Ranger windowunmap') + self.fm.run('mpv --playlist=' + listfile.name) + + os.unlink(listfile.name) diff --git a/.config/ranger/rc.conf b/.config/ranger/rc.conf new file mode 100644 index 0000000..ade2bc3 --- /dev/null +++ b/.config/ranger/rc.conf @@ -0,0 +1,631 @@ +# =================================================================== +# This file contains the default startup commands for ranger. +# To change them, it is recommended to create the file +# ~/.config/ranger/rc.conf and add your custom commands there. +# +# If you copy this whole file there, you may want to set the environment +# variable RANGER_LOAD_DEFAULT_RC to FALSE to avoid loading it twice. +# +# The purpose of this file is mainly to define keybindings and settings. +# For running more complex python code, please create a plugin in "plugins/" or +# a command in "commands.py". +# +# Each line is a command that will be run before the user interface +# is initialized. As a result, you can not use commands which rely +# on the UI such as :delete or :mark. +# =================================================================== + +# =================================================================== +# == Options +# =================================================================== + +# Which viewmode should be used? Possible values are: +# miller: Use miller columns which show multiple levels of the hierarchy +# multipane: Midnight-commander like multipane view showing all tabs next +# to each other +set viewmode miller +#set viewmode multipane + +# How many columns are there, and what are their relative widths? +set column_ratios 1,1,2,4 + +# Which files should be hidden? (regular expression) +set hidden_filter ^\.|\.(?:pyc|pyo|bak|swp)$|^lost\+found$|^__(py)?cache__$ + +# Show hidden files? You can toggle this by typing 'zh' +set show_hidden false + +# Ask for a confirmation when running the "delete" command? +# Valid values are "always", "never", "multiple" (default) +# With "multiple", ranger will ask only if you delete multiple files at once. +set confirm_on_delete multiple + +# Use non-default path for file preview script? +# ranger ships with scope.sh, a script that calls external programs (see +# README.md for dependencies) to preview images, archives, etc. +set preview_script ~/.config/ranger/scope.sh + +# Use the external preview script or display simple plain text or image previews? +set use_preview_script true + +# Automatically count files in the directory, even before entering them? +set automatically_count_files true + +# Open all images in this directory when running certain image viewers +# like feh or sxiv? You can still open selected files by marking them. +set open_all_images true + +# Be aware of version control systems and display information. +set vcs_aware true + +# State of the four backends git, hg, bzr, svn. The possible states are +# disabled, local (only show local info), enabled (show local and remote +# information). +set vcs_backend_git enabled +set vcs_backend_hg disabled +set vcs_backend_bzr disabled +set vcs_backend_svn disabled + +# Use one of the supported image preview protocols +set preview_images true + +# Set the preview image method. Supported methods: +# +# * w3m (default): +# Preview images in full color with the external command "w3mimgpreview"? +# This requires the console web browser "w3m" and a supported terminal. +# It has been successfully tested with "xterm" and "urxvt" without tmux. +# +# * iterm2: +# Preview images in full color using iTerm2 image previews +# (http://iterm2.com/images.html). This requires using iTerm2 compiled +# with image preview support. +# +# This feature relies on the dimensions of the terminal's font. By default, a +# width of 8 and height of 11 are used. To use other values, set the options +# iterm2_font_width and iterm2_font_height to the desired values. +# +# * urxvt: +# Preview images in full color using urxvt image backgrounds. This +# requires using urxvt compiled with pixbuf support. +# +# * urxvt-full: +# The same as urxvt but utilizing not only the preview pane but the +# whole terminal window. +set preview_images_method kitty + +# Default iTerm2 font size (see: preview_images_method: iterm2) +set iterm2_font_width 8 +set iterm2_font_height 11 + +# Use a unicode "..." character to mark cut-off filenames? +set unicode_ellipsis false + +# Show dotfiles in the bookmark preview box? +set show_hidden_bookmarks true + +# Which colorscheme to use? These colorschemes are available by default: +# default, jungle, snow, solarized +set colorscheme default + +# Preview files on the rightmost column? +# And collapse (shrink) the last column if there is nothing to preview? +set preview_files true +set preview_directories true +set collapse_preview true + +# Save the console history on exit? +set save_console_history true + +# Draw the status bar on top of the browser window (default: bottom) +set status_bar_on_top false + +# Draw a progress bar in the status bar which displays the average state of all +# currently running tasks which support progress bars? +set draw_progress_bar_in_status_bar true + +# Draw borders around columns? +set draw_borders true + +# Display the directory name in tabs? +set dirname_in_tabs true + +# Enable the mouse support? +set mouse_enabled true + +# Display the file size in the main column or status bar? +set display_size_in_main_column true +set display_size_in_status_bar true + +# Display files tags in all columns or only in main column? +set display_tags_in_all_columns true + +# Set a title for the window? +set update_title false + +# Set the title to "ranger" in the tmux program? +set update_tmux_title false + +# Shorten the title if it gets long? The number defines how many +# directories are displayed at once, 0 turns off this feature. +set shorten_title 3 + +# Show hostname in titlebar? +set hostname_in_titlebar true + +# Abbreviate $HOME with ~ in the titlebar (first line) of ranger? +set tilde_in_titlebar false + +# How many directory-changes or console-commands should be kept in history? +set max_history_size 20 +set max_console_history_size 50 + +# Try to keep so much space between the top/bottom border when scrolling: +set scroll_offset 8 + +# Flush the input after each key hit? (Noticeable when ranger lags) +set flushinput true + +# Padding on the right when there's no preview? +# This allows you to click into the space to run the file. +set padding_right false + +# Save bookmarks (used with mX and `X) instantly? +# This helps to synchronize bookmarks between multiple ranger +# instances but leads to *slight* performance loss. +# When false, bookmarks are saved when ranger is exited. +set autosave_bookmarks true + +# Save the "`" bookmark to disk. This can be used to switch to the last +# directory by typing "``". +set save_backtick_bookmark true + +# You can display the "real" cumulative size of directories by using the +# command :get_cumulative_size or typing "dc". The size is expensive to +# calculate and will not be updated automatically. You can choose +# to update it automatically though by turning on this option: +set autoupdate_cumulative_size false + +# Turning this on makes sense for screen readers: +set show_cursor false + +# One of: size, natural, basename, atime, ctime, mtime, type, random +set sort natural + +# Additional sorting options +set sort_reverse false +set sort_case_insensitive true +set sort_directories_first true +set sort_unicode false + +# Enable this if key combinations with the Alt Key don't work for you. +# (Especially on xterm) +set xterm_alt_key false + +# Whether to include bookmarks in cd command +set cd_bookmarks true + +# Changes case sensitivity for the cd command tab completion +set cd_tab_case sensitive + +# Use fuzzy tab completion with the "cd" command. For example, +# ":cd /u/lo/b" expands to ":cd /usr/local/bin". +set cd_tab_fuzzy true + +# Avoid previewing files larger than this size, in bytes. Use a value of 0 to +# disable this feature. +set preview_max_size 100000000 + +# Add the highlighted file to the path in the titlebar +set show_selection_in_titlebar true + +# The delay that ranger idly waits for user input, in milliseconds, with a +# resolution of 100ms. Lower delay reduces lag between directory updates but +# increases CPU load. +set idle_delay 2000 + +# When the metadata manager module looks for metadata, should it only look for +# a ".metadata.json" file in the current directory, or do a deep search and +# check all directories above the current one as well? +set metadata_deep_search false + +# Clear all existing filters when leaving a directory +set clear_filters_on_dir_change true + +# Disable displaying line numbers in main column +set line_numbers false + +# Start line numbers from 1 instead of 0 +set one_indexed false + +# Save tabs on exit +set save_tabs_on_exit true + +# Enable scroll wrapping - moving down while on the last item will wrap around to +# the top and vice versa. +set wrap_scroll false + +# Set the global_inode_type_filter to nothing. Possible options: d, f and l for +# directories, files and symlinks respectively. +set global_inode_type_filter + +# =================================================================== +# == Local Options +# =================================================================== +# You can set local options that only affect a single directory. + +# Examples: +# setlocal path=~/downloads sort mtime + +# =================================================================== +# == Command Aliases in the Console +# =================================================================== + +map e chain draw_possible_programs; console open_with%%space +alias q quit +alias q! quitall +alias qall quitall +alias setl setlocal + +alias filter scout -prts +alias find scout -aetlsf +alias mark scout -mr +alias unmark scout -Mr +alias search scout -rs +alias search_inc scout -rts +alias travel scout -aefklst + +# =================================================================== +# == Define keys for the browser +# =================================================================== + +# Basic +map Q quitall +map q quit +copymap q ZZ ZQ + +map R reload_cwd +map F set freeze_files! +map reset +map redraw_window +map abort +map change_mode normal +map zM set viewmode! + +map i display_file +map ? help +map W display_log +map w taskview_open +map S shell $SHELL + +map : console +map ; console +map ^ terminal +map ! shell $SHELL +map @ console -p6 shell %%s +map # console -p9 shell -w %%s +map f console find%space +map cd console cd%space + +# Tagging / Marking +map mark_files toggle=True +map v mark_files all=True toggle=True +map uv mark_files all=True val=False +map V toggle_visual_mode +map uV toggle_visual_mode reverse=True + +# For the nostalgics: Midnight Commander bindings +map help +map display_file +map edit +map E edit +map copy +map cut +map console mkdir%space +map console delete +map exit + +# Bepo-vim movement +map t move left=1 +map s move down=1 +map r move right=1 +map d move up=1 + +# In case you work on a keyboard with dvorak layout +map move up=1 +map move down=1 +map move left=1 +map move right=1 +map move to=0 +map move to=-1 +map move down=1 pages=True +map move up=1 pages=True +map move right=1 +map console delete +map x console delete +map console touch%space + +map S move down=0.5 pages=True +map D move up=0.5 pages=True +copymap J +copymap K + +# Jumping around +map T history_go -1 +map R history_go 1 +map ] move_parent 1 +map [ move_parent -1 +map } traverse + +map gh cd ~ +map ge cd /etc +map gu cd /usr +map gd cd /dev +map gl cd -r . +map gL cd -r %f +map go cd /opt +map gv cd /var +map gm cd /media +map gM cd /mnt +map gs cd /srv +map gr cd / +map gR eval fm.cd(ranger.RANGERDIR) +map g/ cd / +map g? cd /usr/share/doc/ranger + +# External Programs +map E edit +map lu shell -p du --max-depth=1 -h --apparent-size +map lU shell -p du --max-depth=1 -h --apparent-size | sort -rh +map yp yank path +map yd yank dir +map yn yank name + +# Filesystem Operations +map = chmod + +map cw console rename%space +map C console rename%space +map A eval fm.open_console('rename ' + fm.thisfile.basename) +map I eval fm.open_console('rename ' + fm.thisfile.basename, position=7) + +map pp paste +map po paste overwrite=True +map pl paste_symlink relative=False +map pL paste_symlink relative=True +map phl paste_hardlink +map pht paste_hardlinked_subtree + +map ll cut +map ud uncut +map la cut mode=add +map lr cut mode=remove + +map yy copy +map uy uncut +map ya copy mode=add +map yr copy mode=remove + +# Temporary workarounds +map lgg eval fm.cut(dirarg=dict(to=0), narg=quantifier) +map lG eval fm.cut(dirarg=dict(to=-1), narg=quantifier) +map lj eval fm.cut(dirarg=dict(down=1), narg=quantifier) +map lk eval fm.cut(dirarg=dict(up=1), narg=quantifier) +map ygg eval fm.copy(dirarg=dict(to=0), narg=quantifier) +map yG eval fm.copy(dirarg=dict(to=-1), narg=quantifier) +map yj eval fm.copy(dirarg=dict(down=1), narg=quantifier) +map yk eval fm.copy(dirarg=dict(up=1), narg=quantifier) + +# Searching +map / console search%space +map n search_next +map N search_next forward=False +map ct search_next order=tag +map cs search_next order=size +map ci search_next order=mimetype +map cc search_next order=ctime +map cm search_next order=mtime +map ca search_next order=atime + +# Tabs +map tab_new +map tab_close +map tab_move 1 +map tab_move -1 +map tab_move 1 +map tab_move -1 +map gt tab_move 1 +map gT tab_move -1 +map gn tab_new +map gl tab_close +map uq tab_restore +map tab_open 1 +map tab_open 2 +map tab_open 3 +map tab_open 4 +map tab_open 5 +map tab_open 6 +map tab_open 7 +map tab_open 8 +map tab_open 9 + +# Sorting +map or set sort_reverse! +map oz set sort=random +map os chain set sort=size; set sort_reverse=False +map ob chain set sort=basename; set sort_reverse=False +map on chain set sort=natural; set sort_reverse=False +map om chain set sort=mtime; set sort_reverse=False +map oc chain set sort=ctime; set sort_reverse=False +map oa chain set sort=atime; set sort_reverse=False +map ot chain set sort=type; set sort_reverse=False +map oe chain set sort=extension; set sort_reverse=False + +map oS chain set sort=size; set sort_reverse=True +map oB chain set sort=basename; set sort_reverse=True +map oN chain set sort=natural; set sort_reverse=True +map oM chain set sort=mtime; set sort_reverse=True +map oC chain set sort=ctime; set sort_reverse=True +map oA chain set sort=atime; set sort_reverse=True +map oT chain set sort=type; set sort_reverse=True +map oE chain set sort=extension; set sort_reverse=True + +map lc get_cumulative_size + +# Settings +map zc set collapse_preview! +map zd set sort_directories_first! +map zh set show_hidden! +map set show_hidden! +map zI set flushinput! +map zi set preview_images! +map zm set mouse_enabled! +map zp set preview_files! +map zP set preview_directories! +map zs set sort_case_insensitive! +map zu set autoupdate_cumulative_size! +map zv set use_preview_script! +map zf console filter%space +map zF filter +map zg console travel%space + +# Bookmarks +map ` enter_bookmark %any +map ' enter_bookmark %any +map m set_bookmark %any +map um unset_bookmark %any + +map m draw_bookmarks +copymap m um ` ' + +# Generate all the chmod bindings with some python help: +eval for arg in "rwxXst": cmd("map +u{0} shell -f chmod u+{0} %s".format(arg)) +eval for arg in "rwxXst": cmd("map +g{0} shell -f chmod g+{0} %s".format(arg)) +eval for arg in "rwxXst": cmd("map +o{0} shell -f chmod o+{0} %s".format(arg)) +eval for arg in "rwxXst": cmd("map +a{0} shell -f chmod a+{0} %s".format(arg)) +eval for arg in "rwxXst": cmd("map +{0} shell -f chmod u+{0} %s".format(arg)) + +eval for arg in "rwxXst": cmd("map -u{0} shell -f chmod u-{0} %s".format(arg)) +eval for arg in "rwxXst": cmd("map -g{0} shell -f chmod g-{0} %s".format(arg)) +eval for arg in "rwxXst": cmd("map -o{0} shell -f chmod o-{0} %s".format(arg)) +eval for arg in "rwxXst": cmd("map -a{0} shell -f chmod a-{0} %s".format(arg)) +eval for arg in "rwxXst": cmd("map -{0} shell -f chmod u-{0} %s".format(arg)) + +# =================================================================== +# == Define keys for the console +# =================================================================== +# Note: Unmapped keys are passed directly to the console. + +# Basic +cmap eval fm.ui.console.tab() +cmap eval fm.ui.console.tab(-1) +cmap eval fm.ui.console.close() +cmap eval fm.ui.console.execute() +cmap redraw_window + +copycmap +copycmap + +# Move around +cmap eval fm.ui.console.history_move(-1) +cmap eval fm.ui.console.history_move(1) +cmap eval fm.ui.console.move(left=1) +cmap eval fm.ui.console.move(right=1) +cmap eval fm.ui.console.move(right=0, absolute=True) +cmap eval fm.ui.console.move(right=-1, absolute=True) +cmap eval fm.ui.console.move_word(left=1) +cmap eval fm.ui.console.move_word(right=1) + +# Line Editing +cmap eval fm.ui.console.delete(-1) +cmap eval fm.ui.console.delete(0) +cmap eval fm.ui.console.delete_word() +cmap eval fm.ui.console.delete_word(backward=False) +cmap eval fm.ui.console.delete_rest(1) +cmap eval fm.ui.console.delete_rest(-1) +cmap eval fm.ui.console.paste() + +# And of course the emacs way +copycmap +copycmap +copycmap +copycmap +copycmap +copycmap +copycmap +copycmap + +# Note: There are multiple ways to express backspaces. (code 263) +# and (code 127). To be sure, use both. +copycmap + +# This special expression allows typing in numerals: +cmap false + +# =================================================================== +# == Pager Keybindings +# =================================================================== + +# Movement +pmap s pager_move down=1 +pmap d pager_move up=1 +pmap t pager_move left=4 +pmap r pager_move right=4 +pmap gg pager_move to=0 +pmap G pager_move to=-1 +pmap pager_move down=1.0 pages=True +pmap pager_move up=1.0 pages=True +pmap S pager_move down=0.5 pages=True +pmap D pager_move up=0.5 pages=True + +copypmap k +copypmap j +copypmap h +copypmap l +copypmap g +copypmap G +copypmap d +copypmap u +copypmap n f +copypmap p b + +# Basic +pmap redraw_window +pmap pager_close +copypmap q Q i +pmap E edit_file + +# =================================================================== +# == Taskview Keybindings +# =================================================================== + +# Movement +tmap d taskview_move up=1 +tmap s taskview_move down=1 +tmap gg taskview_move to=0 +tmap G taskview_move to=-1 +tmap taskview_move down=1.0 pages=True +tmap taskview_move up=1.0 pages=True +tmap S taskview_move down=0.5 pages=True +tmap D taskview_move up=0.5 pages=True + +copytmap k +copytmap j +copytmap g +copytmap G +copytmap u +copytmap n f +copytmap p b + +# Changing priority and deleting tasks +tmap S eval -q fm.ui.taskview.task_move(-1) +tmap D eval -q fm.ui.taskview.task_move(0) +tmap ll eval -q fm.ui.taskview.task_remove() +tmap eval -q fm.ui.taskview.task_move(-1) +tmap eval -q fm.ui.taskview.task_move(0) +tmap eval -q fm.ui.taskview.task_remove() + +# Basic +tmap redraw_window +tmap taskview_close +copytmap q Q w diff --git a/.config/ranger/rifle.conf b/.config/ranger/rifle.conf new file mode 100644 index 0000000..d134ecf --- /dev/null +++ b/.config/ranger/rifle.conf @@ -0,0 +1,190 @@ +# vim: ft=cfg +# +# This is the configuration file of "rifle", ranger's file executor/opener. +# Each line consists of conditions and a command. For each line the conditions +# are checked and if they are met, the respective command is run. +# +# Syntax: +# , , ... = command +# +# The command can contain these environment variables: +# $1-$9 | The n-th selected file +# $@ | All selected files +# +# If you use the special command "ask", rifle will ask you what program to run. +# +# Prefixing a condition with "!" will negate its result. +# These conditions are currently supported: +# match | The regexp matches $1 +# ext | The regexp matches the extension of $1 +# mime | The regexp matches the mime type of $1 +# name | The regexp matches the basename of $1 +# path | The regexp matches the absolute path of $1 +# has | The program is installed (i.e. located in $PATH) +# file | $1 is a file +# directory | $1 is a directory +# number | change the number of this command to n +# terminal | stdin, stderr and stdout are connected to a terminal +# X | $DISPLAY is not empty (i.e. Xorg runs) +# +# There are also pseudo-conditions which have a "side effect": +# flag | Change how the program is run. See below. +# label