dotfiles

<-- duh.
Log | Files | Refs | LICENSE

commit b9b63ced918944b282dbf13402d89f7bc177b46a
parent a121c00e0de9f61678815b9689e7945b10cd5d75
Author: Hayden Hamilton <hayden@haydenvh.com>
Date:   Thu, 26 Mar 2020 21:59:28 +0000

wew

Diffstat:
D.alias | 59-----------------------------------------------------------
D.bash_profile | 2--
D.bashrc | 74--------------------------------------------------------------------------
A.config/alias | 56++++++++++++++++++++++++++++++++++++++++++++++++++++++++
D.config/bash/alias | 59-----------------------------------------------------------
D.config/calcurse/conf | 25-------------------------
D.config/calcurse/keys | 55-------------------------------------------------------
D.config/dunst/dunstrc | 46----------------------------------------------
D.config/fff/config | 2--
D.config/fff/fff | 2--
D.config/fish/alias | 59-----------------------------------------------------------
D.config/fish/config.fish | 41-----------------------------------------
A.config/galias | 15+++++++++++++++
D.config/i3/config | 300-------------------------------------------------------------------------------
D.config/i3blocks/config | 47-----------------------------------------------
D.config/i3blocks/config2 | 31-------------------------------
D.config/i3blocks/i3blocks | 2--
M.config/irssi/config | 44++++++++------------------------------------
M.config/irssi/pipeline.theme | 40+++++++++++++++++++++-------------------
D.config/mpd/mpd.conf | 19-------------------
D.config/neofetch/config.conf | 764-------------------------------------------------------------------------------
M.config/nvim/init.vim | 8++++++++
M.config/nvim/modules/abbrs.vim | 13+++++++------
R.tmux.conf -> .config/tmux/config | 0
D.config/vim/autoload/goyo.vim | 447-------------------------------------------------------------------------------
D.config/vim/autoload/magit/git.vim | 348-------------------------------------------------------------------------------
D.config/vim/autoload/magit/helper.vim | 29-----------------------------
D.config/vim/autoload/magit/mapping.vim | 262-------------------------------------------------------------------------------
D.config/vim/autoload/magit/sign.vim | 116-------------------------------------------------------------------------------
D.config/vim/autoload/magit/state.vim | 385-------------------------------------------------------------------------------
D.config/vim/autoload/magit/sys.vim | 119-------------------------------------------------------------------------------
D.config/vim/autoload/magit/utils.vim | 180-------------------------------------------------------------------------------
D.config/vim/colors/.vimrc | 0
D.config/vim/colors/duochrome.vim | 313-------------------------------------------------------------------------------
D.config/vim/colors/plain.vim | 294-------------------------------------------------------------------------------
D.config/vim/colors/wal.vim | 196-------------------------------------------------------------------------------
D.config/vim/common/magit_common.vim | 62--------------------------------------------------------------
D.config/vim/plugin/commentary.vim | 117-------------------------------------------------------------------------------
D.config/vim/plugin/deadkeys.vim | 253-------------------------------------------------------------------------------
D.config/vim/plugin/goyo.vim | 24------------------------
D.config/vim/plugin/ipa.vim | 186-------------------------------------------------------------------------------
D.config/vim/plugin/magit.vim | 1357-------------------------------------------------------------------------------
D.config/vim/plugin/prose.vim | 38--------------------------------------
D.config/vim/plugin/repeat.vim | 165-------------------------------------------------------------------------------
D.config/vim/plugin/surround.vim | 619-------------------------------------------------------------------------------
D.config/vim/plugin/system_copy.vim | 148-------------------------------------------------------------------------------
D.config/vim/syntax/magit.vim | 51---------------------------------------------------
M.config/vimb/config | 6++++--
M.config/zsh/.zshrc | 29+++++++++++++++++++++--------
D.config/zsh/alias | 72------------------------------------------------------------------------
A.config/zsh/alias.zsh | 71+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
R.config/zsh/functions -> .config/zsh/functions.zsh | 0
R.ls_colors -> .config/zsh/ls.zsh | 0
D.galias | 13-------------
D.gitaddlist | 57---------------------------------------------------------
A.local/xauth | 0
R.Xresources -> .local/xres | 0
D.profile | 34----------------------------------
M.scripts/bin/dmenu/dircgetpass | 1-
M.scripts/bin/misc/cvrestart | 6+++---
A.scripts/bin/misc/dotadd | 39+++++++++++++++++++++++++++++++++++++++
M.scripts/bin/misc/mkalias | 7++-----
M.scripts/bin/misc/rmpv | 2+-
M.scripts/bin/misc/trimfiles | 16++++++++--------
M.scripts/bin/misc/urlhand | 36+++++++-----------------------------
R.scripts/i3blocks/bat -> .scripts/dwmblocks/bat | 0
R.scripts/i3blocks/cal -> .scripts/dwmblocks/cal | 0
R.scripts/i3blocks/cpu -> .scripts/dwmblocks/cpu | 0
R.scripts/i3blocks/disk -> .scripts/dwmblocks/disk | 0
R.scripts/i3blocks/disk2 -> .scripts/dwmblocks/disk2 | 0
R.scripts/i3blocks/convtodwm -> .scripts/dwmblocks/dwmbar | 0
R.scripts/i3blocks/host -> .scripts/dwmblocks/host | 0
R.scripts/i3blocks/mem -> .scripts/dwmblocks/mem | 0
R.scripts/i3blocks/mpv -> .scripts/dwmblocks/mpv | 0
R.scripts/i3blocks/net -> .scripts/dwmblocks/net | 0
R.scripts/i3blocks/news -> .scripts/dwmblocks/news | 0
R.scripts/i3blocks/time -> .scripts/dwmblocks/time | 0
R.scripts/i3blocks/time2 -> .scripts/dwmblocks/time2 | 0
R.scripts/i3blocks/title -> .scripts/dwmblocks/title | 0
R.scripts/i3blocks/vol -> .scripts/dwmblocks/vol | 0
R.scripts/i3blocks/weather -> .scripts/dwmblocks/weather | 0
R.scripts/i3blocks/weather2 -> .scripts/dwmblocks/weather2 | 0
A.scripts/tools/backupdel | 77+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
A.scripts/tools/mkbackup | 16++++++++++++++++
D.vim | 2--
D.vimrc | 123-------------------------------------------------------------------------------
M.xinitrc | 2+-
M.xprofile | 4++--
T.zprofile | 0
Dgeneral/make.sh | 78------------------------------------------------------------------------------
90 files changed, 367 insertions(+), 7796 deletions(-)

diff --git a/.alias b/.alias @@ -1,59 +0,0 @@ -ls \ls --color -l \ls --color -la \ls --color -a -ll \ls --color -lh -lla \ls --color -lah -vim nvim -vi nvim -v nvim -xi sudo xbps-install -xiu sudo xbps-install -S; sudo xbps-install -yu xbps; sudo xbps-install -yu -xq sudo xbps-query -xr sudo xbps-remove -irssi \irssi --config ~/.config/irssi/config -pipes \pipes -R -r 10000 -c 10 -c 11 -c 12 -c 13 -c 14 -c 15 -s 15 -clock tty-clock -s -c -C 7 -ytdl youtube-dl --add-metadata -ic -ytdla youtube-dl --add-metadata -xic -map telnet mapscii.me -tetris ssh netris.rocketnine.space -calcurse \calcurse -D ~/.config/calcurse -irssi \irssi --home ~/.config/irssi/ -n haydenh -zsleep sudo zzz -hibernate sudo ZZZ -rmst bash ~/.scripts/random/gnulinux.sh -fff bash ~/.config/fff/config -python python3 -vimb \vimb --no-maximize -cleancache sudo xbps-remove -Oo; rm -rf ~/.cache ~/.mozilla ~/.local/share/webkitgtk ~/.viminfo ~/.wget-hsts ~/.lesshst ~/.sh_history ~/.python_history ~/.*history ~/.*hst ~/.dbus ~/.sciminfo ~/.viminfo ~/.w3m; sudo vkpurge rm all -mkconfall mkmailpass; mkalias -nw newsboat -nm neomutt -conftar cd ~; sshtar .config/ .tmux.conf .terminfo/ .scripts/ .alias .galias .vimrc -maic sudo make all install clean -~d cd ~/general/downloads; ls -~do cd ~/general/documents; ls -~iw cd ~/images/wallpapers; ls -~i cd ~/images; ls -~v cd ~/videos; ls -~m cd ~/music; ls -~w cd ~/work; ls -~c cd ~/.config; ls -~s cd ~/.scripts; ls -~sb cd ~/.scripts/bin; ls -~sbdi cd ~/.scripts/bin/display; ls -~sbdm cd ~/.scripts/bin/dmenu; ls -~sbi cd ~/.scripts/bin/i3; ls -~sbm cd ~/.scripts/bin/misc; ls -~vrc vim ~/.vimrc -.. cd .. -... cd ../.. -.... cd ../../.. -..... cd ../../../.. -...... cd ../../../../.. -....... cd ../../../../../.. -........ cd ../../../../../../.. -......... cd ../../../../../../../.. -.......... cd ../../../../../../../../.. -........... cd ../../../../../../../../../.. -............ cd ../../../../../../../../../../.. diff --git a/.bash_profile b/.bash_profile @@ -1 +0,0 @@ -.profile -\ No newline at end of file diff --git a/.bashrc b/.bashrc @@ -1,74 +0,0 @@ -# -# .bashrc -# Created by Hayden Hamilton -# -# haydenvh.com -# Copyright (c) 2019 Hayden Hamilton. LICENSE:MIT -# - -##Infinite command history -HISTSIZE= HISTFILESIZE= -##Setting promt -export PS1="\[$(tput bold)\]\[$(tput setaf 1)\][\[$(tput setaf 3)\]\u\[$(tput setaf 2)\]@\[$(tput setaf 4)\]\h \[$(tput setaf 5)\]\w\[$(tput setaf 1)\]]\[$(tput setaf 7)\]\\\$ \[$(tput sgr0)\]" -export PS2="\[$(tput bold)\]\[$(tput setaf 1)\][$(tput setaf 2)\]Unclosed string\[$(tput setaf 1)\]]\[$(tput setaf 7)\]> \[$(tput sgr0)\]" - -##Start X when on tty1 -[ "$(tty)" = "/dev/tty1" ] && startx - -##Setting aliases -. $HOME/.config/bash/alias - -##Setting VI mode -set -o vi - -##Setting colors for ls -export LS_COLORS="di=35:fi=0:ln=33:ex=91;01:*.sh=91:*.html=92:*.css=97:*.md=97:*.yml=93:*.c=94:*.h=94:*.h.orig=94;01:*.h.rej=94;01:*.mk=96:*LICENSE=90:*Makefile=90:*README=97:*.c.orig=94;01:*.c.rej=94;01:*.png=95:*.jpg=95:*.heic=95:*.heif=95:*.mp3=95;01:*opus=.95;01:*.m4a=95;01:*.flac=95;01:*.wav=95;01:*.mp4=95;04:*.mkv=95;04" - -##Framebuffer functions -video(){ - mpv $* --vo=drm -} -image(){ - mpv $* --vo=drm --pause -} - -##Random -hostfile() { - if [ "$(echo "$1" | sed 's/ /qqq/g' | awk '/qqq/')" == "" ] - then - name=$(curl -F "file=@$1" http://0x0.st) - echo "Your file has been hosted at $name" - else - newfile=$(echo $1 | tr ' ' '.') - mv "$1" $newfile - name=$(curl -F "file=@$newfile" http://0x0.st) - echo "Your file has been hosted at $name" - mv $newfile "$1" &&>/dev/null 2>/dev/null 1>/dev/null - fi -} -rickroll(){ - curl -s -L https://raw.githubusercontent.com/keroseren/rickrollrc/master/roll.sh | bash -} -weather(){ - curl wttr.in/$1 -} -iploc(){ - curl ifconfig.co/$1 -} -getnews(){ - if [ "$1" != "" ] - then - arg=$(echo "$1" | sed 's/ /+/g') - fi - curl getnews.tech/$arg -} -cheatsh(){ - curl cheat.sh/$1 -} -dict(){ - curl "dict://dict.org/d:$1" -} -parrot(){ - curl parrot.live/$1 -} -bash ~/.bash_profile diff --git a/.config/alias b/.config/alias @@ -0,0 +1,56 @@ +ls \ls --color +l \ls --color +la \ls --color -A +ll \ls --color -lh +lla \ls --color -lAh +vim nvim +vi nvim +v nvim +xi sudo xbps-install +xiu sudo xbps-install -S; sudo xbps-install -yu xbps; sudo xbps-install -yu +xq sudo xbps-query +xr sudo xbps-remove +irssi \irssi --config ~/.config/irssi/config +pipes \pipes -R -r 10000 -c 10 -c 11 -c 12 -c 13 -c 14 -c 15 -s 15 +clock tty-clock -s -c -C 7 +ytdl youtube-dl --add-metadata -ic +ytdla youtube-dl --add-metadata -xic +map telnet mapscii.me +tetris ssh netris.rocketnine.space +irssi \irssi --home ~/.config/irssi/ -n haydenh +zsleep sudo zzz +hibernate sudo ZZZ +rmst bash ~/.scripts/random/gnulinux.sh +vimb \vimb --no-maximize +cleancache sudo xbps-remove -Ooy; rm -rf ~/.cache ~/.mozilla ~/.local/share/webkitgtk ~/.viminfo ~/.wget-hsts ~/.lesshst ~/.sh_history ~/.python_history ~/.*history ~/.*hst ~/.dbus ~/.sciminfo ~/.viminfo ~/.w3m; sudo vkpurge rm all +mkconfall mkmailpass; mkalias +tmux tmux -f ~/.config/tmux/config +nw newsboat +nm neomutt +maic sudo make all install clean +~d cd ~/general/downloads; ls +~do cd ~/general/documents; ls +~iw cd ~/images/wallpapers; ls +~i cd ~/images; ls +~v cd ~/videos; ls +~m cd ~/music; ls +~w cd ~/work; ls +~c cd ~/.config; ls +~s cd ~/.scripts; ls +~sb cd ~/.scripts/bin; ls +~sbdi cd ~/.scripts/bin/display; ls +~sbdm cd ~/.scripts/bin/dmenu; ls +~sbi cd ~/.scripts/bin/i3; ls +~sbm cd ~/.scripts/bin/misc; ls +~vrc vim ~/.vimrc +.. cd .. +... cd ../.. +.... cd ../../.. +..... cd ../../../.. +...... cd ../../../../.. +....... cd ../../../../../.. +........ cd ../../../../../../.. +......... cd ../../../../../../../.. +.......... cd ../../../../../../../../.. +........... cd ../../../../../../../../../.. +............ cd ../../../../../../../../../../.. diff --git a/.config/bash/alias b/.config/bash/alias @@ -1,59 +0,0 @@ -alias ls=" \ls --color" -alias l=" \ls --color" -alias la=" \ls --color -a" -alias ll=" \ls --color -lh" -alias lla=" \ls --color -lah" -alias vim=" nvim" -alias vi=" nvim" -alias v=" nvim" -alias xi=" sudo xbps-install" -alias xiu=" sudo xbps-install -S; sudo xbps-install -yu xbps; sudo xbps-install -yu" -alias xq=" sudo xbps-query" -alias xr=" sudo xbps-remove" -alias irssi=" \irssi --config ~/.config/irssi/config" -alias pipes=" \pipes -R -r 10000 -c 10 -c 11 -c 12 -c 13 -c 14 -c 15 -s 15" -alias clock=" tty-clock -s -c -C 7" -alias ytdl=" youtube-dl --add-metadata -ic" -alias ytdla=" youtube-dl --add-metadata -xic" -alias map=" telnet mapscii.me" -alias tetris=" ssh netris.rocketnine.space" -alias calcurse=" \calcurse -D ~/.config/calcurse" -alias irssi=" \irssi --home ~/.config/irssi/ -n haydenh" -alias zsleep=" sudo zzz" -alias hibernate=" sudo ZZZ" -alias rmst=" bash ~/.scripts/random/gnulinux.sh" -alias fff=" bash ~/.config/fff/config" -alias python=" python3" -alias vimb=" \vimb --no-maximize" -alias cleancache=" sudo xbps-remove -Oo; rm -rf ~/.cache ~/.mozilla ~/.local/share/webkitgtk ~/.viminfo ~/.wget-hsts ~/.lesshst ~/.sh_history ~/.python_history ~/.*history ~/.*hst ~/.dbus ~/.sciminfo ~/.viminfo ~/.w3m; sudo vkpurge rm all" -alias mkconfall=" mkmailpass; mkalias" -alias nw=" newsboat" -alias nm=" neomutt" -alias conftar=" cd ~; sshtar .config/ .tmux.conf .terminfo/ .scripts/ .alias .galias .vimrc" -alias maic=" sudo make all install clean" -alias ~d=" cd ~/general/downloads; ls" -alias ~do=" cd ~/general/documents; ls" -alias ~iw=" cd ~/images/wallpapers; ls" -alias ~i=" cd ~/images; ls" -alias ~v=" cd ~/videos; ls" -alias ~m=" cd ~/music; ls" -alias ~w=" cd ~/work; ls" -alias ~c=" cd ~/.config; ls" -alias ~s=" cd ~/.scripts; ls" -alias ~sb=" cd ~/.scripts/bin; ls" -alias ~sbdi=" cd ~/.scripts/bin/display; ls" -alias ~sbdm=" cd ~/.scripts/bin/dmenu; ls" -alias ~sbi=" cd ~/.scripts/bin/i3; ls" -alias ~sbm=" cd ~/.scripts/bin/misc; ls" -alias ~vrc=" vim ~/.vimrc" -alias ..=" cd .." -alias ...=" cd ../.." -alias ....=" cd ../../.." -alias .....=" cd ../../../.." -alias ......=" cd ../../../../.." -alias .......=" cd ../../../../../.." -alias ........=" cd ../../../../../../.." -alias .........=" cd ../../../../../../../.." -alias ..........=" cd ../../../../../../../../.." -alias ...........=" cd ../../../../../../../../../.." -alias ............=" cd ../../../../../../../../../../.." diff --git a/.config/calcurse/conf b/.config/calcurse/conf @@ -1,25 +0,0 @@ -appearance.calendarview=monthly -appearance.compactpanels=no -appearance.defaultpanel=calendar -appearance.layout=1 -appearance.notifybar=yes -appearance.sidebarwidth=1 -appearance.todoview=show-completed -appearance.theme=blue on default -daemon.enable=no -daemon.log=no -format.inputdate=1 -format.notifydate=%a %F -format.notifytime=%T -format.outputdate=%D -general.autogc=no -general.autosave=yes -general.confirmdelete=yes -general.confirmquit=no -general.firstdayofweek=sunday -general.periodicsave=0 -general.progressbar=yes -general.systemdialogs=no -notification.command=printf '\a' -notification.notifyall=flagged-only -notification.warning=300 diff --git a/.config/calcurse/keys b/.config/calcurse/keys @@ -1,55 +0,0 @@ -# -# Calcurse keys configuration file -# -# In this file the keybindings used by Calcurse are defined. -# It is generated automatically by Calcurse and is maintained -# via the key configuration menu of the interactive user -# interface. It should not be edited directly. - -generic-cancel ESC -generic-select SPC -generic-credits @ -generic-help ? -generic-quit q Q -generic-save s S ^S -generic-reload R -generic-copy c -generic-paste p ^V -generic-change-view TAB -generic-import i I -generic-export x X -generic-goto g G -generic-other-cmd o O -generic-config-menu C -generic-redraw ^R -generic-add-appt ^A -generic-add-todo ^T -generic-prev-day T ^H -generic-next-day t ^L -generic-prev-week W ^K -generic-next-week w -generic-prev-month M -generic-next-month m -generic-prev-year Y -generic-next-year y -generic-scroll-down ^N -generic-scroll-up ^P -generic-goto-today ^G -generic-command : -move-right l L RGT -move-left h H LFT -move-down j J DWN -move-up k K UP -start-of-week 0 -end-of-week $ -add-item a A -del-item d D -edit-item e E -view-item v V RET -pipe-item | -flag-item ! -repeat r -edit-note n N -view-note > -raise-priority + -lower-priority - diff --git a/.config/dunst/dunstrc b/.config/dunst/dunstrc @@ -1,46 +0,0 @@ -[global] - monitor = 0 - follow = keyboard - geometry = "350x5+11+20" - indicate_hidden = yes - notification_height = 0 - separator_height = 2 - padding = 15 - horizontal_padding = 15 - frame_width=3 - frame_color = "#0a3439" - separator_color = frame - sort = yes - idle_threshold = 1 - font = Monospace 8 - line_height = 0 - markup = full - format = "<b><u>%s</u></b>\n%b" - alignment = left - show_age_threshold = 10 - word_wrap = yes - ellipsize = middle - ignore_newline = no - stack_duplicates = false - hide_duplicate_count = true - show_indicators = yes - sticky_history = yes - history_length = 20 - title = Dunst - class = Dunst - startup_notification = false - force_xinerama = false -[experimental] - per_monitor_dpi = false -[urgency_low] - background="#141726" - foreground="#ffffff" - frame_color="#0a3439" -[urgency normal] - background="#141726" - foreground="#ffffff" - frame_color="#0a3439" -[urgency critical] - background="#141726" - foreground="#ffffff" - frame_color="#0a3439" diff --git a/.config/fff/config b/.config/fff/config @@ -1 +0,0 @@ -.scripts/bin/i3/ffflaunch -\ No newline at end of file diff --git a/.config/fff/fff b/.config/fff/fff @@ -1 +0,0 @@ -/home/hayden/.config/fff -\ No newline at end of file diff --git a/.config/fish/alias b/.config/fish/alias @@ -1,59 +0,0 @@ -alias ls=" \ls --color" -alias l=" \ls --color" -alias la=" \ls --color -a" -alias ll=" \ls --color -lh" -alias lla=" \ls --color -lah" -alias vim=" nvim" -alias vi=" nvim" -alias v=" nvim" -alias xi=" sudo xbps-install" -alias xiu=" sudo xbps-install -S; sudo xbps-install -yu xbps; sudo xbps-install -yu" -alias xq=" sudo xbps-query" -alias xr=" sudo xbps-remove" -alias irssi=" \irssi --config ~/.config/irssi/config" -alias pipes=" \pipes -R -r 10000 -c 10 -c 11 -c 12 -c 13 -c 14 -c 15 -s 15" -alias clock=" tty-clock -s -c -C 7" -alias ytdl=" youtube-dl --add-metadata -ic" -alias ytdla=" youtube-dl --add-metadata -xic" -alias map=" telnet mapscii.me" -alias tetris=" ssh netris.rocketnine.space" -alias calcurse=" \calcurse -D ~/.config/calcurse" -alias irssi=" \irssi --home ~/.config/irssi/ -n haydenh" -alias zsleep=" sudo zzz" -alias hibernate=" sudo ZZZ" -alias rmst=" bash ~/.scripts/random/gnulinux.sh" -alias fff=" bash ~/.config/fff/config" -alias python=" python3" -alias vimb=" \vimb --no-maximize" -alias cleancache=" sudo xbps-remove -Oo; rm -rf ~/.cache ~/.mozilla ~/.local/share/webkitgtk ~/.viminfo ~/.wget-hsts ~/.lesshst ~/.sh_history ~/.python_history ~/.*history ~/.*hst ~/.dbus ~/.sciminfo ~/.viminfo ~/.w3m; sudo vkpurge rm all" -alias mkconfall=" mkmailpass; mkalias" -alias nw=" newsboat" -alias nm=" neomutt" -alias conftar=" cd ~; sshtar .config/ .tmux.conf .terminfo/ .scripts/ .alias .galias .vimrc" -alias maic=" sudo make all install clean" -alias ~d=" cd ~/general/downloads; ls" -alias ~do=" cd ~/general/documents; ls" -alias ~iw=" cd ~/images/wallpapers; ls" -alias ~i=" cd ~/images; ls" -alias ~v=" cd ~/videos; ls" -alias ~m=" cd ~/music; ls" -alias ~w=" cd ~/work; ls" -alias ~c=" cd ~/.config; ls" -alias ~s=" cd ~/.scripts; ls" -alias ~sb=" cd ~/.scripts/bin; ls" -alias ~sbdi=" cd ~/.scripts/bin/display; ls" -alias ~sbdm=" cd ~/.scripts/bin/dmenu; ls" -alias ~sbi=" cd ~/.scripts/bin/i3; ls" -alias ~sbm=" cd ~/.scripts/bin/misc; ls" -alias ~vrc=" vim ~/.vimrc" -alias ..=" cd .." -alias ...=" cd ../.." -alias ....=" cd ../../.." -alias .....=" cd ../../../.." -alias ......=" cd ../../../../.." -alias .......=" cd ../../../../../.." -alias ........=" cd ../../../../../../.." -alias .........=" cd ../../../../../../../.." -alias ..........=" cd ../../../../../../../../.." -alias ...........=" cd ../../../../../../../../../.." -alias ............=" cd ../../../../../../../../../../.." diff --git a/.config/fish/config.fish b/.config/fish/config.fish @@ -1,41 +0,0 @@ -#Prompt -function fish_prompt - set STRING (pwd | sed "s~$HOME~\~~g" | tr "/" "\n" | cut -c 1-3 | tr "\n" "/") - tput setaf 2 - printf "[" - tput setaf 3 - printf $USER - tput setaf 4 - printf "@" - tput setaf 5 - printf $hostname - tput setaf 6 - printf " "$STRING - tput setaf 2 - printf "]" - tput setaf 11 - printf "\$ " -end - -#Aliases -source ~/.config/fish/alias - -#Set fish colors -set fish_color_command a84b8d -set fish_color_autosuggestion 86296b -set fish_color_quote 3ab475 - -#Set LS colors -set -x LS_COLORS "di=35:fi=0:ln=33:ex=91;01:*.sh=91:*.html=92:*.css=97:*.md=97:*.yml=93:*.c=94:*.h=94:*.h.orig=94;01:*.h.rej=94;01:*.mk=96:*LICENSE=90:*Makefile=90:*README=97:*.c.orig=94;01:*.c.rej=94;01:*.png=95:*.jpg=95:*.heic=95:*.heif=95:*.mp3=95;01:*.opus=.95;01:*.m4a=95;01:*.flac=95;01:*.wav=95;01:*.mp4=95;04:*.mkv=95;04:*.webm=95;04" - - -#Frame buffer -abbr -a -g video mpv $argv --vo=drm -abbr -a -g music mpv $argv --vo=drm --pause - -fish_vi_key_bindings - -function hostfile - set name (curl -F "file=@$argv" http://0x0.st) - echo "Your file has been hosted at $name" -end diff --git a/.config/galias b/.config/galias @@ -0,0 +1,15 @@ +... ../.. +.... ../../.. +..... ../../../.. +...... ../../../../.. +....... ../../../../../.. +........ ../../../../../../.. +......... ../../../../../../../.. +.......... ../../../../../../../../.. +........... ../../../../../../../../../.. +............ ../../../../../../../../../../.. +om origin master +o origin +gm github master +g github +aic all install clean diff --git a/.config/i3/config b/.config/i3/config @@ -1,300 +0,0 @@ -# -# i3/config -# Created by Hayden Hamilton -# -# haydenvh.com -# Copyright (c) 2019 Hayden Hamilton. LICENSE:GPLv2 ../../.licenses/gplv2.license -# - -##Loading Xresources with XRDB -exec xrdb ~/.Xresources - -##Setting font -font pango:monospace 8 - -##Setting variables -set $mod Mod4 -set $terminal st -set $browser vimb -set $alt mod1 -exec export BROWSER="surf" -exec export EDITOR="vim" -exec_always export SUDO_ASKPASS="$HOME/.scripts/bin/dmenu/daskpass" - -##Setting gaps -gaps inner 10 -for_window [class="^.*"] border pixel 0 - -##Setting Xresources -set_from_resource $foreground foreground #343c62 -set_from_resource $background background #090711 -set_from_resource $black color0 #141726 -set_from_resource $black2 color8 #dc6f3c -set_from_resource $red color1 #24283c -set_from_resource $red2 color9 #4747e1 -set_from_resource $green color2 #31364b -set_from_resource $green2 color10 #892b2b -set_from_resource $yellow color3 #40445c -set_from_resource $yellow2 color11 #a1a1d9 -set_from_resource $blue color4 #575b72 -set_from_resource $blue2 color12 #658a1f -set_from_resource $magenta color5 #777b8e -set_from_resource $magenta2 color13 #ea74c7 -set_from_resource $cyan color6 #a3a6b3 -set_from_resource $cyan2 color14 #cfcfcf -set_from_resource $white color7 #c7cad9 -set_from_resource $white2 color15 #3ab475 - -##Setting bar -bar{ - font pango:monospace 7 - i3bar_command "sleep 2;i3bar" - status_command i3blocks - position top - id bar-1 - mode dock - modifier none - separator_symbol " " - colors { - background $background - statusline #eeddee - focused_workspace $background #ffffff #000000 - active_workspace $background $background #ffffff - inactive_workspace $background $background #ffffff - urgent_workspace $background #ffffff #990000 - } - #bindsym button1 nop - tray_output none -} -bar{ - font pango:monospace 7 - status_command i3blocks -c .config/i3blocks/config2 - position top - id bar-2 - mode dock - modifier none - workspace_buttons no - separator_symbol " " - colors { - background $background - statusline #eeddee - } - #bindsym button1 nop - tray_output none -} - -##Setting workspace names -set $ws1 "[1.WWW]" -set $ws2 "[2.DEV]" -set $ws3 "[3.DEV]" -set $ws4 "[4.DEV]" -set $ws5 "[5.DEV]" -set $ws6 "[6.SYS]" -set $ws7 "[7.SYS]" -set $ws8 "[8.IRC]" -set $ws9 "[9.GFX]" -set $ws10 "[0.MSC]" - -##Change workspace -bindsym $mod+1 workspace $ws1 -bindsym $mod+2 workspace $ws2 -bindsym $mod+3 workspace $ws3 -bindsym $mod+4 workspace $ws4 -bindsym $mod+5 workspace $ws5 -bindsym $mod+6 workspace $ws6 -bindsym $mod+7 workspace $ws7 -bindsym $mod+8 workspace $ws8 -bindsym $mod+9 workspace $ws9 -bindsym $mod+0 workspace $ws10 - -##Move container to workspace & change -bindsym $mod+shift+1 exec moveone "$ws1" -bindsym $mod+shift+2 exec moveone "$ws2" -bindsym $mod+shift+3 exec moveone "$ws3" -bindsym $mod+shift+4 exec moveone "$ws4" -bindsym $mod+shift+5 exec moveone "$ws5" -bindsym $mod+shift+6 exec moveone "$ws6" -bindsym $mod+shift+7 exec moveone "$ws7" -bindsym $mod+shift+8 exec moveone "$ws8" -bindsym $mod+shift+9 exec moveone "$ws9" -bindsym $mod+shift+0 exec moveone "$ws10" - -##Move entire workspace & change -bindsym $mod+ctrl+1 exec moveentire "$ws1" -bindsym $mod+ctrl+2 exec moveentire "$ws2" -bindsym $mod+ctrl+3 exec moveentire "$ws3" -bindsym $mod+ctrl+4 exec moveentire "$ws4" -bindsym $mod+ctrl+5 exec moveentire "$ws5" -bindsym $mod+ctrl+6 exec moveentire "$ws6" -bindsym $mod+ctrl+7 exec moveentire "$ws7" -bindsym $mod+ctrl+8 exec moveentire "$ws8" -bindsym $mod+ctrl+9 exec moveentire "$ws9" -bindsym $mod+ctrl+0 exec moveentire "$ws10" - -##Move container to workspace -#bindsym $mod+Mod4+1 move container to workspace $ws1 -bindsym $mod+Mod1+2 move container to workspace $ws2 -bindsym $mod+Mod1+3 move container to workspace $ws3 -bindsym $mod+Mod1+4 move container to workspace $ws4 -bindsym $mod+Mod1+5 move container to workspace $ws5 -bindsym $mod+Mod1+6 move container to workspace $ws6 -bindsym $mod+Mod1+7 move container to workspace $ws7 -bindsym $mod+Mod1+8 move container to workspace $ws8 -bindsym $mod+Mod1+9 move container to workspace $ws9 -bindsym $mod+Mod1+0 move container to workspace $ws10 - -##Outputs for workspaces -workspace $ws1 output VGA1 -workspace $ws2 output LVDS1 -workspace "TEMPORARY" output VGA1 - -##Setting windows to workspaces -assign [class="Gimp"] $ws9 -assign [class="Vimb"] $ws1 -assign [class="URxvt" instance="irssi"] $ws8 - -##Window rule -for_window [class="URxvt" instance="fileman"] floating enable; sticky enable - -##Movement bindings -bindsym $mod+h focus left -bindsym $mod+shift+h move left -bindsym $mod+ctrl+h resize shrink width 5px or 5ppt -bindsym $mod+j focus down -bindsym $mod+shift+j move down -bindsym $mod+ctrl+j resize shrink height 5px or 5ppt -bindsym $mod+k focus up -bindsym $mod+shift+k move up -bindsym $mod+ctrl+k resize grow height 5px or 5ppt -bindsym $mod+l focus right -bindsym $mod+shift+l move right -bindsym $mod+ctrl+l resize grow width 5px or 5ppt - -##Symbol bindings -bindsym $mod+shift+space floating toggle -bindsym $mod+space focus mode_toggle -bindsym $mod+Return exec $terminal -bindsym $mod+shift+Return exec $terminal -e tty-clock -s -c -C 7 -b -bindsym $mod+Escape exec userinput "Do you want to quit i3?" "sudo -A i3-msg exit" -bindsym $mod+shift+Escape exec userinput "Do you want to shutdown?" "sudo -A halt" -bindsym $mod+ctrl+Escape exec userinput "Do you want to reboot?" "sudo -A reboot" -bindsym $mod+bracketleft exec userinput "Do you want to suspend?" "sudo -A zzz" -bindsym $mod+shift+bracketleft exec userinput "Do you want to hibernate?" "sudo -A ZZZ" - -##Letter bindings -bindsym $mod+q scratchpad show -bindsym $mod+shift+q kill -bindsym $mod+w exec rfeh ~/.wallpapers/ -bindsym $mod+shift+w exec fehffile ~/.wall -bindsym $mod+ctrl+w exec wallblur true -bindsym $mod+$alt+w exec fehffile ~/.cache/rfeh/prev -bindsym $mod+e exec $terminal -e dvimedit -bindsym $mod+shift+e exec $terminal -e dvimedit -bindsym $mod+r exec $terminal -n fileman -e dfm fm -bindsym $mod+shift+r restart -bindsym $mod+t layout tabbed -bindsym $mod+shift+t layout toggle split -bindsym $mod+y exec $terminal -n irssi -e irssi --home ~/.config/irssi/ -bindsym $mod+shift+y exec dircgetpass -bindsym $mod+u exec wallvar ~/.wallpapers/ 60; exec dunstify "Auto-changing wallpapers on." -bindsym $mod+shift+u exec killall wallvar; exec dunstify "Auto-changing wallpapers off." -bindsym $mod+i exec $terminal -n fileman -e ffflaunch -bindsym $mod+shift+i exec $terminal -n fileman -e ffflaunch -bindsym $mod+o exec makegrid $TERMINAL -##bindsym $mod+super+o -bindsym $mod+p focus parent -bindsym $mod+shift+p focus child -bindsym $mod+a exec screenkey -bindsym $mod+shift+a exec killall screenkey -bindsym $mod+s exec dpass -bindsym $mod+shift+s exec dpass -bindsym $mod+d exec dmenu_run -bindsym $mod+shift+d exec dmenu_run -bindsym $mod+f fullscreen toggle -bindsym $mod+shift+f fullscreen toggle -bindsym $mod+g exec $terminal -name newsboat -e newsboat -bindsym $mod+shift+g exec $terminal -name calcurse -e calcurse -D ~/.config/calcurse -##HJKL in movement bindings -bindsym $mod+z split v -bindsym $mod+shift+z split v -bindsym $mod+x split h -bindsym $mod+shift+x split h -bindsym $mod+c exec locker /tmp/mpv-socket2 /tmp/mpv-socket -bindsym $mod+shift+c exec $terminal -e slock_mod /tmp/mpv-socket2 /tmp/mpv-socket -bindsym $mod+v workspace "TEMPORARY" -bindsym $mod+shift+v exec killall mpv -bindsym $mod+b exec vimb --no-maximize -bindsym $mod+shift+b exec dmpvurl /tmp/mpv-socket /tmp/mpv-socket2 -##bindsym $mod+n -##bindsym $mod+shift+n -bindsym $mod+m exec dmount -bindsym $mod+shift+m exec dumount - -##Starting scripts/programs -exec monitors.sh -exec bash ~/.scripts/input/keyboard -exec picom --config .config/picom/config -b -f -exec bash ~/.scripts/input/language -exec dunst --config ~/.config/dunst/config -exec nm-applet & -exec urxvtd -f -o -q -exec mpvlisten /tmp/mpv-socket2 /tmp/mpv-socket -exec fehffile ~/.wall.png -exec_always notify-send "i3 restarted. Press Super(windows key)+F1 to open the manual." -exec_always brightnessctl s 100% -exec_always crefresh -exec scratcher - -##Setting colors for tabbed windows -#class #border #background #text -client.focused $yellow $red $white -client.unfocused $yellow $background $white -client.focused_inactive $yellow $background $white -client.placeholder $yellow $background $white -client.urgent $yellow $background $yellow2 - -##Setting volume -bindsym XF86AudioRaiseVolume exec hvol 3.5%+ -bindsym $mod+plus exec hvol 3.5%+ -bindsym $mod+minus exec hvol 3.5%- -bindsym XF86AudioLowerVolume exec hvol 3.5%- -bindsym XF86AudioMute exec hvol toggle - -##Setting brightness -bindsym XF86MonBrightnessUp exec brightnessctl --quiet set +5% -bindsym XF86MonBrightnessDown exec brightnessctl --quiet set -5% - -##Function bindings (hmpv) -bindsym F8 exec dmpv videos /tmp/mpv-socket2 /tmp/mpv-socket --fs fuzz -bindsym shift+F8 exec rmpv videos 50 -bindsym F9 exec dmpv music /tmp/mpv-socket /tmp/mpv-socket2 --no-video fuzz -bindsym shift+F9 exec rmpv music 50 -bindsym F10 exec hmpv back /tmp/mpv-socket -bindsym shift+F10 exec hmpv prev /tmp/mpv-socket -bindsym F11 exec hmpv toggle /tmp/mpv-socket; exec hmpv toggle /tmp/mpv-socket2 -bindsym shift+F11 exec hmpv quit /tmp/mpv-socket -bindsym F12 exec hmpv forward /tmp/mpv-socket -bindsym shift+F12 exec hmpv next /tmp/mpv-socket -bindsym Home exec brightnessctl s +500000 -bindsym End exec brightnessctl s 500000- - -###Same, but for 60% keyboards -bindsym $mod+ctrl+y exec dmpv videos /tmp/mpv-socket2 /tmp/mpv-socket --fs fuzz -bindsym $mod+$alt+y exec rmpv videos 50 -bindsym $mod+ctrl+u exec dmpv music /tmp/mpv-socket /tmp/mpv-socket2 --no-video fuzz -bindsym $mod+$alt+u exec rmpv music 50 -bindsym $mod+ctrl+i exec hmpv back /tmp/mpv-socket -bindsym $mod+$alt+i exec hmpv prev /tmp/mpv-socket -bindsym $mod+ctrl+o exec hmpv toggle /tmp/mpv-socket; exec hmpv toggle /tmp/mpv-socket2 -bindsym $mod+$alt+o exec hmpv quit /tmp/mpv-socket -bindsym $mod+ctrl+p exec hmpv forward /tmp/mpv-socket -bindsym $mod+$alt+p exec hmpv next /tmp/mpv-socket -bindsym $mod+ctrl+t exec brightnessctl s +500000 -bindsym $mod+$alt+t exec brightnessctl s 500000- - - -##i3 related commands -focus_follows_mouse no -mouse_warping none -popup_during_fullscreen ignore -focus_on_window_activation urgent diff --git a/.config/i3blocks/config b/.config/i3blocks/config @@ -1,47 +0,0 @@ -command=~/.scripts/i3blocks/$BLOCK_NAME -separator_block_width=7 -markup=none -border_bottom=2 -border_top=0 -border_left=0 -border_right=0 - -[vol] -interval=1 -border=#218888 - -[net] -interval=50 -border=#4da0c6 - -[mem] -interval=1 -border=#007dc1 - -[disk] -interval=100 -border=#0f6bd3 - -[disk2] -interval=1 -border=#3157b5 - -[cpu] -interval=1 -border=#7525c8 - -[bat] -interval=30 -border=#c625c8 - -[time] -interval=150 -border=#ff7777 - -[time2] -interval=1 -border=#ff303b - -[host] -interval=10000 -border=#ff003b diff --git a/.config/i3blocks/config2 b/.config/i3blocks/config2 @@ -1,31 +0,0 @@ -command=~/.scripts/i3blocks/$BLOCK_NAME -separator_block_width=7 -markup=none -border_bottom=2 -border_top=0 -border_left=0 -border_right=0 - -[mpv] -interval=1 -border=#666b1b - -[title] -interval=1 -border=#4a6b1b - -[cal] -interval=30 -border=#236b1b - -[news] -interval=30 -border=#498364 - -[weather2] -interval=1 -border=#249980 - -[weather] -interval=50 -border=#249980 diff --git a/.config/i3blocks/i3blocks b/.config/i3blocks/i3blocks @@ -1 +0,0 @@ -/home/hayden/.config/i3blocks/ -\ No newline at end of file diff --git a/.config/irssi/config b/.config/irssi/config @@ -22,19 +22,16 @@ chatnets = { }; channels = ( { name = "#voidlinux"; chatnet = "Freenode"; autojoin = "Yes"; }, - { name = "#staw"; chatnet = "Freenode"; autojoin = "Yes"; }, - { name = "#freenode"; chatnet = "Freenode"; autojoin = "No"; }, - { name = "#irssi"; chatnet = "Freenode"; autojoin = "No"; }, - { name = "#neomutt"; chatnet = "Freenode"; autojoin = "Yes"; }, { name = "#GNU/matrix"; chatnet = "Freenode"; autojoin = "Yes"; }, - { name = "#i3"; chatnet = "Freenode"; autojoin = "Yes"; }, - { - name = "#archlinux-offtopic"; - chatnet = "Freenode"; - autojoin = "Yes"; - }, { name = "#GNU/matrix"; chatnet = "Rizon"; autojoin = "Yes"; }, + { name = "#staw"; chatnet = "Freenode"; autojoin = "Yes"; }, + { name = "#neomutt"; chatnet = "Freenode"; autojoin = "Yes"; }, { name = "#cat-v"; chatnet = "Freenode"; autojoin = "Yes"; } + { name = "#archlinux-offtopic"; chatnet = "Freenode"; autojoin = "Yes"; }, + { name = "#vim"; chatnet = "Freenode"; autojoin = "Yes"; } + { name = "#neovim"; chatnet = "Freenode"; autojoin = "Yes"; } + { name = "#voidlinux-offtopic"; chatnet = "Freenode"; autojoin = "Yes"; }, + { name = "#i3"; chatnet = "Freenode"; autojoin = "Yes"; }, ); aliases = { ATAG = "WINDOW SERVER"; @@ -196,16 +193,12 @@ statusbar = { items = { barstart = "{sbstart}"; barend = "{sbend}"; - topicbarstart = "{topicsbstart}"; - topicbarend = "{topicsbend}"; - time = "{sb $Z}"; user = "{sb {sbnickmode $cumode}$N{sbmode $usermode}{sbaway $A}}"; window = "{sb $winref:$tag/$itemname{sbmode $M}}"; window_empty = "{sb $winref{sbservertag $tag}}"; prompt = "{prompt $[.15]itemname}"; prompt_empty = "{prompt $winname}"; topic = " $topic"; - topic_empty = " Irssi v$J - http://www.irssi.org"; lag = "{sb Lag: $0-}"; act = "{sb Act: $0-}"; more = "-- more --"; @@ -219,11 +212,6 @@ statusbar = { visible = "active"; items = { barstart = { priority = "100"; }; - time = { }; - user = { }; - window = { }; - window_empty = { }; - lag = { priority = "-1"; }; act = { priority = "10"; }; more = { priority = "-1"; alignment = "right"; }; barend = { priority = "100"; alignment = "right"; }; @@ -237,7 +225,6 @@ statusbar = { items = { barstart = { priority = "100"; }; window = { }; - window_empty = { }; more = { priority = "-1"; alignment = "right"; }; barend = { priority = "100"; alignment = "right"; }; }; @@ -253,32 +240,19 @@ statusbar = { input = { priority = "10"; }; }; }; - topic = { - type = "root"; - placement = "top"; - position = "1"; - visible = "always"; - items = { - topicbarstart = { priority = "100"; }; - topic = { }; - topic_empty = { }; - topicbarend = { priority = "100"; alignment = "right"; }; - }; - }; }; }; settings = { core = { real_name = "haydenh"; user_name = "haydenh"; - nick = "hhhhv"; + nick = "haydenh"; recode_transliterate = "no"; timestamp_format = "%H:%M:%S"; }; "fe-text" = { actlist_sort = "refnum"; }; "fe-common/core" = { theme = "pipeline"; - autolog_path = "~/.irc.log"; autolog = "yes"; }; "perl/core/scripts" = { @@ -287,5 +261,3 @@ settings = { }; "irc/core" = { alternate_nick = "haydenh_"; }; }; - -logs = { }; diff --git a/.config/irssi/pipeline.theme b/.config/irssi/pipeline.theme @@ -9,6 +9,8 @@ # # Author: Beau Hastings <beausy@gmail.com> # URL: https://github.com/hastinbe/irssi-theme-pipeline +# +# Modified by: Hayden Hamilton <hayden@haydenvh.com> replaces = { "/[]=" = "%K$*%n"; "*@+." = "%B$*%n"; }; @@ -25,8 +27,8 @@ abstracts = { line_start = ""; # timestamp styling, nothing by default - timestamp = "%B$*%n"; - #timestamp = "%y$*%n"; + # timestamp = "%B$*%n"; # shown + timestamp = ""; #hidden # any kind of text that needs hilighting, default is to bold hilight = "%_$*%_"; @@ -210,13 +212,13 @@ abstracts = { ## # background of statusbar - sb_background = "%0"; + sb_background = "%N"; # default statusbar item style - sb = "%B[%W$*%B]%n"; + sb = "%m[%G$*%m]%n"; sbmode = " %b+%n$*"; - sbaway = " (%Baway%n)"; + sbaway = " (%Gaway%n)"; sbservertag = ":%W$0"; sbmore = "%_-- more --%_"; sblag = "{sb L: %B$*}"; @@ -227,11 +229,11 @@ abstracts = { # usercount sb_usercount = "{sb %W$0%n $1-}"; - sb_uc_ircops = "%_*%_%K/%R$*%n"; - sb_uc_ops = "%_@%_%K/%G$*%n"; - sb_uc_halfops = "%_=%_%K/%g$*%n"; - sb_uc_voices = "%_+%_%K/%Y$*%n"; - sb_uc_normal = "%_.%_%K/%W$*%n"; + sb_uc_ircops = "%_.*%_%G/%G$*%n"; + sb_uc_ops = "%_.@%_%G/%G$*%n"; + sb_uc_halfops = "%_.=%_%G/%g$*%n"; + sb_uc_voices = "%_.+%_%G/%Y$*%n"; + sb_uc_normal = "%_.%_%G/%W$*%n"; sb_uc_space = " "; }; @@ -240,11 +242,11 @@ abstracts = { formats = { "fe-common/core" = { pubmsg = "{pubmsgnick $2 {pubnick $[-16]0}}$1"; - join = " %_%Bjoin%_%K |%n %g{channick_hilight $0}%K!%n{chanhost_hilight $1}"; - part = " %_%Bpart%_%K |%n %W{channick $0}%K!%n{chanhost $1}: {reason $3}"; - kick = " %_%Bkick%_%K |%n %r{channick $0} %nby {nick $2} from {channel $1}: {reason $3}"; - quit = " %_%Bquit%_%K |%n %W{channick $0}%K!%n{chanhost $1}: {reason $2}"; - nick_changed = " %_%Bnick%_%K |%n {nick %w$0%n} %Nis now {nick %W$1%n}"; + join = " %_%B--->%_%K |%n %g{channick_hilight $0}%K!%n{chanhost_hilight $1}"; + part = " %_%G<---%_%K |%n %W{channick $0}%K!%n{chanhost $1}: {reason $3}"; + kick = " %_%G<<<!%_%K |%n %r{channick $0} %nby {nick $2} from {channel $1}: {reason $3}"; + quit = " %_%G<<--%_%K |%n %W{channick $0}%K!%n{chanhost $1}: {reason $2}"; + nick_changed = " %_%Bnick%_%K |%n {nick %w$0%n} %Nis now {nick %W$1%n}"; endofnames = "{channel $0}: {hilight $1} nicks ({comment @/{hilight $2} +/{hilight $3} -/{hilight $4}})"; own_msg = "{ownmsgnick $2 {ownnick $[-16]0}}$1"; own_msg_channel = "{ownmsgnick $3 {ownnick $[-16]0}{msgchannel $1}}$2"; @@ -252,15 +254,15 @@ formats = { pubmsg_me_channel = "{pubmsgmenick $3 {menick $[-16]0}{msgchannel $1}}$2"; pubmsg_hilight = "{pubmsghinick $0 $3 $[-16]1}$2"; pubmsg_channel = "{pubmsgnick $3 {pubnick $[-16]0}{msgchannel $1}}$2"; - chanmode_change = " %_%Bmode%_%K |%n {$channel $0} %W{channick_hilight $2} %nsets mode %B{$mode $1}"; - channel_mode = " %_%Bmode%_%K |%n {$channel $0} %W{channick_hilight $2} %nsets mode %B{$mode $1}"; + chanmode_change = " %_%Bmode%_%K |%n {$channel $0} %W{channick_hilight $2} %nsets mode %B{$mode $1}"; + channel_mode = " %_%Bmode%_%K |%n {$channel $0} %W{channick_hilight $2} %nsets mode %B{$mode $1}"; }; "fe-common/text" = { window_info_sticky = "%# Sticky : $0"; }; "fe-common/irc" = { - chanmode_change = " %_%Bmode%_%K |%n %y{channick_hilight $2} %nsets mode %b{$mode $1} %non {$channelhilight $0}"; + chanmode_change = " %_%Bmode%_%K |%n %y{channick_hilight $2} %nsets mode %b{$mode $1} %non {$channelhilight $0}"; whois = "{hilight $0} [{nickhost $1@$2}] [$whois_country]%: ircname : $3"; server_chanmode_change = "{netsplit ServerMode}/{channelhilight $0}: {mode $1} by {nick $2}"; - whois_server = " server : $1 ({comment $2})"; + whois_server = "server : $1 ({comment $2})"; own_action = "{ownaction $0}%|$1"; action_public = "{pubaction $0}%|$1"; }; diff --git a/.config/mpd/mpd.conf b/.config/mpd/mpd.conf @@ -1,19 +0,0 @@ -music_directory "~/music" -db_file "~/.config/mpd/database" -log_file "~/.config/mpd/log" -playlist_directory "~/.config/mpd/playlists" -pid_file "~/.config/mpd/pid" -state_file "~/.config/mpd/state" -sticker_file "~/.config/mpd/sticker.sql" - -auto_update "yes" - -bind_to_address "127.0.0.1" -restore_paused "yes" -max_output_buffer_size "16384" - -audio_output { - type "alsa" - name "ALSA" - device "hw:0" -} diff --git a/.config/neofetch/config.conf b/.config/neofetch/config.conf @@ -1,764 +0,0 @@ -# See this wiki page for more info: -# https://github.com/dylanaraps/neofetch/wiki/Customizing-Info -print_info() { - info title - info underline - - info "OS" distro - info "Host" model - info "Kernel" kernel - info "Uptime" uptime - info "Packages" packages - info "Shell" shell - info "Resolution" resolution - info "DE" de - info "WM" wm - info "WM Theme" wm_theme - info "Theme" theme - info "Icons" icons - info "Terminal" term - info "Terminal Font" term_font - info "CPU" cpu - info "GPU" gpu - info "Memory" memory - - # info "GPU Driver" gpu_driver # Linux/macOS only - # info "CPU Usage" cpu_usage - # info "Disk" disk - # info "Battery" battery - # info "Font" font - # info "Song" song - # [[ "$player" ]] && prin "Music Player" "$player" - # info "Local IP" local_ip - # info "Public IP" public_ip - # info "Users" users - # info "Locale" locale # This only works on glibc systems. - - info cols -} - - -# Kernel - - -# Shorten the output of the kernel function. -# -# Default: 'on' -# Values: 'on', 'off' -# Flag: --kernel_shorthand -# Supports: Everything except *BSDs (except PacBSD and PC-BSD) -# -# Example: -# on: '4.8.9-1-ARCH' -# off: 'Linux 4.8.9-1-ARCH' -kernel_shorthand="on" - - -# Distro - - -# Shorten the output of the distro function -# -# Default: 'off' -# Values: 'on', 'tiny', 'off' -# Flag: --distro_shorthand -# Supports: Everything except Windows and Haiku -distro_shorthand="off" - -# Show/Hide OS Architecture. -# Show 'x86_64', 'x86' and etc in 'Distro:' output. -# -# Default: 'on' -# Values: 'on', 'off' -# Flag: --os_arch -# -# Example: -# on: 'Arch Linux x86_64' -# off: 'Arch Linux' -os_arch="on" - - -# Uptime - - -# Shorten the output of the uptime function -# -# Default: 'on' -# Values: 'on', 'tiny', 'off' -# Flag: --uptime_shorthand -# -# Example: -# on: '2 days, 10 hours, 3 mins' -# tiny: '2d 10h 3m' -# off: '2 days, 10 hours, 3 minutes' -uptime_shorthand="on" - - -# Memory - - -# Show memory pecentage in output. -# -# Default: 'off' -# Values: 'on', 'off' -# Flag: --memory_percent -# -# Example: -# on: '1801MiB / 7881MiB (22%)' -# off: '1801MiB / 7881MiB' -memory_percent="off" - - -# Packages - - -# Show/Hide Package Manager names. -# -# Default: 'tiny' -# Values: 'on', 'tiny' 'off' -# Flag: --package_managers -# -# Example: -# on: '998 (pacman), 8 (flatpak), 4 (snap)' -# tiny: '908 (pacman, flatpak, snap)' -# off: '908' -package_managers="on" - - -# Shell - - -# Show the path to $SHELL -# -# Default: 'off' -# Values: 'on', 'off' -# Flag: --shell_path -# -# Example: -# on: '/bin/bash' -# off: 'bash' -shell_path="off" - -# Show $SHELL version -# -# Default: 'on' -# Values: 'on', 'off' -# Flag: --shell_version -# -# Example: -# on: 'bash 4.4.5' -# off: 'bash' -shell_version="on" - - -# CPU - - -# CPU speed type -# -# Default: 'bios_limit' -# Values: 'scaling_cur_freq', 'scaling_min_freq', 'scaling_max_freq', 'bios_limit'. -# Flag: --speed_type -# Supports: Linux with 'cpufreq' -# NOTE: Any file in '/sys/devices/system/cpu/cpu0/cpufreq' can be used as a value. -speed_type="bios_limit" - -# CPU speed shorthand -# -# Default: 'off' -# Values: 'on', 'off'. -# Flag: --speed_shorthand -# NOTE: This flag is not supported in systems with CPU speed less than 1 GHz -# -# Example: -# on: 'i7-6500U (4) @ 3.1GHz' -# off: 'i7-6500U (4) @ 3.100GHz' -speed_shorthand="off" - -# Enable/Disable CPU brand in output. -# -# Default: 'on' -# Values: 'on', 'off' -# Flag: --cpu_brand -# -# Example: -# on: 'Intel i7-6500U' -# off: 'i7-6500U (4)' -cpu_brand="on" - -# CPU Speed -# Hide/Show CPU speed. -# -# Default: 'on' -# Values: 'on', 'off' -# Flag: --cpu_speed -# -# Example: -# on: 'Intel i7-6500U (4) @ 3.1GHz' -# off: 'Intel i7-6500U (4)' -cpu_speed="on" - -# CPU Cores -# Display CPU cores in output -# -# Default: 'logical' -# Values: 'logical', 'physical', 'off' -# Flag: --cpu_cores -# Support: 'physical' doesn't work on BSD. -# -# Example: -# logical: 'Intel i7-6500U (4) @ 3.1GHz' (All virtual cores) -# physical: 'Intel i7-6500U (2) @ 3.1GHz' (All physical cores) -# off: 'Intel i7-6500U @ 3.1GHz' -cpu_cores="logical" - -# CPU Temperature -# Hide/Show CPU temperature. -# Note the temperature is added to the regular CPU function. -# -# Default: 'off' -# Values: 'C', 'F', 'off' -# Flag: --cpu_temp -# Supports: Linux, BSD -# NOTE: For FreeBSD and NetBSD-based systems, you'll need to enable -# coretemp kernel module. This only supports newer Intel processors. -# -# Example: -# C: 'Intel i7-6500U (4) @ 3.1GHz [27.2°C]' -# F: 'Intel i7-6500U (4) @ 3.1GHz [82.0°F]' -# off: 'Intel i7-6500U (4) @ 3.1GHz' -cpu_temp="off" - - -# GPU - - -# Enable/Disable GPU Brand -# -# Default: 'on' -# Values: 'on', 'off' -# Flag: --gpu_brand -# -# Example: -# on: 'AMD HD 7950' -# off: 'HD 7950' -gpu_brand="on" - -# Which GPU to display -# -# Default: 'all' -# Values: 'all', 'dedicated', 'integrated' -# Flag: --gpu_type -# Supports: Linux -# -# Example: -# all: -# GPU1: AMD HD 7950 -# GPU2: Intel Integrated Graphics -# -# dedicated: -# GPU1: AMD HD 7950 -# -# integrated: -# GPU1: Intel Integrated Graphics -gpu_type="all" - - -# Resolution - - -# Display refresh rate next to each monitor -# Default: 'off' -# Values: 'on', 'off' -# Flag: --refresh_rate -# Supports: Doesn't work on Windows. -# -# Example: -# on: '1920x1080 @ 60Hz' -# off: '1920x1080' -refresh_rate="off" - - -# Gtk Theme / Icons / Font - - -# Shorten output of GTK Theme / Icons / Font -# -# Default: 'off' -# Values: 'on', 'off' -# Flag: --gtk_shorthand -# -# Example: -# on: 'Numix, Adwaita' -# off: 'Numix [GTK2], Adwaita [GTK3]' -gtk_shorthand="off" - - -# Enable/Disable gtk2 Theme / Icons / Font -# -# Default: 'on' -# Values: 'on', 'off' -# Flag: --gtk2 -# -# Example: -# on: 'Numix [GTK2], Adwaita [GTK3]' -# off: 'Adwaita [GTK3]' -gtk2="on" - -# Enable/Disable gtk3 Theme / Icons / Font -# -# Default: 'on' -# Values: 'on', 'off' -# Flag: --gtk3 -# -# Example: -# on: 'Numix [GTK2], Adwaita [GTK3]' -# off: 'Numix [GTK2]' -gtk3="on" - - -# IP Address - - -# Website to ping for the public IP -# -# Default: 'http://ident.me' -# Values: 'url' -# Flag: --ip_host -public_ip_host="http://ident.me" - -# Public IP timeout. -# -# Default: '2' -# Values: 'int' -# Flag: --ip_timeout -public_ip_timeout=2 - - -# Disk - - -# Which disks to display. -# The values can be any /dev/sdXX, mount point or directory. -# NOTE: By default we only show the disk info for '/'. -# -# Default: '/' -# Values: '/', '/dev/sdXX', '/path/to/drive'. -# Flag: --disk_show -# -# Example: -# disk_show=('/' '/dev/sdb1'): -# 'Disk (/): 74G / 118G (66%)' -# 'Disk (/mnt/Videos): 823G / 893G (93%)' -# -# disk_show=('/'): -# 'Disk (/): 74G / 118G (66%)' -# -disk_show=('/') - -# Disk subtitle. -# What to append to the Disk subtitle. -# -# Default: 'mount' -# Values: 'mount', 'name', 'dir' -# Flag: --disk_subtitle -# -# Example: -# name: 'Disk (/dev/sda1): 74G / 118G (66%)' -# 'Disk (/dev/sdb2): 74G / 118G (66%)' -# -# mount: 'Disk (/): 74G / 118G (66%)' -# 'Disk (/mnt/Local Disk): 74G / 118G (66%)' -# 'Disk (/mnt/Videos): 74G / 118G (66%)' -# -# dir: 'Disk (/): 74G / 118G (66%)' -# 'Disk (Local Disk): 74G / 118G (66%)' -# 'Disk (Videos): 74G / 118G (66%)' -disk_subtitle="mount" - - -# Song - - -# Manually specify a music player. -# -# Default: 'auto' -# Values: 'auto', 'player-name' -# Flag: --music_player -# -# Available values for 'player-name': -# -# amarok -# audacious -# banshee -# bluemindo -# clementine -# cmus -# deadbeef -# deepin-music -# dragon -# elisa -# exaile -# gnome-music -# gmusicbrowser -# gogglesmm -# guayadeque -# iTunes -# juk -# lollypop -# mocp -# mopidy -# mpd -# netease-cloud-music -# pogo -# pragha -# qmmp -# quodlibet -# rhythmbox -# sayonara -# smplayer -# spotify -# strawberry -# tomahawk -# vlc -# xmms2d -# xnoise -# yarock -music_player="auto" - -# Format to display song information. -# -# Default: '%artist% - %album% - %title%' -# Values: '%artist%', '%album%', '%title%' -# Flag: --song_format -# -# Example: -# default: 'Song: Jet - Get Born - Sgt Major' -song_format="%artist% - %album% - %title%" - -# Print the Artist, Album and Title on separate lines -# -# Default: 'off' -# Values: 'on', 'off' -# Flag: --song_shorthand -# -# Example: -# on: 'Artist: The Fratellis' -# 'Album: Costello Music' -# 'Song: Chelsea Dagger' -# -# off: 'Song: The Fratellis - Costello Music - Chelsea Dagger' -song_shorthand="off" - -# 'mpc' arguments (specify a host, password etc). -# -# Default: '' -# Example: mpc_args=(-h HOST -P PASSWORD) -mpc_args=() - - -# Text Colors - - -# Text Colors -# -# Default: 'distro' -# Values: 'distro', 'num' 'num' 'num' 'num' 'num' 'num' -# Flag: --colors -# -# Each number represents a different part of the text in -# this order: 'title', '@', 'underline', 'subtitle', 'colon', 'info' -# -# Example: -# colors=(distro) - Text is colored based on Distro colors. -# colors=(4 6 1 8 8 6) - Text is colored in the order above. -colors=(distro) - - -# Text Options - - -# Toggle bold text -# -# Default: 'on' -# Values: 'on', 'off' -# Flag: --bold -bold="on" - -# Enable/Disable Underline -# -# Default: 'on' -# Values: 'on', 'off' -# Flag: --underline -underline_enabled="on" - -# Underline character -# -# Default: '-' -# Values: 'string' -# Flag: --underline_char -underline_char="-" - - -# Info Separator -# Replace the default separator with the specified string. -# -# Default: ':' -# Flag: --separator -# -# Example: -# separator="->": 'Shell-> bash' -# separator=" =": 'WM = dwm' -separator=":" - - -# Color Blocks - - -# Color block range -# The range of colors to print. -# -# Default: '0', '15' -# Values: 'num' -# Flag: --block_range -# -# Example: -# -# Display colors 0-7 in the blocks. (8 colors) -# neofetch --block_range 0 7 -# -# Display colors 0-15 in the blocks. (16 colors) -# neofetch --block_range 0 15 -block_range=(0 15) - -# Toggle color blocks -# -# Default: 'on' -# Values: 'on', 'off' -# Flag: --color_blocks -color_blocks="on" - -# Color block width in spaces -# -# Default: '3' -# Values: 'num' -# Flag: --block_width -block_width=3 - -# Color block height in lines -# -# Default: '1' -# Values: 'num' -# Flag: --block_height -block_height=1 - - -# Progress Bars - - -# Bar characters -# -# Default: '-', '=' -# Values: 'string', 'string' -# Flag: --bar_char -# -# Example: -# neofetch --bar_char 'elapsed' 'total' -# neofetch --bar_char '-' '=' -bar_char_elapsed="-" -bar_char_total="=" - -# Toggle Bar border -# -# Default: 'on' -# Values: 'on', 'off' -# Flag: --bar_border -bar_border="on" - -# Progress bar length in spaces -# Number of chars long to make the progress bars. -# -# Default: '15' -# Values: 'num' -# Flag: --bar_length -bar_length=15 - -# Progress bar colors -# When set to distro, uses your distro's logo colors. -# -# Default: 'distro', 'distro' -# Values: 'distro', 'num' -# Flag: --bar_colors -# -# Example: -# neofetch --bar_colors 3 4 -# neofetch --bar_colors distro 5 -bar_color_elapsed="distro" -bar_color_total="distro" - - -# Info display -# Display a bar with the info. -# -# Default: 'off' -# Values: 'bar', 'infobar', 'barinfo', 'off' -# Flags: --cpu_display -# --memory_display -# --battery_display -# --disk_display -# -# Example: -# bar: '[---=======]' -# infobar: 'info [---=======]' -# barinfo: '[---=======] info' -# off: 'info' -cpu_display="off" -memory_display="off" -battery_display="off" -disk_display="off" - - -# Backend Settings - - -# Image backend. -# -# Default: 'ascii' -# Values: 'ascii', 'caca', 'chafa', 'jp2a', 'iterm2', 'off', -# 'termpix', 'pixterm', 'tycat', 'w3m', 'kitty' -# Flag: --backend -image_backend="ascii" - -# Image Source -# -# Which image or ascii file to display. -# -# Default: 'auto' -# Values: 'auto', 'ascii', 'wallpaper', '/path/to/img', '/path/to/ascii', '/path/to/dir/' -# 'command output (neofetch --ascii "$(fortune | cowsay -W 30)")' -# Flag: --source -# -# NOTE: 'auto' will pick the best image source for whatever image backend is used. -# In ascii mode, distro ascii art will be used and in an image mode, your -# wallpaper will be used. -image_source="auto" - - -# Ascii Options - - -# Ascii distro -# Which distro's ascii art to display. -# -# Default: 'auto' -# Values: 'auto', 'distro_name' -# Flag: --ascii_distro -# -# NOTE: Arch and Ubuntu have 'old' logo variants. -# Change this to 'arch_old' or 'ubuntu_old' to use the old logos. -# NOTE: Ubuntu has flavor variants. -# Change this to 'Lubuntu', 'Xubuntu', 'Ubuntu-GNOME' or 'Ubuntu-Budgie' to use the flavors. -# NOTE: Arch, Crux and Gentoo have a smaller logo variant. -# Change this to 'arch_small', 'crux_small' or 'gentoo_small' to use the small logos. -ascii_distro="auto" - -# Ascii Colors -# -# Default: 'distro' -# Values: 'distro', 'num' 'num' 'num' 'num' 'num' 'num' -# Flag: --ascii_colors -# -# Example: -# ascii_colors=(distro) - Ascii is colored based on Distro colors. -# ascii_colors=(4 6 1 8 8 6) - Ascii is colored using these colors. -ascii_colors=(distro) - -# Bold ascii logo -# Whether or not to bold the ascii logo. -# -# Default: 'on' -# Values: 'on', 'off' -# Flag: --ascii_bold -ascii_bold="on" - - -# Image Options - - -# Image loop -# Setting this to on will make neofetch redraw the image constantly until -# Ctrl+C is pressed. This fixes display issues in some terminal emulators. -# -# Default: 'off' -# Values: 'on', 'off' -# Flag: --loop -image_loop="off" - -# Thumbnail directory -# -# Default: '~/.cache/thumbnails/neofetch' -# Values: 'dir' -thumbnail_dir="${XDG_CACHE_HOME:-${HOME}/.cache}/thumbnails/neofetch" - -# Crop mode -# -# Default: 'normal' -# Values: 'normal', 'fit', 'fill' -# Flag: --crop_mode -# -# See this wiki page to learn about the fit and fill options. -# https://github.com/dylanaraps/neofetch/wiki/What-is-Waifu-Crop%3F -crop_mode="normal" - -# Crop offset -# Note: Only affects 'normal' crop mode. -# -# Default: 'center' -# Values: 'northwest', 'north', 'northeast', 'west', 'center' -# 'east', 'southwest', 'south', 'southeast' -# Flag: --crop_offset -crop_offset="center" - -# Image size -# The image is half the terminal width by default. -# -# Default: 'auto' -# Values: 'auto', '00px', '00%', 'none' -# Flags: --image_size -# --size -image_size="auto" - -# Gap between image and text -# -# Default: '3' -# Values: 'num', '-num' -# Flag: --gap -gap=3 - -# Image offsets -# Only works with the w3m backend. -# -# Default: '0' -# Values: 'px' -# Flags: --xoffset -# --yoffset -yoffset=0 -xoffset=0 - -# Image background color -# Only works with the w3m backend. -# -# Default: '' -# Values: 'color', 'blue' -# Flag: --bg_color -background_color= - - -# Misc Options - -# Stdout mode -# Turn off all colors and disables image backend (ASCII/Image). -# Useful for piping into another command. -# Default: 'off' -# Values: 'on', 'off' -stdout="off" diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim @@ -53,6 +53,14 @@ noremap <leader>vz :vsplit ~/.config/nvim/init.vim<CR> noremap <leader>vZ :split ~/.config/nvim/init.vim<CR> noremap <leader>vs :source ~/.config/nvim/init.vim<CR> map <leader><leader><leader> <leader>vs +noremap <leader>r :call ReopenFile()<CR> + +function! ReopenFile() + let curfile=expand('%:p') + echom curfile + execute 'write' . curfile + execute 'edit' . curfile +endfunction noremap <leader>g :Goyo \| set linebreak<CR> noremap <leader>cd :chdir diff --git a/.config/nvim/modules/abbrs.vim b/.config/nvim/modules/abbrs.vim @@ -1,6 +1,7 @@ -iabbrev eemail hayden@haydenvh.com -iabbrev <email> <hayden@haydenvh.com> -iabbrev wweb haydenvh.com -iabbrev ccopy Copyright (c) Hayden Hamilton <hayden@haydenvh.com> -iabbrev ssig -- Hayden -iabbrev nname Hayden Hamilton +iabbrev eemail hayden@haydenvh.com +iabbrev <eemail> <hayden@haydenvh.com> +iabbrev wweb haydenvh.com +iabbrev ccopy Copyright (c) Hayden Hamilton <hayden@haydenvh.com> +iabbrev ssig --<CR>Hayden +iabbrev nname Hayden Hamilton +iabbrev unkown unknown diff --git a/.tmux.conf b/.config/tmux/config diff --git a/.config/vim/autoload/goyo.vim b/.config/vim/autoload/goyo.vim @@ -1,447 +0,0 @@ -" Copyright (c) 2015 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. - -let s:cpo_save = &cpo -set cpo&vim - -function! s:const(val, min, max) - return min([max([a:val, a:min]), a:max]) -endfunction - -function! s:get_color(group, attr) - return synIDattr(synIDtrans(hlID(a:group)), a:attr) -endfunction - -function! s:set_color(group, attr, color) - let gui = has('gui_running') || has('termguicolors') && &termguicolors - execute printf('hi %s %s%s=%s', a:group, gui ? 'gui' : 'cterm', a:attr, a:color) -endfunction - -function! s:blank(repel) - if bufwinnr(t:goyo_pads.r) <= bufwinnr(t:goyo_pads.l) + 1 - \ || bufwinnr(t:goyo_pads.b) <= bufwinnr(t:goyo_pads.t) + 3 - call s:goyo_off() - endif - execute 'wincmd' a:repel -endfunction - -function! s:init_pad(command) - execute a:command - - setlocal buftype=nofile bufhidden=wipe nomodifiable nobuflisted noswapfile - \ nonu nocursorline nocursorcolumn winfixwidth winfixheight statusline=\ - if exists('&rnu') - setlocal nornu - endif - if exists('&colorcolumn') - setlocal colorcolumn= - endif - let bufnr = winbufnr(0) - - execute winnr('#') . 'wincmd w' - return bufnr -endfunction - -function! s:setup_pad(bufnr, vert, size, repel) - let win = bufwinnr(a:bufnr) - execute win . 'wincmd w' - execute (a:vert ? 'vertical ' : '') . 'resize ' . max([0, a:size]) - augroup goyop - execute 'autocmd WinEnter,CursorMoved <buffer> nested call s:blank("'.a:repel.'")' - autocmd WinLeave <buffer> call s:hide_statusline() - augroup END - - " To hide scrollbars of pad windows in GVim - let diff = winheight(0) - line('$') - (has('gui_running') ? 2 : 0) - if diff > 0 - setlocal modifiable - call append(0, map(range(1, diff), '""')) - normal! gg - setlocal nomodifiable - endif - execute winnr('#') . 'wincmd w' -endfunction - -function! s:resize_pads() - augroup goyop - autocmd! - augroup END - - let t:goyo_dim.width = s:const(t:goyo_dim.width, 2, &columns) - let t:goyo_dim.height = s:const(t:goyo_dim.height, 2, &lines) - - let vmargin = max([0, (&lines - t:goyo_dim.height) / 2 - 1]) - let yoff = s:const(t:goyo_dim.yoff, - vmargin, vmargin) - let top = vmargin + yoff - let bot = vmargin - yoff - 1 - call s:setup_pad(t:goyo_pads.t, 0, top, 'j') - call s:setup_pad(t:goyo_pads.b, 0, bot, 'k') - - let nwidth = max([len(string(line('$'))) + 1, &numberwidth]) - let width = t:goyo_dim.width + (&number ? nwidth : 0) - let hmargin = max([0, (&columns - width) / 2 - 1]) - let xoff = s:const(t:goyo_dim.xoff, - hmargin, hmargin) - call s:setup_pad(t:goyo_pads.l, 1, hmargin + xoff, 'l') - call s:setup_pad(t:goyo_pads.r, 1, hmargin - xoff, 'h') -endfunction - -function! s:tranquilize() - let bg = s:get_color('Normal', 'bg#') - for grp in ['NonText', 'FoldColumn', 'ColorColumn', 'VertSplit', - \ 'StatusLine', 'StatusLineNC', 'SignColumn'] - " -1 on Vim / '' on GVim - if bg == -1 || empty(bg) - call s:set_color(grp, 'fg', get(g:, 'goyo_bg', 'black')) - call s:set_color(grp, 'bg', 'NONE') - else - call s:set_color(grp, 'fg', bg) - call s:set_color(grp, 'bg', bg) - endif - call s:set_color(grp, '', 'NONE') - endfor -endfunction - -function! s:hide_statusline() - setlocal statusline=\ -endfunction - -function! s:hide_linenr() - if !get(g:, 'goyo_linenr', 0) - setlocal nonu - if exists('&rnu') - setlocal nornu - endif - endif - if exists('&colorcolumn') - setlocal colorcolumn= - endif -endfunction - -function! s:maps_nop() - let mapped = filter(['R', 'H', 'J', 'K', 'L', '|', '_'], - \ "empty(maparg(\"\<c-w>\".v:val, 'n'))") - for c in mapped - execute 'nnoremap <c-w>'.escape(c, '|').' <nop>' - endfor - return mapped -endfunction - -function! s:maps_resize() - let commands = { - \ '=': ':<c-u>let t:goyo_dim = <sid>parse_arg(t:goyo_dim_expr) <bar> call <sid>resize_pads()<cr>', - \ '>': ':<c-u>let t:goyo_dim.width = winwidth(0) + 2 * v:count1 <bar> call <sid>resize_pads()<cr>', - \ '<': ':<c-u>let t:goyo_dim.width = winwidth(0) - 2 * v:count1 <bar> call <sid>resize_pads()<cr>', - \ '+': ':<c-u>let t:goyo_dim.height += 2 * v:count1 <bar> call <sid>resize_pads()<cr>', - \ '-': ':<c-u>let t:goyo_dim.height -= 2 * v:count1 <bar> call <sid>resize_pads()<cr>' - \ } - let mapped = filter(keys(commands), "empty(maparg(\"\<c-w>\".v:val, 'n'))") - for c in mapped - execute 'nnoremap <silent> <c-w>'.c.' '.commands[c] - endfor - return mapped -endfunction - -nnoremap <silent> <plug>(goyo-resize) :<c-u>call <sid>resize_pads()<cr> - -function! s:goyo_on(dim) - let dim = s:parse_arg(a:dim) - if empty(dim) - return - endif - - let s:orig_tab = tabpagenr() - let settings = - \ { 'laststatus': &laststatus, - \ 'showtabline': &showtabline, - \ 'fillchars': &fillchars, - \ 'winminwidth': &winminwidth, - \ 'winwidth': &winwidth, - \ 'winminheight': &winminheight, - \ 'winheight': &winheight, - \ 'ruler': &ruler, - \ 'sidescroll': &sidescroll, - \ 'sidescrolloff': &sidescrolloff - \ } - - " New tab - tab split - - let t:goyo_master = winbufnr(0) - let t:goyo_dim = dim - let t:goyo_dim_expr = a:dim - let t:goyo_pads = {} - let t:goyo_revert = settings - let t:goyo_maps = extend(s:maps_nop(), s:maps_resize()) - if has('gui_running') - let t:goyo_revert.guioptions = &guioptions - endif - - " vim-gitgutter - let t:goyo_disabled_gitgutter = get(g:, 'gitgutter_enabled', 0) - if t:goyo_disabled_gitgutter - silent! GitGutterDisable - endif - - " vim-signify - let t:goyo_disabled_signify = exists('b:sy') && b:sy.active - if t:goyo_disabled_signify - SignifyToggle - endif - - " vim-airline - let t:goyo_disabled_airline = exists('#airline') - if t:goyo_disabled_airline - AirlineToggle - endif - - " vim-powerline - let t:goyo_disabled_powerline = exists('#PowerlineMain') - if t:goyo_disabled_powerline - augroup PowerlineMain - autocmd! - augroup END - augroup! PowerlineMain - endif - - " lightline.vim - let t:goyo_disabled_lightline = exists('#lightline') - if t:goyo_disabled_lightline - silent! call lightline#disable() - endif - - call s:hide_linenr() - " Global options - let &winheight = max([&winminheight, 1]) - set winminheight=1 - set winheight=1 - set winminwidth=1 winwidth=1 - set laststatus=0 - set showtabline=0 - set noruler - set fillchars+=vert:\ - set fillchars+=stl:\ - set fillchars+=stlnc:\ - set sidescroll=1 - set sidescrolloff=0 - - " Hide left-hand scrollbars - if has('gui_running') - set guioptions-=l - set guioptions-=L - endif - - let t:goyo_pads.l = s:init_pad('vertical topleft new') - let t:goyo_pads.r = s:init_pad('vertical botright new') - let t:goyo_pads.t = s:init_pad('topleft new') - let t:goyo_pads.b = s:init_pad('botright new') - - call s:resize_pads() - call s:tranquilize() - - augroup goyo - autocmd! - autocmd TabLeave * nested call s:goyo_off() - autocmd VimResized * call s:resize_pads() - autocmd ColorScheme * call s:tranquilize() - autocmd BufWinEnter * call s:hide_linenr() | call s:hide_statusline() - autocmd WinEnter,WinLeave * call s:hide_statusline() - if has('nvim') - autocmd TermClose * call feedkeys("\<plug>(goyo-resize)") - endif - augroup END - - call s:hide_statusline() - if exists('g:goyo_callbacks[0]') - call g:goyo_callbacks[0]() - endif - if exists('#User#GoyoEnter') - doautocmd User GoyoEnter - endif -endfunction - -function! s:goyo_off() - if !exists('#goyo') - return - endif - - " Oops, not this tab - if !exists('t:goyo_revert') - return - endif - - " Clear auto commands - augroup goyo - autocmd! - augroup END - augroup! goyo - augroup goyop - autocmd! - augroup END - augroup! goyop - - for c in t:goyo_maps - execute 'nunmap <c-w>'.escape(c, '|') - endfor - - let goyo_revert = t:goyo_revert - let goyo_disabled_gitgutter = t:goyo_disabled_gitgutter - let goyo_disabled_signify = t:goyo_disabled_signify - let goyo_disabled_airline = t:goyo_disabled_airline - let goyo_disabled_powerline = t:goyo_disabled_powerline - let goyo_disabled_lightline = t:goyo_disabled_lightline - let goyo_orig_buffer = t:goyo_master - let [line, col] = [line('.'), col('.')] - - if tabpagenr() == 1 - tabnew - normal! gt - bd - endif - tabclose - execute 'normal! '.s:orig_tab.'gt' - if winbufnr(0) == goyo_orig_buffer - " Doesn't work if window closed with `q` - execute printf('normal! %dG%d|', line, col) - endif - - let wmw = remove(goyo_revert, 'winminwidth') - let ww = remove(goyo_revert, 'winwidth') - let &winwidth = ww - let &winminwidth = wmw - let wmh = remove(goyo_revert, 'winminheight') - let wh = remove(goyo_revert, 'winheight') - let &winheight = max([wmh, 1]) - let &winminheight = wmh - let &winheight = wh - - for [k, v] in items(goyo_revert) - execute printf('let &%s = %s', k, string(v)) - endfor - execute 'colo '. get(g:, 'colors_name', 'default') - - if goyo_disabled_gitgutter - silent! GitGutterEnable - endif - - if goyo_disabled_signify - silent! if !b:sy.active - SignifyToggle - endif - endif - - if goyo_disabled_airline && !exists('#airline') - AirlineToggle - " For some reason, Airline requires two refreshes to avoid display - " artifacts - silent! AirlineRefresh - silent! AirlineRefresh - endif - - if goyo_disabled_powerline && !exists('#PowerlineMain') - doautocmd PowerlineStartup VimEnter - silent! PowerlineReloadColorscheme - endif - - if goyo_disabled_lightline - silent! call lightline#enable() - endif - - if exists('#Powerline') - doautocmd Powerline ColorScheme - endif - - if exists('g:goyo_callbacks[1]') - call g:goyo_callbacks[1]() - endif - if exists('#User#GoyoLeave') - doautocmd User GoyoLeave - endif -endfunction - -function! s:relsz(expr, limit) - if a:expr !~ '%$' - return str2nr(a:expr) - endif - return a:limit * str2nr(a:expr[:-2]) / 100 -endfunction - -function! s:parse_arg(arg) - if exists('g:goyo_height') || !exists('g:goyo_margin_top') && !exists('g:goyo_margin_bottom') - let height = s:relsz(get(g:, 'goyo_height', '85%'), &lines) - let yoff = 0 - else - let top = max([0, s:relsz(get(g:, 'goyo_margin_top', 4), &lines)]) - let bot = max([0, s:relsz(get(g:, 'goyo_margin_bottom', 4), &lines)]) - let height = &lines - top - bot - let yoff = top - bot - endif - - let dim = { 'width': s:relsz(get(g:, 'goyo_width', 80), &columns), - \ 'height': height, - \ 'xoff': 0, - \ 'yoff': yoff } - if empty(a:arg) - return dim - endif - let parts = matchlist(a:arg, '^\s*\([0-9]\+%\?\)\?\([+-][0-9]\+%\?\)\?\%(x\([0-9]\+%\?\)\?\([+-][0-9]\+%\?\)\?\)\?\s*$') - if empty(parts) - echohl WarningMsg - echo 'Invalid dimension expression: '.a:arg - echohl None - return {} - endif - if !empty(parts[1]) | let dim.width = s:relsz(parts[1], &columns) | endif - if !empty(parts[2]) | let dim.xoff = s:relsz(parts[2], &columns) | endif - if !empty(parts[3]) | let dim.height = s:relsz(parts[3], &lines) | endif - if !empty(parts[4]) | let dim.yoff = s:relsz(parts[4], &lines) | endif - return dim -endfunction - -function! goyo#execute(bang, dim) - if a:bang - if exists('#goyo') - call s:goyo_off() - endif - else - if exists('#goyo') == 0 - call s:goyo_on(a:dim) - elseif !empty(a:dim) - if winnr('$') < 5 - call s:goyo_off() - return goyo#execute(a:bang, a:dim) - endif - let dim = s:parse_arg(a:dim) - if !empty(dim) - let t:goyo_dim = dim - let t:goyo_dim_expr = a:dim - call s:resize_pads() - endif - else - call s:goyo_off() - end - end -endfunction - -let &cpo = s:cpo_save -unlet s:cpo_save - diff --git a/.config/vim/autoload/magit/git.vim b/.config/vim/autoload/magit/git.vim @@ -1,348 +0,0 @@ -function! magit#git#get_version() - if ( !exists("s:git_version") ) - let s:git_version = matchlist(system(g:magit_git_cmd . " --version"), - \ 'git version \(\d\+\)\.\(\d\+\)\.\(\d\+\)\.\(\d\+\)\.\(g\x\+\)')[1:5] - endif - return s:git_version -endfunction - -function! magit#git#is_version_sup_equal(major, minor, rev) - let git_ver = magit#git#get_version() - return ( ( a:major > git_ver[0] ) || - \ (a:major >= git_ver[0] && a:minor > git_ver[1] ) || - \ (a:major >= git_ver[0] && a:minor >= git_ver[1] && a:rev >= git_ver[2] ) - \ ) -endfunction - -" magit#git#get_status: this function returns the git status output formated -" into a List of Dict as -" [ {staged', 'unstaged', 'filename'}, ... ] -function! magit#git#get_status() - let file_list = [] - - " systemlist v7.4.248 problem again - " we can't use git status -z here, because system doesn't make the - " difference between NUL and NL. -status z terminate entries with NUL, - " instead of NF - let status_list=magit#sys#systemlist(g:magit_git_cmd . " status --porcelain") - for file_status_line in status_list - let line_match = matchlist(file_status_line, '\(.\)\(.\) \%(.\{-\} -> \)\?"\?\(.\{-\}\)"\?$') - let filename = line_match[3] - call add(file_list, { 'staged': line_match[1], 'unstaged': line_match[2], 'filename': filename }) - endfor - return file_list -endfunction - -function! magit#git#get_config(conf_name, default) - try - silent! let git_result=magit#utils#strip( - \ magit#sys#system(g:magit_git_cmd . " config --get " . a:conf_name)) - catch 'shell_error' - return a:default - endtry - return git_result -endfunction - -" magit#git#is_work_tree: this function check that path passed as parameter is -" inside a git work tree -" param[in] path: path to check -" return: top work tree path if in a work tree, empty string otherwise -function! magit#git#is_work_tree(path) - let dir = getcwd() - try - call magit#utils#chdir(a:path) - let top_dir=system(g:magit_git_cmd . " rev-parse --show-toplevel") - if ( executable("cygpath") ) - let top_dir = magit#utils#strip(system("cygpath " . top_dir)) - endif - if ( v:shell_error != 0 ) - return '' - endif - return magit#utils#strip(top_dir) . "/" - finally - call magit#utils#chdir(dir) - endtry -endfunction - -" magit#git#set_top_dir: this function set b:magit_top_dir and b:magit_git_dir -" according to a path -" param[in] path: path to set. This path must be in a git repository work tree -function! magit#git#set_top_dir(path) - let dir = getcwd() - try - call magit#utils#chdir(a:path) - try - let top_dir=magit#utils#strip( - \ system(g:magit_git_cmd . " rev-parse --show-toplevel")) . "/" - let git_dir=magit#utils#strip(system(g:magit_git_cmd . " rev-parse --git-dir")) . "/" - if ( executable("cygpath") ) - let top_dir = magit#utils#strip(system("cygpath " . top_dir)) - let git_dir = magit#utils#strip(system("cygpath " . git_dir)) - endif - catch 'shell_error' - call magit#sys#print_shell_error() - throw 'set_top_dir_error' - endtry - let b:magit_top_dir=top_dir - let b:magit_git_dir=git_dir - finally - call magit#utils#chdir(dir) - endtry -endfunction - -" magit#git#top_dir: return the absolute path of current git worktree for the -" current magit buffer -" return top directory -function! magit#git#top_dir() - if ( !exists("b:magit_top_dir") ) - throw 'top_dir_not_set' - endif - return b:magit_top_dir -endfunction - -" magit#git#git_dir: return the absolute path of current git worktree -" return git directory -function! magit#git#git_dir() - if ( !exists("b:magit_git_dir") ) - throw 'git_dir_not_set' - endif - return b:magit_git_dir -endfunction - -" magit#git#git_diff: helper function to get diff of a file -" nota: when git fail (due to misformated patch for example), an error -" message is raised. -" WARNING: diff is generated without prefix. To apply this diff, git apply -" must use the option -p0. -" param[in] filemane: it must be quoted if it contains spaces -" param[in] status: status of the file (see g:magit_git_status_code) -" param[in] mode: can be staged or unstaged -" return: two values -" [0]: boolean, if true current file is binary -" [1]: string array containing diff output -function! magit#git#git_diff(filename, status, mode) - let dev_null = ( a:status == '?' ) ? "/dev/null " : "" - let staged_flag = ( a:mode == 'staged' ) ? "--staged" : "" - let git_cmd=g:magit_git_cmd . " diff --no-ext-diff " . staged_flag . - \ " --no-prefix --no-color -p -U" . b:magit_diff_context . - \ " -- " . dev_null . " " . a:filename - - if ( a:status != '?' ) - try - silent let diff_list=magit#sys#systemlist(git_cmd) - catch 'shell_error' - call magit#sys#print_shell_error() - throw 'diff error' - endtry - else - silent let diff_list=magit#sys#systemlist_noraise(git_cmd) - endif - - if ( empty(diff_list) ) - echohl WarningMsg - echom "diff command \"" . git_cmd . "\" returned nothing" - echohl None - throw 'diff error' - endif - return [ - \ ( diff_list[-1] =~ "^Binary files .* differ$" && len(diff_list) <= 4 ) - \, diff_list ] -endfunction - -" magit#git#sub_check: this function checks if given submodule has modified or -" untracked content -" param[in] submodule: submodule path -" param[in] check_level: can be modified or untracked -function! magit#git#sub_check(submodule, check_level) - let ignore_flag = ( a:check_level == 'modified' ) ? - \ '--ignore-submodules=untracked' : '' - let git_cmd=g:magit_git_cmd . " status --porcelain " . ignore_flag . " " . a:submodule - return ( !empty(magit#sys#systemlist(git_cmd)) ) -endfunction - -" magit#git#git_sub_summary: helper function to get diff of a submodule -" nota: when git fail (due to misformated patch for example), an error -" message is raised. -" param[in] filemane: it must be quoted if it contains spaces -" param[in] mode: can be staged or unstaged -function! magit#git#git_sub_summary(filename, mode) - let staged_flag = ( a:mode == 'staged' ) ? " --cached " : " --files " - let git_cmd=g:magit_git_cmd . " submodule summary " . staged_flag . " HEAD " - \ .a:filename - silent let diff_list=magit#sys#systemlist(git_cmd) - if ( empty(diff_list) ) - if ( a:mode == 'unstaged' ) - if ( magit#git#sub_check(a:filename, 'modified') ) - return "modified content" - endif - if ( magit#git#sub_check(a:filename, 'untracked') ) - return "untracked content" - endif - endif - echohl WarningMsg - echom "diff command \"" . git_cmd . "\" returned nothing" - echohl None - throw 'diff error' - endif - return diff_list -endfunction - -" magit#git#git_add: helper function to add a whole file -" nota: when git fail (due to misformated patch for example), an error -" message is raised. -" param[in] filemane: it must be quoted if it contains spaces -function! magit#git#git_add(filename) - let git_cmd=g:magit_git_cmd . " add --no-ignore-removal -- " . a:filename - try - silent let git_result=magit#sys#system(git_cmd) - catch 'shell_error' - call magit#sys#print_shell_error() - throw 'add error' - endtry -endfunction - -" magit#git#git_checkout: helper function to add a whole file -" nota: when git fail (due to misformated patch for example), an error -" message is raised. -" param[in] filemane: it must be quoted if it contains spaces -function! magit#git#git_checkout(filename) - let git_cmd=g:magit_git_cmd . " checkout -- " . a:filename - try - silent let git_result=magit#sys#system(git_cmd) - catch 'shell_error' - call magit#sys#print_shell_error() - throw 'checkout error' - endtry -endfunction - -" magit#git#git_reset: helper function to add a whole file -" nota: when git fail (due to misformated patch for example), an error -" message is raised. -" param[in] filemane: it must be quoted if it contains spaces -function! magit#git#git_reset(filename) - let git_cmd=g:magit_git_cmd . " reset HEAD -- " . a:filename - try - silent let git_result=magit#sys#system(git_cmd) - catch 'shell_error' - call magit#sys#print_shell_error() - throw 'reset error' - endtry -endfunction - -" magit#git#git_apply: helper function to stage a selection -" nota: when git fail (due to misformated patch for example), an error -" message is raised. -" param[in] selection: the text to stage. It must be a patch, i.e. a diff -" header plus one or more hunks -" return: no -function! magit#git#git_apply(header, selection) - let selection = magit#utils#flatten(a:header + a:selection) - if ( selection[-1] !~ '^$' ) - let selection += [ '' ] - endif - let git_cmd=g:magit_git_cmd . " apply --recount --no-index --cached -p0 -" - try - silent let git_result=magit#sys#system(git_cmd, selection) - catch 'shell_error' - call magit#sys#print_shell_error() - echom "Tried to aply this" - echom string(selection) - throw 'apply error' - endtry -endfunction - -" magit#git#git_unapply: helper function to unstage a selection -" nota: when git fail (due to misformated patch for example), an error -" message is raised. -" param[in] selection: the text to stage. It must be a patch, i.e. a diff -" header plus one or more hunks -" return: no -function! magit#git#git_unapply(header, selection, mode) - let cached_flag='' - if ( a:mode == 'staged' ) - let cached_flag=' --cached ' - endif - let selection = magit#utils#flatten(a:header + a:selection) - if ( selection[-1] !~ '^$' ) - let selection += [ '' ] - endif - try - silent let git_result=magit#sys#system( - \ g:magit_git_cmd . " apply --recount --no-index -p0 --reverse " . - \ cached_flag . " - ", selection) - catch 'shell_error' - call magit#sys#print_shell_error() - echom "Tried to unaply this" - echom string(selection) - throw 'unapply error' - endtry -endfunction - -" magit#git#submodule_status: helper function to return the submodule status -" return submodule status -function! magit#git#submodule_status() - return magit#sys#system(g:magit_git_cmd . " submodule status") -endfunction - -" magit#git#get_branch_name: get the branch name given a reference -" WARNING does not seem to work with SHA1 -" param[in] ref can be HEAD or a branch name -" return branch name -function! magit#git#get_branch_name(ref) - return magit#utils#strip(magit#sys#system(g:magit_git_cmd . " rev-parse --abbrev-ref " . a:ref)) -endfunction - -" magit#git#count_object: this function returns the output of git -" count-objects, in a dict object -" It contains the following information: count, size, in-pack, packs, -" size-pack, prune-packable, garbage, size-garbage -function! magit#git#count_object() - let count_object=magit#sys#systemlist(g:magit_git_cmd . " count-objects -v") - let refs={} - for line in count_object - let ref=split(line, ":") - let refs[ref[0]] = ref[1] - endfor - return refs -endfunction - -" magit#git#check_repo: check the health of the repo -" return 0 if everything is fine, 1 otherwise -function! magit#git#check_repo() - try - let head_br=magit#git#get_branch_name("HEAD") - catch 'shell_error' - let count = magit#git#count_object()['count'] - if ( count != 0 ) - return 1 - endif - endtry - return 0 -endfunction - -" magit#git#get_commit_subject: get the subject of a commit (first line) -" param[in] ref: reference, can be SHA1, brnach name or HEAD -" return commit subject -function! magit#git#get_commit_subject(ref) - try - return magit#utils#strip(magit#sys#system(g:magit_git_cmd . " show " . - \" --no-prefix --no-patch --format=\"%s\" " . a:ref)) - catch 'shell_error' - return "" - endtry -endfunction - -" magit#git#get_remote_branch: get the branch name of the default remote, for -" upstream and push -" WARNING does not work with SHA1 -" param[in] ref: reference, can be HEAD or branch name -" param[in] type: type of default remote: upstream or push -" return the remote branch name, 'none' if it has not -function! magit#git#get_remote_branch(ref, type) - try - return magit#utils#strip(magit#sys#system( - \ g:magit_git_cmd . " rev-parse --abbrev-ref=loose " . a:ref . "@{" . a:type . "}")) - catch 'shell_error' - return "none" - endtry -endfunction diff --git a/.config/vim/autoload/magit/helper.vim b/.config/vim/autoload/magit/helper.vim @@ -1,29 +0,0 @@ - -" magit#helper#get_filename: helper function to get the current filename, according to -" cursor position -" return: filename -function! magit#helper#get_filename() - return substitute(getline(search(g:magit_file_re, "cbnW")), g:magit_file_re, '\2', '') -endfunction - -" magit#helper#get_hunkheader_line_nb: helper function to get the current hunk -" header line number, according to cursor position -" return: hunk header line number -function! magit#helper#get_hunkheader_line_nb() - return search(g:magit_hunk_re, "cbnW") -endfunction - -" magit#utils#get_section: helper function to get the current section, according to -" cursor position -" return: section id, empty string if no section found -function! magit#helper#get_section() - let section_line=getline(search(g:magit_section_re, "bnW")) - for [section_name, section_str] in items(g:magit_sections) - if ( section_line == section_str ) - return section_name - endif - endfor - return '' -endfunction - - diff --git a/.config/vim/autoload/magit/mapping.vim b/.config/vim/autoload/magit/mapping.vim @@ -1,262 +0,0 @@ - -let g:magit_stage_file_mapping = get(g:, 'magit_stage_file_mapping', 'F' ) -let g:magit_stage_hunk_mapping = get(g:, 'magit_stage_hunk_mapping', 'S' ) -let g:magit_stage_line_mapping = get(g:, 'magit_stage_line_mapping', 'L' ) -let g:magit_mark_line_mapping = get(g:, 'magit_mark_line_mapping', 'M' ) -let g:magit_commit_mapping = get(g:, 'magit_commit_mapping', 'CC' ) -let g:magit_commit_amend_mapping = get(g:, 'magit_commit_amend_mapping', 'CA' ) -let g:magit_commit_fixup_mapping = get(g:, 'magit_commit_fixup_mapping', 'CF' ) -let g:magit_close_commit_mapping = get(g:, 'magit_close_commit_mapping', 'CU' ) -let g:magit_reload_mapping = get(g:, 'magit_reload_mapping', 'R' ) -let g:magit_edit_mapping = get(g:, 'magit_edit_mapping', 'E' ) - -let g:magit_jump_next_hunk = get(g:, 'magit_jump_next_hunk', '<C-N>') -let g:magit_jump_prev_hunk = get(g:, 'magit_jump_prev_hunk', '<C-P>') - -let g:magit_ignore_mapping = get(g:, 'magit_ignore_mapping', 'I' ) -let g:magit_discard_hunk_mapping = get(g:, 'magit_discard_hunk_mapping', 'DDD' ) - -let g:magit_close_mapping = get(g:, 'magit_close_mapping', 'q' ) -let g:magit_toggle_help_mapping = get(g:, 'magit_toggle_help_mapping', '?' ) - -let g:magit_diff_shrink = get(g:, 'magit_diff_shrink', '-' ) -let g:magit_diff_enlarge = get(g:, 'magit_diff_enlarge', '+' ) -let g:magit_diff_reset = get(g:, 'magit_diff_reset', '0' ) - -let g:magit_folding_toggle_mapping = get(g:, 'magit_folding_toggle_mapping', [ '<CR>' ]) -let g:magit_folding_open_mapping = get(g:, 'magit_folding_open_mapping', [ 'zo', 'zO' ]) -let g:magit_folding_close_mapping = get(g:, 'magit_folding_close_mapping', [ 'zc', 'zC' ]) - -" magit#open_close_folding_wrapper: wrapper function to -" magit#open_close_folding. If line under cursor is not a cursor, execute -" normal behavior -" param[in] mapping: which has been set -" param[in] visible : boolean, force visible value. If not set, toggle -" visibility -function! s:mg_open_close_folding_wrapper(mapping, ...) - if ( getline(".") =~ g:magit_file_re ) - return call('magit#open_close_folding', a:000) - elseif ( foldlevel(line(".")) == 2 ) - if ( foldclosed(line('.')) == -1 ) - foldclose - else - foldopen - endif - else - silent! execute "silent! normal! " . a:mapping - endif -endfunction - -" s:nmapping_wrapper: wrapper for normal mapping commands -" it needs a wrapper because some mappings must only be enabled in some -" sections. For example, wa want that 'S' mapping to be enabled in staged and -" unstaged sections, but not in commit section. -" param[in] mapping the key for the mapping (lhs) -" param[in] function the function to call (rhs) -" param[in] ... : optional, section, the regex of the sections where to enable the -" mapping. If there is no section parameter or if the section parameter regex -" match the current section, the rhs is called. Otherwise, the mapping is -" applied to its original meaning. -function! s:nmapping_wrapper(mapping, function, ...) - if ( a:0 == 0 || magit#helper#get_section() =~ a:1 ) - execute "call " . a:function - else - " feedkeys(..., 'n') is prefered over execute normal! - " normal! does not enter in insert mode - call feedkeys(a:mapping, 'n') - endif -endfunction - -" s:xmapping_wrapper: wrapper for visual mapping commands -" it needs a wrapper because some mappings must only be enabled in some -" sections. For example, wa want that 'S' mapping to be enabled in staged and -" unstaged sections, but not in commit section. -" param[in] mapping the key for the mapping (lhs) -" param[in] function the function to call (rhs) -" param[in] ... : optional, section, the regex of the sections where to enable the -" mapping. If there is no section parameter or if the section parameter regex -" match the current section, the rhs is called. Otherwise, the mapping is -" applied to its original meaning. -function! s:xmapping_wrapper(mapping, function, ...) range - if ( a:0 == 0 || magit#helper#get_section() =~ a:1 ) - execute a:firstline . "," . a:lastline . "call " . a:function - else - " feedkeys(..., 'n') is prefered over execute normal! - " normal! does not enter in insert mode - call feedkeys(a:mapping, 'n') - endif -endfunction -" s:mg_set_mapping: helper function to setup the mapping -" param[in] mode the mapping mode, one letter. Can be 'n', 'x', 'i', ... -" param[in] mapping the key for the mapping (lhs) -" param[in] function the function to call (rhs) -" param[in] ... : optional, section, the regex of the section(s) -function! s:mg_set_mapping(mode, mapping, function, ...) - if ( a:0 == 1 ) - execute a:mode . "noremap <buffer><silent><nowait> " - \ . a:mapping . - \ " :call <SID>" . a:mode . "mapping_wrapper(\"" . - \ a:mapping . "\", \"" . - \ a:function . "\"" . - \ ", \'" . a:1 . "\'" . - \ ")<cr>" - else - execute a:mode . "noremap <buffer><silent><nowait> " - \ . a:mapping . - \ " :call " . - \ a:function . "<cr>" - endif -endfunction - -function! magit#mapping#set_default() - - call s:mg_set_mapping('n', g:magit_stage_hunk_mapping, - \"magit#stage_hunk(0)", '\<\%(un\)\?staged\>') - call s:mg_set_mapping('n', g:magit_stage_file_mapping, - \ "magit#stage_file()", '\<\%(un\)\?staged\>') - call s:mg_set_mapping('n', g:magit_discard_hunk_mapping, - \ "magit#stage_hunk(1)", '\<\%(un\)\?staged\>') - call s:mg_set_mapping('n', g:magit_stage_line_mapping, - \ "magit#stage_vselect()", '\<\%(un\)\?staged\>') - call s:mg_set_mapping('x', g:magit_stage_hunk_mapping, - \ "magit#stage_vselect()", '\<\%(un\)\?staged\>') - call s:mg_set_mapping('n', g:magit_mark_line_mapping, - \ "magit#mark_vselect()", '\<\%(un\)\?staged\>') - call s:mg_set_mapping('x', g:magit_mark_line_mapping, - \ "magit#mark_vselect()", '\<\%(un\)\?staged\>') - - call s:mg_set_mapping('n', g:magit_ignore_mapping, - \ "magit#ignore_file()", '\<\%(un\)\?staged\>') - call s:mg_set_mapping('n', g:magit_edit_mapping, - \ "magit#jump_to()", '\<\%(un\)\?staged\>') - - call s:mg_set_mapping('n', g:magit_reload_mapping, - \ "magit#update_buffer()") - call s:mg_set_mapping('n', g:magit_close_mapping, - \ "magit#close_magit()") - call s:mg_set_mapping('n', g:magit_diff_shrink, - \ "magit#update_diff('-')") - call s:mg_set_mapping('n', g:magit_diff_enlarge, - \ "magit#update_diff('+')") - call s:mg_set_mapping('n', g:magit_diff_reset, - \ "magit#update_diff('0')") - call s:mg_set_mapping('n', g:magit_toggle_help_mapping, - \ "magit#toggle_help()") - - call s:mg_set_mapping('n', g:magit_commit_mapping, - \ "magit#commit_command('CC')") - call s:mg_set_mapping('n', g:magit_commit_amend_mapping, - \ "magit#commit_command('CA')") - call s:mg_set_mapping('n', g:magit_commit_fixup_mapping, - \ "magit#commit_command('CF')") - call s:mg_set_mapping('n', g:magit_close_commit_mapping, - \ "magit#close_commit()") - - call s:mg_set_mapping('n', g:magit_jump_next_hunk, - \ "magit#jump_hunk('N')") - call s:mg_set_mapping('n', g:magit_jump_prev_hunk, - \ "magit#jump_hunk('P')") - - for mapping in g:magit_folding_toggle_mapping - " trick to pass '<cr>' in a mapping command without being interpreted - let func_arg = ( mapping ==? "<cr>" ) ? '+' : mapping - execute "nnoremap <buffer><silent><nowait> " . mapping . " :call <SID>mg_open_close_folding_wrapper('" . func_arg . "')<return>" - endfor - for mapping in g:magit_folding_open_mapping - execute "nnoremap <buffer><silent><nowait> " . mapping . " :call <SID>mg_open_close_folding_wrapper('" . mapping . "', 1)<return>" - endfor - for mapping in g:magit_folding_close_mapping - execute "nnoremap <buffer><silent><nowait> " . mapping . " :call <SID>mg_open_close_folding_wrapper('" . mapping . "', 0)<return>" - endfor - - " s:magit_inline_help: Dict containing inline help for each section - let s:magit_inline_help = { - \ 'staged': [ -\g:magit_stage_hunk_mapping -\.' if cursor on filename header, unstage file', -\' if cursor in hunk, unstage hunk', -\' if visual selection in hunk (with v), unstage selection', -\' if lines marked in hunk (with ' . g:magit_mark_line_mapping . '), unstage marked lines', -\g:magit_stage_line_mapping -\.' unstage the line under the cursor', -\g:magit_mark_line_mapping -\.' if cursor in hunk, mark line under cursor "to be unstaged"', -\' if visual selection in hunk (with v), mark selected lines "to be unstaged"', -\g:magit_stage_file_mapping -\.' if cursor on filename header or hunk, unstage whole file', -\g:magit_edit_mapping -\.' edit, jump cursor to file containing this hunk', -\g:magit_jump_next_hunk.','.g:magit_jump_prev_hunk -\. ' move to Next/Previous hunk in magit buffer', -\], - \ 'unstaged': [ -\g:magit_stage_hunk_mapping -\.' if cursor on filename header, stage file', -\' if cursor in hunk, stage hunk', -\' if visual selection in hunk (with v), stage selection', -\' if lines marked in hunk (with ' . g:magit_mark_line_mapping . '), stage marked lines', -\g:magit_stage_line_mapping -\.' stage the line under the cursor', -\g:magit_mark_line_mapping -\.' if cursor in hunk, mark line under cursor "to be staged"', -\' if visual selection in hunk (with v), mark selected lines "to be staged"', -\g:magit_stage_file_mapping -\.' if cursor on filename header or hunk, stage whole file', -\g:magit_edit_mapping -\.' edit, jump cursor to file containing this hunk', -\g:magit_jump_next_hunk.','.g:magit_jump_prev_hunk -\. ' move to Next/Previous hunk in magit buffer', -\g:magit_discard_hunk_mapping -\. ' discard file changes (warning, changes will be lost)', -\g:magit_ignore_mapping -\.' add file in .gitgnore', -\], - \ 'global': [ -\g:magit_sections['help'], -\g:magit_folding_toggle_mapping[0] -\. ' if cursor on filename header line, unhide diffs for this file', -\g:magit_commit_mapping -\. ' From stage mode: set commit mode in normal flavor', -\' From commit mode: commit all staged changes with commit flavor', -\' (normal or amend) with message in "Commit message" section', -\g:magit_commit_amend_mapping -\. ' From stage or commit mode: set commit mode in amend flavor, and', -\' display "Commit message" section with previous commit message.', -\g:magit_commit_fixup_mapping -\. ' From stage mode: amend staged changes to previous commit without', -\' modifying the previous commit message', -\g:magit_close_commit_mapping -\. ' commit undo, cancel and close current commit message', -\g:magit_reload_mapping -\.' refresh magit buffer', -\g:magit_diff_shrink.','.g:magit_diff_enlarge.','.g:magit_diff_reset -\. ' shrink,enlarge,reset diff context', -\g:magit_close_mapping -\.' close magit buffer', -\g:magit_toggle_help_mapping -\.' toggle help showing in magit buffer', -\'=======' -\], -\} -endfunction - -" s:mg_get_inline_help_line_nb: this function returns the number of lines of -" a given section, or 0 if help is disabled. -" param[in] section: section identifier -" return number of lines -function! magit#mapping#get_section_help_line_nb(section) - return ( g:magit_show_help == 1 ) ? - \ len(s:magit_inline_help[a:section]) : 0 -endfunction - -" s:mg_section_help: this function writes in current buffer the inline help -" for a given section, it does nothing if inline help is disabled. -" WARNING: this function writes in file, it should only be called through -" protected functions like magit#update_buffer -" param[in] section: section identifier -function! magit#mapping#get_section_help(section) - if ( g:magit_show_help == 1 ) - silent put =s:magit_inline_help[a:section] - endif -endfunction - diff --git a/.config/vim/autoload/magit/sign.vim b/.config/vim/autoload/magit/sign.vim @@ -1,116 +0,0 @@ -" Got lot of stuf from vim-gitgutter -" https://github.com/airblade/vim-gitgutter - -" Vim doesn't namespace sign ids so every plugin shares the same -" namespace. Sign ids are simply integers so to avoid clashes with other -" signs we guess at a clear run. -" -" Note also we currently never reset s:next_sign_id. -let s:first_sign_id = 42000 -let s:next_sign_id = s:first_sign_id -let s:dummy_sign_id = s:first_sign_id - 1 -" Remove-all-signs optimisation requires Vim 7.3.596+. -let s:supports_star = v:version > 703 || (v:version == 703 && has("patch596")) - -function! magit#sign#remove_all(...) - if ( a:0 == 1 ) - let pattern = a:1 - else - let pattern = '^Magit.*' - endif - let signs = magit#sign#find_signs(pattern, 1, line('$')) - call magit#sign#remove_signs(signs) -endfunction - -" magit#sign#remove_signs: unplace a list of signs -" param[in] sign_ids: list of signs dict -function! magit#sign#remove_signs(sign_ids) - let bufnr = magit#utils#bufnr() - for sign in values(a:sign_ids) - execute "sign unplace" sign.id - endfor -endfunction - -function! magit#sign#add_sign(line, type, bufnr) - let id = <SID>get_next_sign_id() - execute ":sign place " . id . - \ " line=" . a:line . " name=" . s:magit_mark_signs[a:type] . - \ " buffer=" . a:bufnr - return id -endfunction - -function! magit#sign#remove_sign(id) - execute ":sign unplace " . a:id -endfunction - -" s:get_next_sign_id: helper function to increment sign ids -function! s:get_next_sign_id() - let next_id = s:next_sign_id - let s:next_sign_id += 1 - return next_id -endfunction - -" magit#sign#find_signs: this function returns signs matching a pattern in a -" range of lines -" param[in] pattern: regex pattern to match -" param[in] startline,endline: range of lines -" FIXME: find since which version "sign place" is sorted -function! magit#sign#find_signs(pattern, startline, endline) - let bufnr = magit#utils#bufnr() - " <line_number (string)>: {'id': <id (number)>, 'name': <name (string)>} - let found_signs = {} - - redir => signs - silent execute "sign place buffer=" . bufnr - redir END - - for sign_line in filter(split(signs, '\n'), 'v:val =~# "="') - " Typical sign line: line=88 id=1234 name=GitGutterLineAdded - " We assume splitting is faster than a regexp. - let components = split(sign_line) - let name = split(components[2], '=')[1] - let line_number = str2nr(split(components[0], '=')[1]) - if ( name =~# a:pattern && - \ line_number >= a:startline && - \ line_number <= a:endline ) - let id = str2nr(split(components[1], '=')[1]) - let found_signs[line_number] = {'id': id, 'name': name} - endif - endfor - return found_signs -endfunction - -" magit#sign#find_stage_signs: helper function to get marked lines for stage -" param[in] startline,endline: range of lines -" return Dict of marked lines -function! magit#sign#find_stage_signs(startline, endline) - return magit#sign#find_signs(s:magit_mark_signs.M, a:startline, a:endline) -endfunction - -" s:magit_mark_sign: string of the sign for lines to be staged -let s:magit_mark_signs = {'M': 'MagitTBS', 'S': 'MagitBS', 'E': 'MagitBE'} - -" magit#sign#init: initializer function for signs -function! magit#sign#init() - execute "sign define " . s:magit_mark_signs.M . " text=S> linehl=Visual" - execute "sign define " . s:magit_mark_signs.S - execute "sign define " . s:magit_mark_signs.E -endfunction - -" magit#sign#toggle_signs: toggle marks for range of lines -" marked lines are unmarked, non marked are marked -" param[in] type; type of sign to toggle (see s:magit_mark_signs) -" param[in] startline,endline: range of lines -function! magit#sign#toggle_signs(type, startline, endline) - let bufnr = magit#utils#bufnr() - let current_signs = magit#sign#find_signs(s:magit_mark_signs[a:type], a:startline, a:endline) - let line = a:startline - while ( line <= a:endline ) - if ( has_key(current_signs, line) == 0 ) - call magit#sign#add_sign(line, a:type, bufnr) - else - call magit#sign#remove_sign(current_signs[line].id) - endif - let line += 1 - endwhile -endfunction diff --git a/.config/vim/autoload/magit/state.vim b/.config/vim/autoload/magit/state.vim @@ -1,385 +0,0 @@ -" magit#state#is_file_visible: file getter function -" return if file is visible -function! magit#state#is_file_visible() dict - return self.visible -endfunction - -" magit#state#set_file_visible: file setter function -" param[in] val: visible state to set to file -function! magit#state#set_file_visible(val) dict - let self.visible = a:val -endfunction - -" magit#state#toggle_file_visible: file setter function, toggle file visible -" state -function! magit#state#toggle_file_visible() dict - let self.visible = ( self.visible == 0 ) ? 1 : 0 -endfunction - -" magit#state#init_file_visible: init file visible status, among several conditions -function! magit#state#init_file_visible() dict - if ( !self.new ) - return self.is_visible() - else - if ( self.status == 'M' || b:magit_default_show_all_files > 1 ) - call self.set_visible(b:magit_default_show_all_files) - endif - return self.is_visible() - endif -endfunction - -" magit#state#is_file_dir: file getter function -" return 1 if current file is a directory, 0 otherwise -function! magit#state#is_file_dir() dict - return self.dir != 0 -endfunction - -" magit#state#must_be_added: file helper function -" there are some conditions where files must be widely added (git add), not -" 'diff applied' (git apply) -" return 1 if file must -function! magit#state#must_be_added() dict - return ( self.empty == 1 || - \ self.symlink != '' || - \ self.dir != 0 || - \ self.binary == 1 || - \ self.submodule == 1 ) -endfunction - -" magit#state#file_get_hunks: function accessor for hunks objects -" return: List of List of hunks lines -function! magit#state#file_get_hunks() dict - return self.diff.hunks -endfunction - -" magit#state#file_get_flat_hunks: function accessor for hunks lines -" return: all hunks lines of a file, including hunk headers -function! magit#state#file_get_flat_hunks() dict - let hunks = self.diff.hunks - let lines = [] - for hunk in hunks - call add(lines, hunk.header) - call add(lines, hunk.lines) - endfor - return lines -endfunction - -" s:hunk_template: template for hunk object (nested in s:diff_template) -" WARNING: this variable must be deepcopy()'ied -let s:hunk_template = { -\ 'header': '', -\ 'line_pos': 0, -\ 'lines': [], -\ 'marks': [], -\} - -" s:diff_template: template for diff object (nested in s:file_template) -" WARNING: this variable must be deepcopy()'ied -let s:diff_template = { -\ 'len': 0, -\ 'header': [], -\ 'hunks': [s:hunk_template], -\} - -" s:file_template: template for file object -" WARNING: this variable must be deepcopy()'ied -let s:file_template = { -\ 'new': 1, -\ 'exists': 0, -\ 'visible': 0, -\ 'filename': '', -\ 'status': '', -\ 'empty': 0, -\ 'dir': 0, -\ 'binary': 0, -\ 'submodule': 0, -\ 'symlink': '', -\ 'diff': s:diff_template, -\ 'line_pos': 0, -\ 'is_dir': function("magit#state#is_file_dir"), -\ 'is_visible': function("magit#state#is_file_visible"), -\ 'set_visible': function("magit#state#set_file_visible"), -\ 'init_visible': function("magit#state#init_file_visible"), -\ 'toggle_visible': function("magit#state#toggle_file_visible"), -\ 'must_be_added': function("magit#state#must_be_added"), -\ 'get_header': function("magit#state#file_get_header"), -\ 'get_hunks' : function("magit#state#file_get_hunks"), -\ 'get_flat_hunks' : function("magit#state#file_get_flat_hunks"), -\ 'get_filename_header' : function("magit#state#file_get_filename_header"), -\} - -" magit#state#get_file: function accessor for file -" param[in] mode: can be staged or unstaged -" param[in] filename: filename to access -" param[in] create: boolean. If 1, non existing file in Dict will be created. -" if 0, 'file_doesnt_exists' exception will be thrown -" return: Dict of file -function! magit#state#get_file(mode, filename, ...) dict - let file_exists = has_key(self.dict[a:mode], a:filename) - let create = ( a:0 == 1 ) ? a:1 : 0 - if ( file_exists == 0 && create == 1 ) - let self.dict[a:mode][a:filename] = deepcopy(s:file_template) - let self.dict[a:mode][a:filename].filename = a:filename - elseif ( file_exists == 0 && create == 0 ) - throw 'file_doesnt_exists' - endif - return self.dict[a:mode][a:filename] -endfunction - -" magit#state#file_get_header: function accessor for diff header -" param[in] mode: can be staged or unstaged -" param[in] filename: header of filename to access -" return: List of diff header lines -function! magit#state#file_get_header() dict - return self.diff.header -endfunction - -function! magit#state#file_get_filename_header() dict - if ( self.status == 'L' ) - return g:magit_git_status_code.L . ': ' . self.filename . ' -> ' . self.symlink - else - return g:magit_git_status_code[self.status] . ': ' . self.filename - endif -endfunction - -function! magit#state#check_max_lines(file) dict - let total_lines = self.nb_diff_lines + a:file.diff.len - if ( total_lines > g:magit_warning_max_lines && b:magit_warning_max_lines_answered == 0 ) - echohl WarningMsg - let ret = input("There are " . total_lines . " diff lines to display. Do you want to display all diffs? y(es) / N(o) : ", "") - echohl None - let b:magit_warning_max_lines_answered = 1 - if ( ret !~? '^y\%(e\%(s\)\?\)\?$' ) - call a:file.set_visible(0) - let a:file.diff.len = 0 - let b:magit_default_show_all_files = 0 - return 1 - endif - endif - return 0 -endfunction - -" magit#state#add_file: method to add a file with all its -" properties (filename, exists, status, header and hunks) -" param[in] mode: can be staged or unstaged -" param[in] status: one character status code of the file (AMDRCU?) -" param[in] filename: filename -function! magit#state#add_file(mode, status, filename, depth) dict - let file = self.get_file(a:mode, a:filename, 1) - let file.exists = 1 - - let file.status = a:status - let file.depth = a:depth - - " discard previous diff - let file.diff = deepcopy(s:diff_template) - - if ( a:status == '?' && getftype(a:filename) == 'link' ) - let file.status = 'L' - let file.symlink = resolve(a:filename) - let file.diff.hunks[0].header = 'New symbolic link file' - elseif ( magit#utils#is_submodule(a:filename)) - let file.status = 'S' - let file.submodule = 1 - if ( !file.is_visible() ) - return - endif - let diff_list=magit#git#git_sub_summary(magit#utils#add_quotes(a:filename), - \ a:mode) - let file.diff.len = len(diff_list) - - if ( self.check_max_lines(file) != 0 ) - return - endif - - let file.diff.hunks[0].header = '' - let file.diff.hunks[0].lines = diff_list - let self.nb_diff_lines += file.diff.len - elseif ( a:status == '?' && isdirectory(a:filename) == 1 ) - let file.status = 'N' - let file.dir = 1 - if ( !file.is_visible() ) - return - endif - for subfile in magit#utils#ls_all(a:filename) - call self.add_file(a:mode, a:status, subfile, a:depth + 1) - endfor - elseif ( a:status == '?' && getfsize(a:filename) == 0 ) - let file.status = 'E' - let file.empty = 1 - let file.diff.hunks[0].header = 'New empty file' - else - if ( !file.init_visible() ) - return - endif - let line = 0 - " match( - let [ is_bin, diff_list ] = - \ magit#git#git_diff(magit#utils#add_quotes(a:filename), - \ a:status, a:mode) - - if ( is_bin ) - let file.binary = 1 - let file.diff.hunks[0].header = 'Binary file' - if ( file.new ) - call file.set_visible(0) - endif - return - endif - - let file.diff.len = len(diff_list) - - if ( self.check_max_lines(file) != 0 ) - return - endif - - while ( line < file.diff.len && diff_list[line] !~ "^@.*" ) - call add(file.diff.header, diff_list[line]) - let line += 1 - endwhile - - if ( line < file.diff.len ) - let hunk = file.diff.hunks[0] - let hunk.header = diff_list[line] - - for diff_line in diff_list[line+1 : -1] - if ( diff_line =~ "^@.*" ) - let hunk = deepcopy(s:hunk_template) - call add(file.diff.hunks, hunk) - let hunk.header = diff_line - continue - endif - call add(hunk.lines, diff_line) - endfor - endif - let self.nb_diff_lines += file.diff.len - endif - -endfunction - -" magit#state#update: update self.dict -" if a file does not exists anymore (because all its changes have been -" committed, deleted, discarded), it is removed from g:mg_diff_dict -" else, its diff is discarded and regenrated -" what is resilient is its 'visible' parameter -function! magit#state#update() dict - let self.nb_diff_lines = 0 - for diff_dict_mode in values(self.dict) - for file in values(diff_dict_mode) - let file.exists = 0 - let file.new = 0 - " always discard previous diff - let file.diff = deepcopy(s:diff_template) - endfor - endfor - - let dir = getcwd() - try - call magit#utils#chdir(magit#git#top_dir()) - call magit#utils#refresh_submodule_list() - let status_list = magit#git#get_status() - for [mode, diff_dict_mode] in items(self.dict) - for file_status in status_list - let status=file_status[mode] - - " untracked code apperas in staged column, we skip it - if ( status == ' ' || ( ( mode == 'staged' ) && status == '?' ) ) - continue - endif - call self.add_file(mode, status, file_status.filename, 0) - endfor - endfor - finally - call magit#utils#chdir(dir) - endtry - - " remove files that have changed their mode or been committed/deleted/discarded... - for diff_dict_mode in values(self.dict) - for [key, file] in items(diff_dict_mode) - if ( file.exists == 0 ) - unlet diff_dict_mode[key] - endif - endfor - endfor -endfunction - -" magit#state#set_files_visible: global dict setter function -" update all files visible state -" param[in] is_visible: boolean value to set to files -function! magit#state#set_files_visible(is_visible) dict - for diff_dict_mode in values(self.dict) - for file in values(diff_dict_mode) - call file.set_visible(a:is_visible) - endfor - endfor -endfunction - -" magit#state#get_files: global dict file objects getter function -" param[in] mode: mode to select, can be 'staged' or 'unstaged' -" return list of file objects belonging to mode -function! magit#state#get_files(mode) dict - return self.dict[a:mode] -endfunction - -" magit#state#get_files_nb: returns the number of files in a given section -" param[in] mode: mode to select, can be 'staged' or 'unstaged' -" return number of files of this section -function! magit#state#get_files_nb(mode) dict - return len(self.dict[a:mode]) -endfunction - -" magit#state#get_files: global dict file objects (copy) getter function -" param[in] mode: mode to select, can be 'staged' or 'unstaged' -" return ordered list of file objects belonging to mode -function! magit#state#get_files_ordered(mode) dict - let modified = [] - let others = [] - for filename in sort(keys(self.dict[a:mode])) - let file = self.get_file(a:mode, filename) - if ( file.status == 'M' ) - call add(modified, file) - else - call add(others, file) - endif - endfor - return modified + others -endfunction - -" magit#state#get_filenames: global dict filenames getter function -" param[in] mode: mode to select, can be 'staged' or 'unstaged' -" return ordered list of filename strings belonging to mode, modified files -" first -function! magit#state#get_filenames(mode) dict - let files = self.get_files_ordered(a:mode) - return map(copy(files), 'v:val.filename') -endfunction - - -" dict: structure containing all diffs -" It is formatted as follow -" { -" 'staged': { -" 'filename': s:file_template, -" 'filename': s:file_template, -" ... -" }, -" 'unstaged': { -" 'filename': s:file_template, -" 'filename': s:file_template, -" ... -" }, -" } -let magit#state#state = { - \ 'nb_diff_lines': 0, - \ 'get_file': function("magit#state#get_file"), - \ 'get_files': function("magit#state#get_files"), - \ 'get_files_nb': function("magit#state#get_files_nb"), - \ 'get_files_ordered': function("magit#state#get_files_ordered"), - \ 'get_filenames': function("magit#state#get_filenames"), - \ 'add_file': function("magit#state#add_file"), - \ 'set_files_visible': function("magit#state#set_files_visible"), - \ 'check_max_lines': function("magit#state#check_max_lines"), - \ 'update': function("magit#state#update"), - \ 'dict': { 'staged': {}, 'unstaged': {}}, - \ } - diff --git a/.config/vim/autoload/magit/sys.vim b/.config/vim/autoload/magit/sys.vim @@ -1,119 +0,0 @@ -" ======= system wrappers ======= -" Recent vim/neovim versions introduced a new handy function, systemlist: -" > Same as |system()|, but returns a |List| with lines (parts of -" > output separated by NL) with NULs transformed into NLs. -" In the same time, they introduced the capabilty of system to take a list as -" parameter -" These two new behavior are emulated if not present. -" Moreover, v:shell_error are detected and an exception is thrown if any. -" Matching functions, without exception raising, are available. The problem is -" that if an error is awaited, the exception thrown discards the return value. - -" s:system: magit#sys#system internal, with explicit catch shell error -" parameter -" param[in] ...: command + optional args -" return: command output as a string -function! s:magit_system(...) - let dir = getcwd() - try - call magit#utils#chdir(magit#git#top_dir()) - " List as system() input is since v7.4.247, it is safe to check - " systemlist, which is sine v7.4.248 - if exists('*systemlist') - return call('system', a:000) - else - if ( a:0 == 2 ) - if ( type(a:2) == type([]) ) - " ouch, this one is tough: input is very very sensitive, join - " MUST BE done with "\n", not '\n' !! - let arg=join(a:2, "\n") - else - let arg=a:2 - endif - return system(a:1, arg) - else - return system(a:1) - endif - endif - finally - call magit#utils#chdir(dir) - endtry -endfunction - -" s:systemlist: magit#sys#systemlist internal, with explicit catch shell -" error parameter -" param[in] catch: boolean, do we throw an exception in case of shell error -" param[in] ...: command + optional args to execute, args can be List or String -" return: command output as a list -function! s:magit_systemlist(...) - let dir = getcwd() - try - call magit#utils#chdir(magit#git#top_dir()) - " systemlist since v7.4.248 - if exists('*systemlist') - return call('systemlist', a:000) - else - return split(call('s:magit_system', a:000), '\n') - endif - finally - call magit#utils#chdir(dir) - endtry -endfunction - -" magit#sys#system: wrapper for system, which only takes String as input in vim, -" although it can take String or List input in neovim. -" INFO: temporarly change pwd to git top directory, then restore to previous -" pwd at the end of function -" param[in] ...: command + optional args -" return: command output as a string -" throw 'shell_error' in case of shell error -function! magit#sys#system(...) - let ret = call('s:magit_system', a:000) - if ( v:shell_error != 0 ) - let b:magit_shell_error = string(ret) - let b:magit_shell_cmd = string(a:000) - throw 'shell_error' - endif - return ret -endfunction - -" magit#sys#systemlist: wrapper for systemlist, which only exists in neovim for -" the moment. -" INFO: temporarly change pwd to git top directory, then restore to previous -" pwd at the end of function -" param[in] ...: command + optional args to execute, args can be List or String -" return: command output as a list -" throw 'shell_error' in case of shell error -function! magit#sys#systemlist(...) - let ret = call('s:magit_systemlist', a:000) - if ( v:shell_error != 0 ) - let b:magit_shell_error = string(ret) - let b:magit_shell_cmd = string(a:000) - throw 'shell_error' - endif - return ret -endfunction - -" magit#sys#system_noraise: magit#sys#system alias, without error -" exception -" param[in] ...: command + optional args -" return: command output as a string -function! magit#sys#system_noraise(...) - return call('s:magit_system', a:000) -endfunction - -" magit#sys#systemlist_noraise: magit#sys#systemlist alias, without error -" exception -" param[in] ...: command + optional args to execute, args can be List or String -" return: command output as a list -function! magit#sys#systemlist_noraise(...) - return call('s:magit_systemlist', a:000) -endfunction - -function! magit#sys#print_shell_error() - echohl WarningMsg - echom "Shell command error" - echom "Cmd: " . b:magit_shell_cmd - echom "Error msg: " . b:magit_shell_error - echohl None -endfunction diff --git a/.config/vim/autoload/magit/utils.vim b/.config/vim/autoload/magit/utils.vim @@ -1,180 +0,0 @@ - -" magit#utils#ls_all: list all files (including hidden ones) in a given path -" return : list of filenames -function! magit#utils#ls_all(path) - return split(globpath(a:path, '.[^.]*', 1) . "\n" . - \ globpath(a:path, '*', 1), '\n') -endfunction - -let s:submodule_list = [] -" magit#utils#refresh_submodule_list: this function refresh the List s:submodule_list -" magit#utils#is_submodule() is using s:submodule_list -function! magit#utils#refresh_submodule_list() - let s:submodule_list = map(split(magit#git#submodule_status(), "\n"), 'split(v:val)[1]') -endfunction - -" magit#utils#is_submodule search if dirname is in s:submodule_list -" param[in] dirname: must end with / -" INFO: must be called from top work tree -function! magit#utils#is_submodule(dirname) - return ( index(s:submodule_list, a:dirname) != -1 ) -endfunction - -" magit#utils#chdir will change the directory respecting -" local/tab-local/global directory settings. -function! magit#utils#chdir(dir) - " This is a dirty hack to fix tcd breakages on neovim. - " Future work should be based on nvim API. - if exists(':tcd') - let chdir = haslocaldir() ? 'lcd' : haslocaldir(-1, 0) ? 'tcd' : 'cd' - else - let chdir = exists('*haslocaldir') && haslocaldir() ? 'lcd' : 'cd' - endif - execute chdir fnameescape(a:dir) -endfunction - -" magit#utils#clear_undo: this function clear local undo history. -" vimagit wants to clear undo history after each changes in vimagit buffer by -" vimagit backend. -" Use this function with caution: to be effective, the undo must be ack'ed -" with a change. The hack is the line -" exe "normal a \<BS>\<Esc>" -" We move on first line to make this trick where it should be no folding -function! magit#utils#clear_undo() - let old_undolevels = &l:undolevels - let cur_pos = line('.') - setlocal undolevels=-1 - call cursor(1, 0) - exe "normal a \<BS>\<Esc>" - call cursor(cur_pos, 0) - let &l:undolevels = old_undolevels - unlet old_undolevels -endfunction - -" magit#utils#underline: helper function to underline a string -" param[in] title: string to underline -" return a string composed of strlen(title) '=' -function! magit#utils#underline(title) - return substitute(a:title, ".", "=", "g") -endfunction - -" magit#utils#strip: helper function to strip a string -" WARNING: it only works with monoline string -" param[in] string: string to strip -" return: stripped string -function! magit#utils#strip(string) - return substitute(a:string, '^\s*\(.\{-}\)\s*\n\=$', '\1', '') -endfunction - -" magit#utils#strip_array: helper function to strip an array (remove empty rows -" on both sides) -" param[in] array: array to strop -" return: stripped array -function! magit#utils#strip_array(array) - let array_len = len(a:array) - let start = 0 - while ( start < array_len && a:array[start] == '' ) - let start += 1 - endwhile - let end = array_len - 1 - while ( end >= 0 && a:array[end] == '' ) - let end -= 1 - endwhile - return a:array[ start : end ] -endfunction - -" magit#utils#join_list: helper function to concatente a list of strings with newlines -" param[in] list: List to concat -" return: concatenated list -function! magit#utils#join_list(list) - return join(a:list, "\n") . "\n" -endfunction - -" magit#utils#add_quotes: helper function to protect filename with quotes -" return quoted filename -function! magit#utils#add_quotes(filename) - return '"' . a:filename . '"' -endfunction - -" magit#utils#remove_quotes: helper function to remove quotes aroudn filename -" return unquoted filename -function! magit#utils#remove_quotes(filename) - let ret=matchlist(a:filename, '"\([^"]*\)"') - if ( empty(ret) ) - throw 'no quotes found: ' . a:filename - endif - return ret[1] -endfunction - -" magit#utils#fatten: flat a nested list. it return a one dimensional list with -" primary elements -" https://gist.github.com/dahu/3322468 -" param[in] list: a List, can be nested or not -" return: one dimensional list -function! magit#utils#flatten(list) - let val = [] - for elem in a:list - if type(elem) == type([]) - call extend(val, magit#utils#flatten(elem)) - else - call extend(val, [elem]) - endif - unlet elem - endfor - return val -endfunction - -" magit#utils#append_file: helper function to append to a file -" Version working with file *possibly* containing trailing newline -" param[in] file: filename to append -" param[in] lines: List of lines to append -function! magit#utils#append_file(file, lines) - let fcontents=[] - if ( filereadable(a:file) ) - let fcontents=readfile(a:file, 'b') - endif - if !empty(fcontents) && empty(fcontents[-1]) - call remove(fcontents, -1) - endif - call writefile(fcontents+a:lines, a:file, 'b') -endfunction - -" s:bufnr: local variable to store current magit buffer id -let s:bufnr = 0 -" magit#utils#setbufnr: function to set current magit buffer id -" param[in] bufnr: current magit buffer id -function! magit#utils#setbufnr(bufnr) - let s:bufnr = a:bufnr -endfunction - -" magit#utils#bufnr: function to get current magit buffer id -" return: current magit buffer id -function! magit#utils#bufnr() - return s:bufnr -endfunction - -" magit#utils#search_buffer_in_windows: search if a buffer is displayed in one -" of opened windows -" NOTE: windo command modify winnr('#'), if you want to use it, save it before -" calling this function -" param[in] filename: filename to search -" return: window id, 0 if not found -function! magit#utils#search_buffer_in_windows(filename) - let cur_win = winnr() - let last_win = winnr('#') - let files={} - windo if ( !empty(@%) ) | let files[@%] = winnr() | endif - execute last_win."wincmd w" - execute cur_win."wincmd w" - return ( has_key(files, buffer_name(a:filename)) ) ? - \files[buffer_name(a:filename)] : 0 -endfunction - -function! magit#utils#start_profile(...) - let prof_file = ( a:0 == 1 ) ? a:1 : "/tmp/vimagit.log" - profdel * - execute "profile start " . prof_file . " | profile pause" - profile file * - profile func * - profile continue -endfunction diff --git a/.config/vim/colors/.vimrc b/.config/vim/colors/.vimrc diff --git a/.config/vim/colors/duochrome.vim b/.config/vim/colors/duochrome.vim @@ -1,313 +0,0 @@ -" Name: duochrome.vim -" Version: 0.1 -" Maintainer: github.com/sdothum -" License: The MIT License (MIT) -" -" Based on -" -" https://github.com/andreypopp/vim-colors-plain -" -" which in turn based on -" -" https://github.com/pbrisbin/vim-colors-off (MIT License) -" -" which in turn based on -" -" https://github.com/reedes/vim-colors-pencil (MIT License) -" -""" -hi clear - -if exists('syntax on') - syntax reset -endif - -let g:colors_name='duochrome' - -let s:black = { "gui": "#222222", "cterm": "0" } -let s:medium_gray = { "gui": "#767676", "cterm": "243" } -let s:white = { "gui": "#f7f3ee", "cterm": "15" } " flatwhite bg -let s:orange = { "gui": "#c18401", "cterm": "208" } " one color orange 2 -let s:light_black = { "gui": "#424242", "cterm": "8" } -let s:lighter_black = { "gui": "#545454", "cterm": "240" } -let s:subtle_black = { "gui": "#303030", "cterm": "236" } -let s:light_gray = { "gui": "#999999", "cterm": "249" } -let s:lighter_gray = { "gui": "#CCCCCC", "cterm": "251" } -let s:lightest_gray = { "gui": "#E5E5E5", "cterm": "251" } -let s:dark_red = { "gui": "#C30771", "cterm": "1" } -let s:light_red = { "gui": "#E32791", "cterm": "1" } -let s:dark_blue = { "gui": "#008EC4", "cterm": "4" } -let s:light_blue = { "gui": "#B6D6FD", "cterm": "153" } -let s:dark_cyan = { "gui": "#20A5BA", "cterm": "6" } -let s:light_cyan = { "gui": "#4FB8CC", "cterm": "14" } -let s:dark_green = { "gui": "#10A778", "cterm": "2" } -let s:light_green = { "gui": "#5FD7A7", "cterm": "10" } -let s:dark_purple = { "gui": "#523C79", "cterm": "5" } -let s:light_purple = { "gui": "#6855DE", "cterm": "13" } -let s:light_yellow = { "gui": "#F3E430", "cterm": "11" } -let s:dark_yellow = { "gui": "#A89C14", "cterm": "3" } -let s:iawriter = { "gui": "#20fccf", "cterm": "51" } " iA writer cursor - -if &background == "dark" - let s:bg = s:black - let s:bg_subtle = s:light_black - let s:bg_very_subtle = s:subtle_black - let s:norm = s:lighter_gray - let s:norm_subtle = s:light_gray - let s:norm_very_subtle = s:medium_gray - let s:purple = s:light_purple - let s:cyan = s:light_cyan - let s:green = s:light_green - let s:red = s:light_red - let s:yellow = s:light_yellow - let s:visual = s:lighter_black - let s:cursor_line = s:subtle_black - let s:constant = s:light_blue - let s:comment = s:light_gray - let s:selection = s:dark_yellow - let s:selection_fg = s:black - let s:ok = s:light_green - let s:warning = s:yellow - let s:error = s:light_red -else - let s:bg = s:white - let s:bg_subtle = s:lighter_gray - let s:bg_very_subtle = s:light_gray - let s:norm = s:light_black - let s:norm_subtle = s:lighter_black - let s:norm_very_subtle = s:medium_gray - let s:purple = s:dark_purple - let s:cyan = s:dark_cyan - let s:green = s:dark_green - let s:red = s:dark_red - let s:yellow = s:dark_yellow - let s:visual = s:light_blue - let s:cursor_line = s:white " no highlight - let s:constant = s:dark_blue - let s:comment = s:orange - let s:selection = s:light_yellow - let s:selection_fg = s:light_black - let s:ok = s:light_green - let s:warning = s:yellow - let s:error = s:dark_red -endif - -" unlet s:black -unlet s:medium_gray -unlet s:white -unlet s:orange -unlet s:light_black -unlet s:lighter_black -" unlet s:subtle_black -unlet s:light_gray -unlet s:lighter_gray -unlet s:lightest_gray -unlet s:dark_red -unlet s:light_red -unlet s:dark_blue -unlet s:light_blue -unlet s:dark_cyan -unlet s:light_cyan -unlet s:dark_green -unlet s:light_green -unlet s:dark_purple -unlet s:light_purple -unlet s:light_yellow -unlet s:dark_yellow - -" https://github.com/noahfrederick/vim-hemisu/ -function! s:h(group, style) - execute "highlight" a:group - \ "guifg=" (has_key(a:style, "fg") ? a:style.fg.gui : "NONE") - \ "guibg=" (has_key(a:style, "bg") ? a:style.bg.gui : "NONE") - \ "guisp=" (has_key(a:style, "sp") ? a:style.sp.gui : "NONE") - \ "gui=" (has_key(a:style, "gui") ? a:style.gui : "NONE") - \ "ctermfg=" (has_key(a:style, "fg") ? a:style.fg.cterm : "NONE") - \ "ctermbg=" (has_key(a:style, "bg") ? a:style.bg.cterm : "NONE") - \ "cterm=" (has_key(a:style, "cterm") ? a:style.cterm : "NONE") -endfunction - -" __Normal__ -if has("gui") - call s:h("Normal", {"fg": s:norm, "bg": s:bg}) - call s:h("Cursor", {"fg": s:black, "bg": s:iawriter}) " iA writer cursor -else - call s:h("Normal", {"fg": s:norm}) - hi! link Cursor Identifier -endif -hi! link Identifier Normal -hi! link Function Identifier -hi! link Type Normal -hi! link StorageClass Type -hi! link Structure Type -hi! link Typedef Type -hi! link Special Normal -hi! link SpecialChar Special -hi! link Tag Special -hi! link Delimiter Special -hi! link SpecialComment Special -hi! link Debug Special -hi! link VertSplit Normal -hi! link PreProc Normal -hi! link Define PreProc -hi! link Macro PreProc -hi! link PreCondit Comment " highlight code sections - -" __Operator__ -call s:h("Noise", {"fg": s:norm_subtle, "gui": "NONE"}) -hi! link Operator Noise -hi! link LineNr Noise -hi! link CursorLineNr LineNr -hi! link FoldColumn LineNr -hi! link SignColumn LineNr - -" __Comment__ -call s:h("Comment", {"fg": s:comment, "gui": "italic"}) - -" __Constant__ -call s:h("Constant", {"fg": s:constant}) -hi! link Character Constant -hi! link Number Constant -hi! link Boolean Constant -hi! link Float Constant -hi! link String Constant -hi! link Directory Constant -hi! link Title Constant - -" __Statement__ -call s:h("Statement", {"fg": s:subtle_black, "gui": "bold"}) -hi! link Include Statement -hi! link Conditonal Statement -hi! link Repeat Statement -hi! link Label Statement -hi! link Keyword Statement -hi! link Exception Statement - -" __ErrorMsg__ -call s:h("ErrorMsg", {"fg": s:error}) -hi! link Error ErrorMsg -hi! link Question ErrorMsg -" __WarningMsg__ -call s:h("WarningMsg", {"fg": s:warning}) -" __MoreMsg__ -call s:h("MoreMsg", {"fg": s:norm_subtle, "cterm": "bold", "gui": "bold"}) -hi! link ModeMsg MoreMsg - -" __NonText__ -call s:h("NonText", {"fg": s:norm_very_subtle}) -hi! link Folded NonText -hi! link qfLineNr NonText - -" __Search__ -call s:h("Search", {"bg": s:selection, "fg": s:selection_fg}) -call s:h("IncSearch", {"bg": s:selection, "fg": s:selection_fg, "gui": "bold"}) - -" __Visual__ -call s:h("Visual", {"bg": s:visual}) -" __VisualNOS__ -call s:h("VisualNOS", {"bg": s:bg_subtle}) - -call s:h("Ignore", {"fg": s:bg}) - -" __DiffAdd__ -call s:h("DiffAdd", {"fg": s:green}) -" __DiffDelete__ -call s:h("DiffDelete", {"fg": s:red}) -" __DiffChange__ -call s:h("DiffChange", {"fg": s:yellow}) -" __DiffText__ -call s:h("DiffText", {"fg": s:constant}) - -if has("gui_running") - call s:h("SpellBad", {"gui": "underline", "sp": s:red}) - call s:h("SpellCap", {"gui": "underline", "sp": s:ok}) - call s:h("SpellRare", {"gui": "underline", "sp": s:error}) - call s:h("SpellLocal", {"gui": "underline", "sp": s:ok}) -else - call s:h("SpellBad", {"cterm": "underline", "fg": s:red}) - call s:h("SpellCap", {"cterm": "underline", "fg": s:ok}) - call s:h("SpellRare", {"cterm": "underline", "fg": s:error}) - call s:h("SpellLocal", {"cterm": "underline", "fg": s:ok}) -endif - -hi! link helpHyperTextEntry Title -hi! link helpHyperTextJump String - -" __StatusLine__ -call s:h("StatusLine", {"gui": "underline", "bg": s:bg, "fg": s:norm_very_subtle}) -" __StatusLineNC__ -call s:h("StatusLineNC", {"gui": "underline", "bg": s:bg, "fg": s:bg_subtle}) -" __WildMenu__ -call s:h("WildMenu", {"gui": "underline,bold", "bg": s:bg, "fg": s:norm}) - -call s:h("StatusLineOk", {"gui": "underline", "bg": s:bg, "fg": s:ok}) -call s:h("StatusLineError", {"gui": "underline", "bg": s:bg, "fg": s:error}) -call s:h("StatusLineWarning", {"gui": "underline", "bg": s:bg, "fg": s:warning}) - -" __Pmenu__ -call s:h("Pmenu", {"fg": s:norm, "bg": s:cursor_line}) -hi! link PmenuSbar Pmenu -hi! link PmenuThumb Pmenu -" __PmenuSel__ -call s:h("PmenuSel", {"fg": s:norm, "bg": s:cursor_line, "gui": "bold"}) - -hi! link TabLine Normal -hi! link TabLineSel Keyword -hi! link TabLineFill Normal - -" __CursorLine__ -call s:h("CursorLine", {"bg": s:cursor_line}) -" __CursorColumn__ -call s:h("ColorColumn", {"bg": s:cursor_line}) - -" __MatchParen__ -call s:h("MatchParen", {"bg": s:bg_subtle, "fg": s:norm}) - -hi! link htmlH1 Normal -hi! link htmlH2 Normal -hi! link htmlH3 Normal -hi! link htmlH4 Normal -hi! link htmlH5 Normal -hi! link htmlH6 Normal - -hi link diffRemoved DiffDelete -hi link diffAdded DiffAdd - -" Signify, git-gutter -hi link SignifySignAdd LineNr -hi link SignifySignDelete LineNr -hi link SignifySignChange LineNr -hi link GitGutterAdd LineNr -hi link GitGutterDelete LineNr -hi link GitGutterChange LineNr -hi link GitGutterChangeDelete LineNr - -hi link jsFlowTypeKeyword Statement -hi link jsFlowImportType Statement -hi link jsFunction Statement -hi link jsGlobalObjects Normal -hi link jsGlobalNodeObjects Normal -hi link jsArrowFunction Noise -hi link StorageClass Statement - -hi link xmlTag Constant -hi link xmlTagName xmlTag -hi link xmlEndTag xmlTag -hi link xmlAttrib xmlTag - -hi link markdownH1 Statement -hi link markdownH2 Statement -hi link markdownH3 Statement -hi link markdownH4 Statement -hi link markdownH5 Statement -hi link markdownH6 Statement -hi link markdownListMarker Constant -hi link markdownCode Constant -hi link markdownCodeBlock Constant -hi link markdownCodeDelimiter Constant -hi link markdownHeadingDelimiter Constant - -hi link yamlBlockMappingKey Statement -hi link pythonOperator Statement - - diff --git a/.config/vim/colors/plain.vim b/.config/vim/colors/plain.vim @@ -1,294 +0,0 @@ -" Name: plain.vim -" Version: 0.1 -" Maintainer: github.com/andreypopp -" License: The MIT License (MIT) -" -" Based on -" -" https://github.com/pbrisbin/vim-colors-off (MIT License) -" -" which in turn based on -" -" https://github.com/reedes/vim-colors-pencil (MIT License) -" -""" -hi clear - -if exists('syntax on') - syntax reset -endif - -let g:colors_name='plain' - -let s:none = {"cterm": "NONE"} - -let s:dark_black = {"cterm": "0"} -let s:black = {"cterm": "8"} - -let s:dark_red = {"cterm": "1"} -let s:red = {"cterm": "9"} - -let s:dark_green = {"cterm": "2"} -let s:green = {"cterm": "10"} - -let s:dark_yellow = {"cterm": "3"} -let s:yellow = {"cterm": "11"} - -let s:dark_blue = {"cterm": "4"} -let s:blue = {"cterm": "12"} - -let s:dark_magenta = {"cterm": "5"} -let s:magenta = {"cterm": "13"} - -let s:dark_cyan = {"cterm": "6"} -let s:cyan = {"cterm": "14"} - -let s:dark_white = {"cterm": "7"} -let s:white = {"cterm": "15"} - -let s:always_dark_black = {"cterm": "16"} -let s:always_black = {"cterm": "17"} - -let s:always_dark_white = {"cterm": "18"} -let s:always_white = {"cterm": "19"} - -let s:bg = s:none -let s:bg_subtle = s:dark_white -let s:norm = s:none -let s:norm_subtle = s:black -let s:visual = s:cyan -let s:visual_fg = s:white -let s:cursor_line = {"cterm": "20"} -let s:constant = s:cyan -let s:comment = s:black -let s:selection = s:yellow -let s:selection_fg = s:always_dark_black -let s:ok = s:green -let s:warning = s:dark_yellow -let s:error = s:dark_red - -" https://github.com/noahfrederick/vim-hemisu/ -function! s:h(group, style) - execute "highlight" a:group - \ "ctermfg=" (has_key(a:style, "fg") ? a:style.fg.cterm : "NONE") - \ "ctermbg=" (has_key(a:style, "bg") ? a:style.bg.cterm : "NONE") - \ "cterm=" (has_key(a:style, "cterm") ? a:style.cterm : "NONE") - \ "guisp=" (has_key(a:style, "guisp") ? a:style.guisp : "NONE") - \ "guifg=NONE" - \ "guibg=NONE" - \ "gui=NONE" -endfunction - -" __Normal__ -if has("gui") - call s:h("Normal", {"fg": s:norm, "bg": s:bg}) - call s:h("Cursor", {"fg": s:bg, "bg": s:norm}) -else - call s:h("Normal", {"fg": s:norm}) - hi! link Cursor Identifier -endif -hi! link Identifier Normal -hi! link Function Identifier -hi! link Type Normal -hi! link StorageClass Type -hi! link Structure Type -hi! link Typedef Type -hi! link Special Normal -hi! link SpecialChar Special -hi! link Tag Special -hi! link Delimiter Special -hi! link SpecialComment Special -hi! link Debug Special -hi! link VertSplit Normal -hi! link PreProc Normal -hi! link Define PreProc -hi! link Macro PreProc -hi! link PreCondit PreProc - -" __Operator__ -call s:h("Noise", {"fg": s:norm_subtle}) -hi! link Operator Noise -hi! link LineNr Noise -hi! link CursorLineNr LineNr -hi! link FoldColumn LineNr -hi! link SignColumn LineNr - -" __Comment__ -call s:h("Comment", {"fg": s:comment, "cterm": "italic"}) - -" __Constant__ -call s:h("Constant", {"fg": s:constant}) -hi! link Character Constant -hi! link Number Constant -hi! link Boolean Constant -hi! link Float Constant -hi! link String Constant -hi! link Directory Constant -hi! link Title Constant - -" __Statement__ -call s:h("Statement", {"fg": s:norm, "cterm": "bold"}) -hi! link Include Statement -hi! link Conditonal Statement -hi! link Repeat Statement -hi! link Label Statement -hi! link Keyword Statement -hi! link Exception Statement - -" __ExtraWhitespace__ -call s:h("ExtraWhitespace", {"bg": s:error}) - -" __ErrorMsg__ -call s:h("ErrorMsg", {"fg": s:error}) -hi! link Error ErrorMsg -hi! link Question ErrorMsg -" __WarningMsg__ -call s:h("WarningMsg", {"fg": s:warning}) -" __InfoMsg__ -call s:h("InfoMsg", {"fg": s:dark_magenta, "cterm": "bold"}) -" __MoreMsg__ -call s:h("MoreMsg", {"fg": s:norm_subtle, "cterm": "bold"}) -hi! link ModeMsg MoreMsg - -" __NonText__ -call s:h("NonText", {"fg": s:norm_subtle}) -hi! link Folded NonText -hi! link qfLineNr NonText - -" __Visual__ -call s:h("Visual", {"bg": s:visual, "fg": s:visual_fg}) -" __VisualNOS__ -call s:h("VisualNOS", {"bg": s:bg_subtle, "fg": s:visual_fg}) - -call s:h("Ignore", {"fg": s:bg}) - -" __DiffAdd__ -call s:h("DiffAdd", {"fg": s:dark_green}) -" __DiffDelete__ -call s:h("DiffDelete", {"fg": s:dark_red}) -" __DiffChange__ -call s:h("DiffChange", {"fg": s:dark_yellow}) -" __DiffText__ -call s:h("DiffText", {"fg": s:constant}) - -if has("gui_running") - call s:h("SpellBad", {"sp": s:dark_red}) - call s:h("SpellCap", {"sp": s:ok}) - call s:h("SpellRare", {"sp": s:error}) - call s:h("SpellLocal", {"sp": s:ok}) -else - call s:h("SpellBad", {"cterm": "underline", "fg": s:dark_red}) - call s:h("SpellCap", {"cterm": "underline", "fg": s:ok}) - call s:h("SpellRare", {"cterm": "underline", "fg": s:error}) - call s:h("SpellLocal", {"cterm": "underline", "fg": s:ok}) -endif - -hi! link helpHyperTextEntry Title -hi! link helpHyperTextJump String - -call s:h("StatusLine", { - \"cterm": "bold,underline", - \"bg": s:bg, - \"fg": s:norm - \}) -call s:h("StatusLineNC", { - \"cterm": "bold,underline", - \"bg": s:bg, - \"fg": s:bg_subtle - \}) - -" Semantic status line highlights -call s:h("StatusLineOk", { - \"cterm": "bold,underline", - \"bg": s:bg, - \"fg": s:ok - \}) -call s:h("StatusLineError", { - \"cterm": "bold,underline", - \"bg": s:bg, - \"fg": s:error - \}) -call s:h("StatusLineWarning", { - \"cterm": "bold,underline", - \"bg": s:bg, - \"fg": s:warning - \}) - -call s:h("WildMenu", {"cterm": "underline,bold", "bg": s:bg, "fg": s:norm}) - -" __Pmenu__ -call s:h("Pmenu", {"fg": s:norm, "bg": s:cursor_line}) -hi! link PmenuSbar Pmenu -hi! link PmenuThumb Pmenu -" __PmenuSel__ -call s:h("PmenuSel", {"fg": s:norm, "bg": s:cursor_line, "cterm": "bold"}) - -hi! link TabLine Normal -hi! link TabLineSel Keyword -hi! link TabLineFill Normal - -" __CursorLine__ -call s:h("CursorLine", {"bg": s:cursor_line}) -" __CursorColumn__ -call s:h("ColorColumn", {"bg": s:cursor_line}) - -" __MatchParen__ -call s:h("MatchParen", {"bg": s:yellow, "fg": s:always_dark_black}) - -hi! link htmlH1 Normal -hi! link htmlH2 Normal -hi! link htmlH3 Normal -hi! link htmlH4 Normal -hi! link htmlH5 Normal -hi! link htmlH6 Normal - -hi link diffRemoved DiffDelete -hi link diffAdded DiffAdd - -" Signify, git-gutter -hi link SignifySignAdd LineNr -hi link SignifySignDelete LineNr -hi link SignifySignChange LineNr -hi link GitGutterAdd LineNr -hi link GitGutterDelete LineNr -hi link GitGutterChange LineNr -hi link GitGutterChangeDelete LineNr - -hi link jsFlowTypeKeyword Statement -hi link jsFlowImportType Statement -hi link jsFunction Statement -hi link jsGlobalObjects Normal -hi link jsGlobalNodeObjects Normal -hi link jsArrowFunction Noise -hi link StorageClass Statement - -hi link xmlTag Constant -hi link xmlTagName xmlTag -hi link xmlEndTag xmlTag -hi link xmlAttrib xmlTag - -hi link markdownH1 Statement -hi link markdownH2 Statement -hi link markdownH3 Statement -hi link markdownH4 Statement -hi link markdownH5 Statement -hi link markdownH6 Statement -hi link markdownListMarker Constant -hi link markdownCode Constant -hi link markdownCodeBlock Constant -hi link markdownCodeDelimiter Constant -hi link markdownHeadingDelimiter Constant - -hi link yamlBlockMappingKey Statement -hi link pythonOperator Statement - -hi link ALEWarning WarningMsg -hi link ALEWarningSign WarningMsg -hi link ALEError ErrorMsg -hi link ALEErrorSign ErrorMsg -hi link ALEInfo InfoMsg -hi link ALEInfoSign InfoMsg - -" __Search__ (make sure it comes after everything else) -call s:h("Search", {"bg": s:selection, "fg": s:selection_fg}) -hi! link IncSearch Search diff --git a/.config/vim/colors/wal.vim b/.config/vim/colors/wal.vim @@ -1,196 +0,0 @@ -" wal.vim -- Vim color scheme. -" Author: Dylan Araps -" Webpage: https://github.com/dylanaraps/wal -" Description: A colorscheme that uses your terminal colors, made to work with 'wal'. - -hi clear -set background=dark - -if exists('syntax_on') - syntax reset -endif - -" Colorscheme name -let g:colors_name = 'wal' - -" highlight groups {{{ - -" set t_Co=16 -hi Normal ctermbg=NONE ctermfg=7 -hi NonText ctermbg=NONE ctermfg=0 -hi Comment ctermbg=NONE ctermfg=8 -hi Constant ctermbg=NONE ctermfg=3 -hi Error ctermbg=1 ctermfg=7 -hi Identifier ctermbg=NONE ctermfg=1 cterm=BOLD -hi Ignore ctermbg=8 ctermfg=0 -hi PreProc ctermbg=NONE ctermfg=3 -hi Special ctermbg=NONE ctermfg=6 -hi Statement ctermbg=NONE ctermfg=1 -hi String ctermbg=NONE ctermfg=2 -hi Number ctermbg=NONE ctermfg=3 -hi Todo ctermbg=2 ctermfg=0 -hi Type ctermbg=NONE ctermfg=3 -hi Underlined ctermbg=NONE ctermfg=1 cterm=underline -hi StatusLine ctermbg=7 ctermfg=0 -hi StatusLineNC ctermbg=8 ctermfg=0 -hi TabLine ctermbg=NONE ctermfg=8 -hi TabLineFill ctermbg=NONE ctermfg=8 -hi TabLineSel ctermbg=4 ctermfg=0 -hi TermCursorNC ctermbg=3 ctermfg=0 -hi VertSplit ctermbg=8 ctermfg=0 -hi Title ctermbg=NONE ctermfg=4 -hi CursorLine ctermbg=2 ctermfg=0 -hi LineNr ctermbg=NONE ctermfg=8 -hi CursorLineNr ctermbg=NONE ctermfg=8 -hi helpLeadBlank ctermbg=NONE ctermfg=7 -hi helpNormal ctermbg=NONE ctermfg=7 -hi Visual ctermbg=0 ctermfg=15 cterm=reverse term=reverse -hi VisualNOS ctermbg=NONE ctermfg=1 -hi Pmenu ctermbg=8 ctermfg=7 -hi PmenuSbar ctermbg=6 ctermfg=7 -hi PmenuSel ctermbg=4 ctermfg=0 -hi PmenuThumb ctermbg=8 ctermfg=8 -hi FoldColumn ctermbg=NONE ctermfg=7 -hi Folded ctermbg=NONE ctermfg=8 -hi WildMenu ctermbg=2 ctermfg=0 -hi SpecialKey ctermbg=NONE ctermfg=8 -hi DiffAdd ctermbg=NONE ctermfg=2 -hi DiffChange ctermbg=NONE ctermfg=8 -hi DiffDelete ctermbg=NONE ctermfg=1 -hi DiffText ctermbg=NONE ctermfg=4 -hi IncSearch ctermbg=3 ctermfg=0 -hi Search ctermbg=3 ctermfg=0 -hi Directory ctermbg=NONE ctermfg=4 -hi MatchParen ctermbg=1 ctermfg=8 -hi ColorColumn ctermbg=4 ctermfg=0 -hi signColumn ctermbg=NONE ctermfg=4 -hi ErrorMsg ctermbg=NONE ctermfg=8 -hi ModeMsg ctermbg=NONE ctermfg=2 -hi MoreMsg ctermbg=NONE ctermfg=2 -hi Question ctermbg=NONE ctermfg=4 -hi WarningMsg ctermbg=1 ctermfg=0 -hi Cursor ctermbg=NONE ctermfg=8 -hi Structure ctermbg=NONE ctermfg=5 -hi CursorColumn ctermbg=8 ctermfg=7 -hi ModeMsg ctermbg=NONE ctermfg=7 -hi SpellBad ctermbg=NONE ctermfg=1 cterm=underline -hi SpellCap ctermbg=NONE ctermfg=4 cterm=underline -hi SpellLocal ctermbg=NONE ctermfg=5 cterm=underline -hi SpellRare ctermbg=NONE ctermfg=6 cterm=underline -hi Boolean ctermbg=NONE ctermfg=5 -hi Character ctermbg=NONE ctermfg=1 -hi Conditional ctermbg=NONE ctermfg=5 -hi Define ctermbg=NONE ctermfg=5 -hi Delimiter ctermbg=NONE ctermfg=5 -hi Float ctermbg=NONE ctermfg=5 -hi Include ctermbg=NONE ctermfg=4 -hi Keyword ctermbg=NONE ctermfg=5 -hi Label ctermbg=NONE ctermfg=3 -hi Operator ctermbg=NONE ctermfg=7 -hi Repeat ctermbg=NONE ctermfg=3 -hi SpecialChar ctermbg=NONE ctermfg=5 -hi Tag ctermbg=NONE ctermfg=3 -hi Typedef ctermbg=NONE ctermfg=3 -hi vimUserCommand ctermbg=NONE ctermfg=1 cterm=BOLD - hi link vimMap vimUserCommand - hi link vimLet vimUserCommand - hi link vimCommand vimUserCommand - hi link vimFTCmd vimUserCommand - hi link vimAutoCmd vimUserCommand - hi link vimNotFunc vimUserCommand -hi vimNotation ctermbg=NONE ctermfg=4 -hi vimMapModKey ctermbg=NONE ctermfg=4 -hi vimBracket ctermbg=NONE ctermfg=7 -hi vimCommentString ctermbg=NONE ctermfg=8 -hi htmlLink ctermbg=NONE ctermfg=1 cterm=underline -hi htmlBold ctermbg=NONE ctermfg=3 cterm=BOLD -hi htmlItalic ctermbg=NONE ctermfg=5 -hi htmlEndTag ctermbg=NONE ctermfg=7 -hi htmlTag ctermbg=NONE ctermfg=7 -hi htmlTagName ctermbg=NONE ctermfg=1 cterm=BOLD -hi htmlH1 ctermbg=NONE ctermfg=7 - hi link htmlH2 htmlH1 - hi link htmlH3 htmlH1 - hi link htmlH4 htmlH1 - hi link htmlH5 htmlH1 - hi link htmlH6 htmlH1 -hi cssMultiColumnAttr ctermbg=NONE ctermfg=2 - hi link cssFontAttr cssMultiColumnAttr - hi link cssFlexibleBoxAttr cssMultiColumnAttr -hi cssBraces ctermbg=NONE ctermfg=7 - hi link cssAttrComma cssBraces -hi cssValueLength ctermbg=NONE ctermfg=7 -hi cssUnitDecorators ctermbg=NONE ctermfg=7 -hi cssValueNumber ctermbg=NONE ctermfg=7 - hi link cssValueLength cssValueNumber -hi cssNoise ctermbg=NONE ctermfg=8 -hi cssTagName ctermbg=NONE ctermfg=1 -hi cssFunctionName ctermbg=NONE ctermfg=4 -hi scssSelectorChar ctermbg=NONE ctermfg=7 -hi scssAttribute ctermbg=NONE ctermfg=7 - hi link scssDefinition cssNoise -hi sassidChar ctermbg=NONE ctermfg=1 -hi sassClassChar ctermbg=NONE ctermfg=5 -hi sassInclude ctermbg=NONE ctermfg=5 -hi sassMixing ctermbg=NONE ctermfg=5 -hi sassMixinName ctermbg=NONE ctermfg=4 -hi javaScript ctermbg=NONE ctermfg=7 -hi javaScriptBraces ctermbg=NONE ctermfg=7 -hi javaScriptNumber ctermbg=NONE ctermfg=5 -hi markdownH1 ctermbg=NONE ctermfg=7 - hi link markdownH2 markdownH1 - hi link markdownH3 markdownH1 - hi link markdownH4 markdownH1 - hi link markdownH5 markdownH1 - hi link markdownH6 markdownH1 -hi markdownAutomaticLink ctermbg=NONE ctermfg=2 cterm=underline - hi link markdownUrl markdownAutomaticLink -hi markdownError ctermbg=NONE ctermfg=7 -hi markdownCode ctermbg=NONE ctermfg=3 -hi markdownCodeBlock ctermbg=NONE ctermfg=3 -hi markdownCodeDelimiter ctermbg=NONE ctermfg=5 -hi markdownItalic cterm=Italic -hi markdownBold cterm=Bold -hi xdefaultsValue ctermbg=NONE ctermfg=7 -hi rubyInclude ctermbg=NONE ctermfg=4 -hi rubyDefine ctermbg=NONE ctermfg=5 -hi rubyFunction ctermbg=NONE ctermfg=4 -hi rubyStringDelimiter ctermbg=NONE ctermfg=2 -hi rubyInteger ctermbg=NONE ctermfg=3 -hi rubyAttribute ctermbg=NONE ctermfg=4 -hi rubyConstant ctermbg=NONE ctermfg=3 -hi rubyInterpolation ctermbg=NONE ctermfg=2 -hi rubyInterpolationDelimiter ctermbg=NONE ctermfg=3 -hi rubyRegexp ctermbg=NONE ctermfg=6 -hi rubySymbol ctermbg=NONE ctermfg=2 -hi rubyTodo ctermbg=NONE ctermfg=8 -hi rubyRegexpAnchor ctermbg=NONE ctermfg=7 - hi link rubyRegexpQuantifier rubyRegexpAnchor -hi pythonOperator ctermbg=NONE ctermfg=5 -hi pythonFunction ctermbg=NONE ctermfg=4 -hi pythonRepeat ctermbg=NONE ctermfg=5 -hi pythonStatement ctermbg=NONE ctermfg=1 cterm=Bold -hi pythonBuiltIn ctermbg=NONE ctermfg=4 -hi phpMemberSelector ctermbg=NONE ctermfg=7 -hi phpComparison ctermbg=NONE ctermfg=7 -hi phpParent ctermbg=NONE ctermfg=7 -hi cOperator ctermbg=NONE ctermfg=6 -hi cPreCondit ctermbg=NONE ctermfg=5 -hi SignifySignAdd ctermbg=NONE ctermfg=2 -hi SignifySignChange ctermbg=NONE ctermfg=4 -hi SignifySignDelete ctermbg=NONE ctermfg=1 -hi NERDTreeDirSlash ctermbg=NONE ctermfg=4 -hi NERDTreeExecFile ctermbg=NONE ctermfg=7 -hi ALEErrorSign ctermbg=NONE ctermfg=1 -hi ALEWarningSign ctermbg=NONE ctermfg=3 -hi ALEError ctermbg=NONE ctermfg=1 -hi ALEWarning ctermbg=NONE ctermfg=3 - -" }}} - -" Plugin options {{{ - -let g:limelight_conceal_ctermfg = 8 - -" }}} - diff --git a/.config/vim/common/magit_common.vim b/.config/vim/common/magit_common.vim @@ -1,62 +0,0 @@ -" Section names -" These are used to beautify the magit buffer and to help for some block -" selection -let g:magit_sections = { - \ 'info': 'Info', - \ 'help': 'Help', - \ 'staged': 'Staged changes', - \ 'unstaged': 'Unstaged changes', - \ 'commit': 'Commit message', - \ 'stash': 'Stash list' - \ } - -let g:magit_section_info = { - \ 'cur_repo': 'Repository:', - \ 'cur_head': 'Head:', - \ 'cur_upstream': 'Upstream:', - \ 'cur_push': 'Push:', - \ 'commit_mode': 'Commit mode:', - \ } - -let g:magit_git_status_code = { - \ 'M': 'modified', - \ 'A': 'added', - \ 'D': 'deleted', - \ 'R': 'renamed', - \ 'T': 'typechanged', - \ 'C': 'copied', - \ 'U': 'updated but unmerged', - \ '?': 'untracked', - \ '!': 'ignored', - \ 'E': 'empty', - \ 'L': 'symlink', - \ 'N': 'new dir', - \ 'S': 'submodule', - \ } - -let g:magit_commit_mode = { - \ 'CC': 'normal', - \ 'CA': 'amend', - \ } - -" Regular expressions used to select blocks -let g:magit_file_re = '^\(' -for status_code in values(g:magit_git_status_code) - let g:magit_file_re .= status_code . '\|' -endfor -let g:magit_file_re .= 'unknown status\): \(.\{-\}\)\%( -> .*\)\?$' - -let g:magit_section_re = '^\(' -for section_name in values(g:magit_sections) - let g:magit_section_re .= section_name . '\|' -endfor -let g:magit_section_re .= 'unknown section\)$' - -let g:magit_diff_re = '^diff --git' -let g:magit_end_diff_re = '^$' -let g:magit_stash_re = '^stash@{\d\+}:' -let g:magit_hunk_re = '^@@ -\(\d\+\),\?\(\d*\) +\(\d\+\),\?\(\d*\) @@' -let g:magit_bin_re = '^Binary files ' -let g:magit_eof_re = '\%$' - - diff --git a/.config/vim/plugin/commentary.vim b/.config/vim/plugin/commentary.vim @@ -1,117 +0,0 @@ -" commentary.vim - Comment stuff out -" Maintainer: Tim Pope <http://tpo.pe/> -" Version: 1.3 -" GetLatestVimScripts: 3695 1 :AutoInstall: commentary.vim - -if exists("g:loaded_commentary") || v:version < 700 - finish -endif -let g:loaded_commentary = 1 - -function! s:surroundings() abort - return split(get(b:, 'commentary_format', substitute(substitute(substitute( - \ &commentstring, '^$', '%s', ''), '\S\zs%s',' %s', '') ,'%s\ze\S', '%s ', '')), '%s', 1) -endfunction - -function! s:strip_white_space(l,r,line) abort - let [l, r] = [a:l, a:r] - if l[-1:] ==# ' ' && stridx(a:line,l) == -1 && stridx(a:line,l[0:-2]) == 0 - let l = l[:-2] - endif - if r[0] ==# ' ' && a:line[-strlen(r):] != r && a:line[1-strlen(r):] == r[1:] - let r = r[1:] - endif - return [l, r] -endfunction - -function! s:go(...) abort - if !a:0 - let &operatorfunc = matchstr(expand('<sfile>'), '[^. ]*$') - return 'g@' - elseif a:0 > 1 - let [lnum1, lnum2] = [a:1, a:2] - else - let [lnum1, lnum2] = [line("'["), line("']")] - endif - - let [l, r] = s:surroundings() - let uncomment = 2 - for lnum in range(lnum1,lnum2) - let line = matchstr(getline(lnum),'\S.*\s\@<!') - let [l, r] = s:strip_white_space(l,r,line) - if len(line) && (stridx(line,l) || line[strlen(line)-strlen(r) : -1] != r) - let uncomment = 0 - endif - endfor - - if get(b:, 'commentary_startofline') - let indent = '^' - else - let indent = '^\s*' - endif - - for lnum in range(lnum1,lnum2) - let line = getline(lnum) - if strlen(r) > 2 && l.r !~# '\\' - let line = substitute(line, - \'\M'.r[0:-2].'\zs\d\*\ze'.r[-1:-1].'\|'.l[0].'\zs\d\*\ze'.l[1:-1], - \'\=substitute(submatch(0)+1-uncomment,"^0$\\|^-\\d*$","","")','g') - endif - if uncomment - let line = substitute(line,'\S.*\s\@<!','\=submatch(0)[strlen(l):-strlen(r)-1]','') - else - let line = substitute(line,'^\%('.matchstr(getline(lnum1),indent).'\|\s*\)\zs.*\S\@<=','\=l.submatch(0).r','') - endif - call setline(lnum,line) - endfor - let modelines = &modelines - try - set modelines=0 - silent doautocmd User CommentaryPost - finally - let &modelines = modelines - endtry - return '' -endfunction - -function! s:textobject(inner) abort - let [l, r] = s:surroundings() - let lnums = [line('.')+1, line('.')-2] - for [index, dir, bound, line] in [[0, -1, 1, ''], [1, 1, line('$'), '']] - while lnums[index] != bound && line ==# '' || !(stridx(line,l) || line[strlen(line)-strlen(r) : -1] != r) - let lnums[index] += dir - let line = matchstr(getline(lnums[index]+dir),'\S.*\s\@<!') - let [l, r] = s:strip_white_space(l,r,line) - endwhile - endfor - while (a:inner || lnums[1] != line('$')) && empty(getline(lnums[0])) - let lnums[0] += 1 - endwhile - while a:inner && empty(getline(lnums[1])) - let lnums[1] -= 1 - endwhile - if lnums[0] <= lnums[1] - execute 'normal! 'lnums[0].'GV'.lnums[1].'G' - endif -endfunction - -command! -range -bar Commentary call s:go(<line1>,<line2>) -xnoremap <expr> <Plug>Commentary <SID>go() -nnoremap <expr> <Plug>Commentary <SID>go() -nnoremap <expr> <Plug>CommentaryLine <SID>go() . '_' -onoremap <silent> <Plug>Commentary :<C-U>call <SID>textobject(get(v:, 'operator', '') ==# 'c')<CR> -nnoremap <silent> <Plug>ChangeCommentary c:<C-U>call <SID>textobject(1)<CR> -nmap <silent> <Plug>CommentaryUndo :echoerr "Change your <Plug>CommentaryUndo map to <Plug>Commentary<Plug>Commentary"<CR> - -if !hasmapto('<Plug>Commentary') || maparg('gc','n') ==# '' - xmap gc <Plug>Commentary - nmap gc <Plug>Commentary - omap gc <Plug>Commentary - nmap gcc <Plug>CommentaryLine - if maparg('c','n') ==# '' && !exists('v:operator') - nmap cgc <Plug>ChangeCommentary - endif - nmap gcu <Plug>Commentary<Plug>Commentary -endif - -" vim:set et sw=2: diff --git a/.config/vim/plugin/deadkeys.vim b/.config/vim/plugin/deadkeys.vim @@ -1,253 +0,0 @@ -let g:DeadKeysOn=0 - -function! ToggleDeadKeys() - if !g:DeadKeysOn - call DeadKeys() - else - call DeadKeysOff() - endif -endfunction - -function! DeadKeys() - echo "Dead Keys: On" - let g:DeadKeysOn=1 - " grave accents - imap `a à - imap `e è - imap `i ì - imap `o ò - imap `u ù - imap `A À - imap `E È - imap `I Ì - imap `O Ò - imap `U Ù - imap `<space> ` - - " umlaut - imap "a ä - imap "e ë - imap "i ï - imap "o ö - imap "u ü - imap "A Ä - imap "E Ë - imap "I Ï - imap "O Ö - imap "U Ü - imap "<space> " - - " macrons - imap :a ā - imap :e ē - imap :i ī - imap :o ō - imap :u ū - imap :A Ā - imap :E Ē - imap :I Ī - imap :O Ō - imap :U Ū - - " acute accents - imap 'a á - imap 'A Á - imap 'C Ć - imap 'c ć - imap 'e é - imap 'E É - imap 'i í - imap 'I Í - imap 'N Ń - imap 'n ń - imap 'o ó - imap 'R Ŕ - imap 'r ŕ - imap 'S Ś - imap 's ś - imap 'O Ó - imap 'u ú - imap 'U Ú - imap '<space> ' - - " under dot - imap .D Ḍ - imap .d ḍ - imap .H Ḥ - imap .h ḥ - imap .L Ḹ - imap .l ḹ - imap .M Ṃ - imap .m ṃ - imap .N Ṇ - imap .n ṇ - imap .R Ṛ - imap .r ṛ - imap .G Ṝ - imap .g ṝ - imap .S Ṣ - imap .s ṣ - imap .T Ṭ - imap .t ṭ - - " tilde - imap ~a ã - imap ~A à - imap ~e ẽ - imap ~E Ẽ - imap ~i ĩ - imap ~I Ĩ - imap ~o õ - imap ~O Õ - imap ~u ũ - imap ~U Ũ - imap ~n ñ - imap ~N Ñ - - " caron - imap >A Ǎ - imap >a ǎ - imap >C Č - imap >c č - imap >E Ě - imap >e ě - imap >G Ǧ - imap >g ǧ - imap >I Ǐ - imap >i ǐ - imap >O Ǒ - imap >o ǒ - imap >R Ř - imap >r ř - imap >S Ṧ - imap >s ṧ - imap >U Ǔ - imap >u ǔ - imap >V Ǚ - imap >v ǚ - imap >Z Ž - imap >z ž - -endfunction "deadkeys() - - -function! DeadKeysOff() - echo "Dead Keys: Off" - let g:DeadKeysOn=0 - - " unmapping graves - iunmap `a - iunmap `e - iunmap `i - iunmap `o - iunmap `u - iunmap `A - iunmap `E - iunmap `I - iunmap `O - iunmap `U - iunmap `<space> - - " unmapping umlauts - iunmap "a - iunmap "e - iunmap "i - iunmap "o - iunmap "u - iunmap "A - iunmap "E - iunmap "I - iunmap "O - iunmap "U - iunmap "<space> - - " unmapping macrons - iunmap :a - iunmap :e - iunmap :i - iunmap :o - iunmap :u - iunmap :A - iunmap :E - iunmap :I - iunmap :O - iunmap :U - - " unmapping acutes - iunmap 'a - iunmap 'A - iunmap 'C - iunmap 'c - iunmap 'e - iunmap 'E - iunmap 'i - iunmap 'I - iunmap 'N - iunmap 'n - iunmap 'o - iunmap 'R - iunmap 'r - iunmap 'S - iunmap 's - iunmap 'O - iunmap 'u - iunmap 'U - iunmap '<space> - " under dot - iunmap .D - iunmap .d - iunmap .H - iunmap .h - iunmap .L - iunmap .l - iunmap .M - iunmap .m - iunmap .N - iunmap .n - iunmap .R - iunmap .r - iunmap .G - iunmap .g - iunmap .S - iunmap .s - iunmap .T - iunmap .t - - "tilde - iunmap ~a - iunmap ~A - iunmap ~e - iunmap ~E - iunmap ~i - iunmap ~I - iunmap ~o - iunmap ~O - iunmap ~u - iunmap ~U - iunmap ~n - - " caron - iunmap >A - iunmap >a - iunmap >C - iunmap >c - iunmap >E - iunmap >e - iunmap >G - iunmap >g - iunmap >I - iunmap >i - iunmap >O - iunmap >o - iunmap >R - iunmap >r - iunmap >S - iunmap >s - iunmap >U - iunmap >u - iunmap >V - iunmap >v - iunmap >Z - iunmap >z - -endfunction diff --git a/.config/vim/plugin/goyo.vim b/.config/vim/plugin/goyo.vim @@ -1,24 +0,0 @@ -" Copyright (c) 2015 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. - -command! -nargs=? -bar -bang Goyo call goyo#execute(<bang>0, <q-args>) diff --git a/.config/vim/plugin/ipa.vim b/.config/vim/plugin/ipa.vim @@ -1,186 +0,0 @@ -let g:IPAOn=0 - -function! ToggleIPA() - if !g:IPAOn - call IPA() - else - call IPAOff() - endif -endfunction - -function! IPA() - echo "IPA macros activated" - let g:IPAOn=1 - imap ,nn ɲ̊ - imap ,gn ɲ - imap ,ng ŋ - imap ,' ʔ - imap ,sh ʃ - imap ,zh ʒ - imap ,xi ɕ - imap ,zi ʑ - imap ,ph ɸ - imap ,bh β - imap ,th θ - imap ,dh ð - imap ,cc ç - imap ,jj ʝ - imap ,gh ɣ - imap ,xx χ - imap ,fr ʁ - imap ,HH ħ - imap ,hh ɦ - imap ,vv ʋ - imap ,er ɹ - imap ,fl ɾ - imap ,bb ʙ - imap ,ih ɨ - imap ,ii ɪ - imap ,eu ɯ̽ - imap ,uu ʊ - imap ,uh ə - imap ,eh ɛ - imap ,oe œ - imap ,au ɔ - imap ,ae æ - imap ,aa ɐ - imap ,OE ɶ - imap ,ah ɑ - imap ,ba ɒ -endfunction - -function! IPAOff() - echo "IPA macros off." - let g:IPAOn=0 - iunmap ,nn - iunmap ,gn - iunmap ,ng - iunmap ,' - iunmap ,sh - iunmap ,zh - iunmap ,xi - iunmap ,zi - iunmap ,ph - iunmap ,bh - iunmap ,th - iunmap ,dh - iunmap ,cc - iunmap ,jj - iunmap ,gh - iunmap ,xx - iunmap ,fr - iunmap ,HH - iunmap ,hh - iunmap ,vv - iunmap ,er - iunmap ,fl - iunmap ,bb - iunmap ,ih - iunmap ,ii - iunmap ,eu - iunmap ,uu - iunmap ,uh - iunmap ,eh - iunmap ,oe - iunmap ,au - iunmap ,ae - iunmap ,aa - iunmap ,OE - iunmap ,ah - iunmap ,ba -endfunction - -" As of yet unimplemented: -"b̪ -"t̼ -"d̼ -"ʈ -"ɖ -"ɟ -"ɡ -"ɢ -"ʡ -"ʂ -"ʐ -"θ̼ -"ð̼ -"θ̠ -"ð̠ -"ɹ̠̊ -"ɹ̠ -"ɻ -"ʕ -"ʢ -"ʋ̥ -"ɹ̥ -"ɻ̊ -"ɻ -"j̊ -"ɰ̊ -"ɰ -"ʔ̞ -"ⱱ̟ -"ⱱ -"ɾ̼ -"ɾ̥ -"ɽ̊ -"ɽ -"ɢ̆ -"ʡ̮ -"ʙ̥ -"r̼ -"r̥ -"ɽ̊ -"ɽ -"ʀ̥ -"ʀ -"ʜ -"ʢ -"ɬ -"ɮ -"ɭ̊ -"ʎ̥ -"ʎ̝ -"ʟ̝̊ -"ʟ̝ -"l̥ -"ɭ̊ -"ɭ -"ʎ̥ -"ʎ -"ʟ̥ -"ʟ -"ʟ̠ -"ɺ -"ɺ̢ -"ʎ̮ -"ʟ̆ -"ʉ -"ɯ -"ʏ -"ɪ̈ -"ʊ̈ -"ø -"ɘ -"ɵ -"ɤ -"e̞ -"ø̞ -"ɵ̞ -"ɤ̞ -"o̞ -"ɜ -"ɞ -"ʌ -"ɞ̞ -"ä -"ɒ̈ -"m̥ -"ɱ -"n̼ -"n̥ -"ɳ̊ -"ɳ -"ŋ̊ -"ɴ -"p̪ diff --git a/.config/vim/plugin/magit.vim b/.config/vim/plugin/magit.vim @@ -1,1357 +0,0 @@ -scriptencoding utf-8 - -if exists('g:loaded_magit') || !executable('git') || &cp - finish -endif -let g:loaded_magit = 1 - -let g:vimagit_version = [1, 7, 3] - -" Initialisation {{{ - -" FIXME: find if there is a minimum vim version required -" if v:version < 703 -" endif - -" source common file. variables in common file are shared with plugin and -" syntax files -let g:vimagit_path = fnameescape(resolve(expand('<sfile>:p:h'))) -execute 'source ' . g:vimagit_path . '/../common/magit_common.vim' - -" these mappings are broadly applied, for all vim buffers -let g:magit_show_magit_mapping = get(g:, 'magit_show_magit_mapping', '<leader>M' ) - -" user options -let g:magit_enabled = get(g:, 'magit_enabled', 1) -let g:magit_show_help = get(g:, 'magit_show_help', 0) -let g:magit_default_show_all_files = get(g:, 'magit_default_show_all_files', 1) -let g:magit_default_fold_level = get(g:, 'magit_default_fold_level', 1) -let g:magit_auto_close = get(g:, 'magit_auto_close', 0) -let g:magit_auto_foldopen = get(g:, 'magit_auto_foldopen', 1) -let g:magit_default_sections = get(g:, 'magit_default_sections', ['info', 'global_help', 'commit', 'staged', 'unstaged']) -let g:magit_discard_untracked_do_delete = get(g:, 'magit_discard_untracked_do_delete', 0) - -let g:magit_refresh_gutter = get(g:, 'magit_refresh_gutter' , 1) -" Should deprecate the following -let g:magit_refresh_gitgutter = get(g:, 'magit_refresh_gitgutter', 0) - -let g:magit_commit_title_limit = get(g:, 'magit_commit_title_limit', 50) - -let g:magit_scrolloff = get(g:, 'magit_scrolloff', 3) - -let g:magit_warning_max_lines = get(g:, 'magit_warning_max_lines', 10000) - -let g:magit_git_cmd = get(g:, 'magit_git_cmd' , "git") - -execute "nnoremap <silent> " . g:magit_show_magit_mapping . " :call magit#show_magit('v')<cr>" - -if (g:magit_refresh_gutter == 1 || g:magit_refresh_gitgutter == 1) - autocmd User VimagitUpdateFile - \ if ( exists("*gitgutter#process_buffer") ) | - \ call gitgutter#process_buffer(bufnr(g:magit_last_updated_buffer), 0) | - \ elseif ( exists("*sy#util#refresh_windows") ) | - \ call sy#util#refresh_windows() | - \ endif -endif -" }}} - -" s:mg_cut_str cut a string given a limit size -" param[in] str string to cut -" param[in] limit maximum number of column -" return string cut on limit -function! s:mg_cut_str(str, limit) - if ( len(a:str) < a:limit ) - return a:str - elseif ( ( a:limit - 3 ) < 0 ) - return "" - else - return printf("%.*s...", a:limit - 3, a:str) - endif -endfunction - -" s:mg_get_info: this function writes in current buffer current git state -" WARNING: this function writes in file, it should only be called through -" protected functions like magit#update_buffer -function! s:mg_get_info() - let align_w=12 - - let repo_line=printf("%-*s %s", - \ align_w, - \ g:magit_section_info.cur_repo, - \ magit#git#top_dir()) - - try - let head_br=magit#git#get_branch_name("HEAD") - catch 'shell_error' - let head_br="Empty repository" - endtry - let upstream_br=magit#git#get_remote_branch("HEAD", "upstream") - let push_br=magit#git#get_remote_branch("HEAD", "push") - let max_br_w = max([len(head_br), len(upstream_br), len(push_br)]) - - let limit=winwidth(0)-align_w-max_br_w-3 - let head_msg=s:mg_cut_str(magit#git#get_commit_subject("HEAD"), limit) - let upstream_msg=s:mg_cut_str(magit#git#get_commit_subject(upstream_br), limit) - let push_msg=s:mg_cut_str(magit#git#get_commit_subject(push_br), limit) - - let head_line=magit#utils#strip(printf("%-*s %-*s %s", - \ align_w, g:magit_section_info.cur_head, - \ max_br_w, head_br, head_msg)) - let upstream_line=magit#utils#strip(printf("%-*s %-*s %s", - \ align_w, g:magit_section_info.cur_upstream, - \ max_br_w, upstream_br, upstream_msg)) - let push_line=magit#utils#strip(printf("%-*s %-*s %s", - \ align_w, g:magit_section_info.cur_push, - \ max_br_w, push_br, push_msg)) - - - silent put =g:magit_sections.info - silent put =magit#utils#underline(g:magit_sections.info) - silent put ='' - silent put =repo_line - silent put =head_line - silent put =upstream_line - silent put =push_line - - if ( b:magit_current_commit_mode != '' ) - let commit_mode_line=printf("%-*s %s", - \ align_w, g:magit_section_info.commit_mode, - \ g:magit_commit_mode[b:magit_current_commit_mode]) - silent put =commit_mode_line - endif - silent put ='' - silent put ='Press ? to display help' - silent put ='' - silent put ='' -endfunction - -" s:mg_display_files: display in current buffer files, filtered by some -" parameters -" param[in] mode: files mode, can be 'staged' or 'unstaged' -" param[in] curdir: directory containing files (only needed for untracked -" directory) -" param[in] depth: current directory depth (only needed for untracked -" directory) -function! s:mg_display_files(mode, curdir, depth) - - " FIXME: ouch, must store subdirs in more efficient way - for filename in b:state.get_filenames(a:mode) - let file = b:state.get_file(a:mode, filename, 0) - if ( file.depth != a:depth || filename !~ a:curdir . '.*' ) - continue - endif - silent put =file.get_filename_header() - let file.line_pos = line('.') - - if ( file.dir != 0 ) - if ( file.visible == 1 ) - call s:mg_display_files(a:mode, filename, a:depth + 1) - continue - endif - endif - - if ( file.visible == 0 ) - silent put ='' - continue - endif - if ( file.exists == 0 ) - echoerr "Error, " . filename . " should not exists" - endif - let hunks = file.get_hunks() - for hunk in hunks - if ( hunk.header != '' ) - silent put =hunk.header - let hunk.line_pos = line('.') - endif - if ( !empty(hunk.lines) ) - silent put =hunk.lines - endif - endfor - silent put ='' - endfor -endfunction - -" s:mg_get_staged_section: this function writes in current buffer all staged -" or unstaged files, using b:state.dict information -" WARNING: this function writes in file, it should only be called through -" protected functions like magit#update_buffer -" param[in] mode: 'staged' or 'unstaged' -function! s:mg_get_staged_section(mode) - silent put =g:magit_sections[a:mode] - call magit#mapping#get_section_help(a:mode) - silent put =magit#utils#underline(g:magit_sections[a:mode]) - silent put ='' - call s:mg_display_files(a:mode, '', 0) - silent put ='' -endfunction - -" s:mg_get_stashes: this function write in current buffer all stashes -" WARNING: this function writes in file, it should only be called through -" protected functions like magit#update_buffer -function! s:mg_get_stashes() - try - silent! let stash_list=magit#sys#systemlist(g:magit_git_cmd . " stash list") - catch 'shell_error' - call magit#sys#print_shell_error() - return - endtry - - if (!empty(stash_list)) - silent put =g:magit_sections.stash - silent put =magit#utils#underline(g:magit_sections.stash) - silent put ='' - - for stash in stash_list - let stash_id=substitute(stash, '^\(stash@{\d\+}\):.*$', '\1', '') - silent put =stash - silent! execute "read !git stash show -p " . stash_id - endfor - silent put ='' - silent put ='' - endif -endfunction - -" b:magit_current_commit_msg: this variable store the current commit message, -" saving it among refreshes (remember? the whole buffer is wiped at each -" refresh). -let b:magit_current_commit_msg = [] - -" s:mg_get_commit_section: this function writes in current buffer the commit -" section. It is a commit message, depending on b:magit_current_commit_mode -" WARNING: this function writes in file, it should only be called through -" protected functions like magit#update_buffer -" param[in] b:magit_current_commit_mode: this function uses global commit mode -" 'CC': prepare a brand new commit message -" 'CA': get the last commit message -function! s:mg_get_commit_section() - if ( b:magit_current_commit_mode != '' ) - silent put =g:magit_sections.commit - silent put =magit#utils#underline(g:magit_sections.commit) - - let git_dir=magit#git#git_dir() - " refresh the COMMIT_EDITMSG file - if ( b:magit_current_commit_mode == 'CC' ) - silent! call magit#sys#system_noraise("GIT_EDITOR=/bin/false " . - \ g:magit_git_cmd . " -c commit.verbose=no commit -e 2> /dev/null") - elseif ( b:magit_current_commit_mode == 'CA' ) - silent! call magit#sys#system_noraise("GIT_EDITOR=/bin/false " . - \ g:magit_git_cmd . " -c commit.verbose=no commit --amend -e 2> /dev/null") - endif - if ( !empty(b:magit_current_commit_msg) ) - silent put =b:magit_current_commit_msg - elseif ( filereadable(git_dir . 'COMMIT_EDITMSG') ) - let comment_char=magit#git#get_config("core.commentChar", '#') - let commit_msg=magit#utils#join_list(filter(readfile(git_dir . 'COMMIT_EDITMSG'), 'v:val !~ "^' . comment_char . '"')) - silent put =commit_msg - endif - silent put ='' - silent put ='' - endif -endfunction - -" s:mg_search_block: helper function, to get start and end line of a block, -" giving a start and multiple end pattern -" a "pattern parameter" is a List: -" @[0]: end pattern regex -" @[1]: number of line to exclude above (negative), below (positive) or none (0) -" param[in] start_pattern: start "pattern parameter", which will be search -" backward (cursor position is set to end of line before searching, to find the -" pattern if on the current line) -" param[in] end_pattern: list of end "pattern parameter". Each pattern is -" searched in order. It'll choose the match with the minimum line number -" (smallest region search) -" param[in] upperlimit_pattern: regex of upper limit. If start_pattern line is -" inferior to upper_limit line, block is discarded -" param[in]: end_pattern_on_cursor: boolean, if true end pattern is also -" search on cursor position -" return: [startline, endline] -function! s:mg_search_block(start_pattern, end_pattern, upper_limit_pattern, - \ end_pattern_on_cursor) - - let upper_limit=0 - if ( a:upper_limit_pattern != "" ) - let upper_limit=search(a:upper_limit_pattern, "cbnW") - endif - - let start=search(a:start_pattern[0], "cbnW") - if ( start == 0 || start < upper_limit ) - throw "out_of_block" - endif - let start+=a:start_pattern[1] - - let end=0 - let min=line('$') - for end_p in a:end_pattern - let curr_end=search(end_p[0], a:end_pattern_on_cursor ? "c" : "" . "nW") - if ( curr_end != 0 && curr_end <= min ) - let end=curr_end + end_p[1] - let min=curr_end - endif - endfor - if ( end == 0 ) - throw "out_of_block" - endif - - return [start,end] -endfunction - -" s:mg_get_commit_msg: get the commit meesgae currently in commit section -" return a string containg the commit message -" \param[in] out_of_block (optional): if set, will first move the cursor to -" the commit block before getting content -function! s:mg_get_commit_msg(...) - let commit_section_pat_start='^'.g:magit_sections.commit.'$' - " Get next section pattern with g:magit_default_sections order - let commit_position = match(g:magit_default_sections, 'commit') - if ( commit_position + 1 == len(g:magit_default_sections) ) - let commit_section_pat_end='\%$' - else - let commit_section_pat_end='^'.g:magit_sections[g:magit_default_sections[commit_position+1]].'$' - endif - - let commit_jump_line = 2 - let out_of_block = a:0 == 1 ? a:1 : 0 - if ( out_of_block ) - let old_pos=line('.') - let commit_pos=search(commit_section_pat_start, "cw") - if ( commit_pos != 0 ) - call cursor(commit_pos+1, 0) - endif - endif - try - let [start, end] = <SID>mg_search_block( - \ [commit_section_pat_start, commit_jump_line], - \ [ [commit_section_pat_end, -1] ], "", 1) - finally - if ( out_of_block && commit_pos != 0 ) - call cursor(old_pos, 0) - endif - endtry - return magit#utils#strip_array(getline(start, end)) -endfunction - -" s:mg_git_commit: commit staged stuff with message prepared in commit section -" param[in] mode: mode to commit -" 'CF': don't use commit section, just amend previous commit with staged -" stuff, without modifying message -" 'CC': commit staged stuff with message in commit section to a brand new -" commit -" 'CA': commit staged stuff with message in commit section amending last -" commit -" return no -function! s:mg_git_commit(mode) abort - if ( a:mode == 'CF' ) - try - silent let git_result=magit#sys#system(g:magit_git_cmd . - \ " commit --amend -C HEAD") - catch 'shell_error' - call magit#sys#print_shell_error() - echoerr "Commit fix failed" - endtry - else - let commit_flag="" - if ( a:mode != 'CA' && empty( magit#get_staged_files() ) ) - let choice = confirm( - \ "Do you really want to commit without any staged files?", - \ "&Yes\n&No", 2) - if ( choice != 1 ) - return - else - let commit_flag.=" --allow-empty " - endif - endif - - let commit_msg=s:mg_get_commit_msg() - if ( empty( commit_msg ) ) - let choice = confirm( - \ "Do you really want to commit with an empty message?", - \ "&Yes\n&No", 2) - if ( choice != 1 ) - return - else - let commit_flag.=" --allow-empty-message " - endif - endif - - if ( a:mode == 'CA' ) - let commit_flag.=" --amend " - endif - let commit_cmd=g:magit_git_cmd . " commit " . commit_flag . - \ " --file - " - try - silent! let git_result=magit#sys#system(commit_cmd, commit_msg) - catch 'shell_error' - call magit#sys#print_shell_error() - echoerr "Commit failed" - endtry - let b:magit_current_commit_mode='' - let b:magit_current_commit_msg=[] - endif - let b:magit_just_commited = 1 -endfunction - -" s:mg_select_file_block: select the whole diff file, relative to the current -" cursor position -" nota: if the cursor is not in a diff file when the function is called, this -" function will fail -" return: a List -" @[0]: return value -" @[1]: List of lines containing the patch for the whole file -function! s:mg_select_file_block() - return <SID>mg_search_block( - \ [g:magit_file_re, 1], - \ [ [g:magit_end_diff_re, 0], - \ [g:magit_file_re, -1], - \ [g:magit_stash_re, -1], - \ [g:magit_section_re, -2], - \ [g:magit_bin_re, 0], - \ [g:magit_eof_re, 0 ] - \ ], - \ "", - \ 0) -endfunction - -" s:mg_select_hunk_block: select a hunk, from the current cursor position -" nota: if the cursor is not in a hunk when the function is called, this -" function will fail -" return: a List -" @[0]: return value -" @[1]: List of lines containing the hunk -function! s:mg_select_hunk_block() - return <SID>mg_search_block( - \ [g:magit_hunk_re, 0], - \ [ [g:magit_hunk_re, -1], - \ [g:magit_end_diff_re, 0], - \ [g:magit_file_re, -1], - \ [g:magit_stash_re, -1], - \ [g:magit_section_re, -2], - \ [g:magit_eof_re, 0 ] - \ ], - \ g:magit_file_re, - \ 0) -endfunction - -" s:mg_create_diff_from_select: craft the diff to apply from a selection -" in a chunk -" remarks: it works with full lines, and can not span over multiple chunks -" param[in] select_lines: List containing all selected line numbers -" return: List containing the diff to apply, including the chunk header (must -" be applied with git apply --recount) -function! s:mg_create_diff_from_select(select_lines) - let start_select_line = a:select_lines[0] - let end_select_line = a:select_lines[-1] - let [starthunk,endhunk] = <SID>mg_select_hunk_block() - if ( start_select_line < starthunk || end_select_line > endhunk ) - throw 'out of hunk selection' - endif - let section=magit#helper#get_section() - let filename=magit#helper#get_filename() - let hunks = b:state.get_file(section, filename).get_hunks() - for hunk in hunks - if ( hunk.header == getline(starthunk) ) - let current_hunk = hunk - break - endif - endfor - let selection = [] - call add(selection, current_hunk.header) - - let current_line = starthunk + 1 - " when staging by visual selection, lines out of selection must be - " ignored. To do so, + lines are simply ignored, - lines are considered as - " untouched. - " For unstaging, - lines must be ignored and + lines considered untouched. - if ( section == 'unstaged' ) - let remove_line_char = '+' - let replace_line_char = '-' - else - let remove_line_char = '-' - let replace_line_char = '+' - endif - for hunk_line in current_hunk.lines - if ( index(a:select_lines, current_line) != -1 ) - call add(selection, getline(current_line)) - elseif ( hunk_line =~ '^'.remove_line_char.'.*' ) - " just ignore these lines - elseif ( hunk_line =~ '^'.replace_line_char.'.*' ) - call add(selection, substitute(hunk_line, - \ '^'.replace_line_char.'\(.*\)$', ' \1', '')) - elseif ( hunk_line =~ '^ .*' ) - call add(selection, hunk_line) - else - throw 'visual selection error: ' . hunk_line - endif - let current_line += 1 - endfor - return selection -endfunction - -" s:mg_mark_lines_in_hunk: this function toggle marks for selected lines in a -" hunk. -" if a hunk contains marked lines, only these lines will be (un)staged on next -" (un)stage command -" param[in] start_select_line,end_select_line: limits of the selection -function! s:mg_mark_lines_in_hunk(start_select_line, end_select_line) - let [starthunk,endhunk] = <SID>mg_select_hunk_block() - if ( a:start_select_line < starthunk || a:end_select_line > endhunk ) - throw 'out of hunk selection' - endif - return magit#sign#toggle_signs('M', a:start_select_line, a:end_select_line) -endfunction - -" }}} - -" {{{ User functions and commands - -" magit#open_close_folding() -" param[in] visible : boolean, force visible value. If not set, toggle -" visibility -function! magit#open_close_folding(...) - let list = matchlist(getline("."), g:magit_file_re) - if ( empty(list) ) - throw 'non file header line: ' . getline(".") - endif - let filename = list[2] - let section=magit#helper#get_section() - " if first param is set, force visible to this value - " else, toggle value - let file = b:state.get_file(section, filename, 0) - if ( a:0 == 1 ) - call file.set_visible(a:1) - else - call file.toggle_visible() - endif - call magit#update_buffer() -endfunction - -let g:magit_last_updated_buffer = '' - -" s:mg_display_functions: Dict wrapping all display related functions -" This Dict should be accessed through g:magit_default_sections -let s:mg_display_functions = { - \ 'info': { 'fn': function("s:mg_get_info"), 'arg': []}, - \ 'global_help': { 'fn': function("magit#mapping#get_section_help"), 'arg': ['global']}, - \ 'commit': { 'fn': function("s:mg_get_commit_section"), 'arg': []}, - \ 'staged': { 'fn': function("s:mg_get_staged_section"), 'arg': ['staged']}, - \ 'unstaged': { 'fn': function("s:mg_get_staged_section"), 'arg': ['unstaged']}, - \ 'stash': { 'fn': function("s:mg_get_stashes"), 'arg': []}, -\ } - -" magit#update_buffer: this function: -" 1. checks that current buffer is the wanted one -" 2. save window state (cursor position...) -" 3. delete buffer -" 4. fills with unstage stuff -" 5. restore window state -" param[in] updated file (optional): this filename is updated to absolute -" path, set in g:magit_last_updated_buffer and the User autocmd -" param[in] current section (optional) -" param[in] current hunk id -" when params 1 & 2 & 3 are set, it means -" that a stage/unstage action occured. We try to smartly set the cursor -" position after the refresh -" - on current file on closest hunk if still contains hunks in current section -" - else on next file if any -" - else on previous file if any -" - or cursor stay where it is -" VimagitUpdateFile event is raised -function! magit#update_buffer(...) - let buffer_name=bufname("%") - " (//|\\\\) is to handle old vim 7.4-0 fnameescape behavior on Windows - if ( buffer_name !~ "\\v^magit:(//|\\\\).*" ) - echoerr "Not in magit buffer but in " . buffer_name - return - endif - - if ( a:0 >= 1 ) - let cur_filename = a:1 - endif - if ( a:0 >= 2 ) - let cur_section = a:2 - endif - if ( a:0 >= 3 ) - let cur_hunk_id = a:3 - endif - - if ( b:magit_current_commit_mode != '' ) - try - let b:magit_current_commit_msg = s:mg_get_commit_msg(1) - catch /^out_of_block$/ - let b:magit_current_commit_msg = [] - endtry - call s:set_mode_write() - else - call s:set_mode_read() - endif - " FIXME: find a way to save folding state. According to help, this won't - " help: - " > This does not save fold information. - " Playing with foldenable around does not help. - " mkview does not help either. - let l:winview = winsaveview() - - " remove all signs (needed as long as we wipe buffer) - call magit#sign#remove_all() - - " remove folding while we are updating the buffer. writing to the buffer - " while the folding is enabled can be veryyyyy slow. - " One last strange thing is that, the first time the buffer is written, it - " is not slow at all. It is slow the second time, at first refresh (can be - " order of seconds). Then at third time (2nd refresh), it is fast again. - " refs: - " https://github.com/jreybert/vimagit/issues/170 - " https://github.com/jreybert/vimagit/issues/36 (maybe) - setlocal foldmethod=manual - " delete buffer - silent! execute "silent :%delete _" - - " be smart for the cursor position after refresh, if stage/unstaged - " occured - if ( a:0 >= 2 ) - let filenames = b:state.get_filenames(cur_section) - let pos = match(filenames, cur_filename) - let next_filename = (pos < len(filenames) - 1) ? filenames[pos+1] : '' - let prev_filename = (pos > 0) ? filenames[pos-1] : '' - endif - - call b:state.update() - - if ( g:magit_auto_close == 1 && - \ b:magit_just_commited == 1 && - \ empty(b:state.get_filenames('staged')) && - \ empty(b:state.get_filenames('unstaged')) ) - let b:magit_just_commited = 0 - call magit#close_magit() - return - endif - - for section in g:magit_default_sections - try - let func = s:mg_display_functions[section] - catch - echohl WarningMsg - echom 'unknown section to display: ' . section - echom 'please check your redefinition of g:magit_default_sections' - echohl None - endtry - call call(func.fn, func.arg) - endfor - - call winrestview(l:winview) - - call magit#utils#clear_undo() - - setlocal filetype=magit - setlocal foldmethod=syntax - - if ( b:magit_current_commit_mode != '' && b:magit_commit_newly_open == 1 ) - let commit_section_pat_start='^'.g:magit_sections.commit.'$' - silent! let section_line=search(commit_section_pat_start, "w") - silent! call cursor(section_line+2+magit#mapping#get_section_help_line_nb('commit'), 0) - if exists('#User#VimagitEnterCommit') - doautocmd User VimagitEnterCommit - endif - let b:magit_commit_newly_open = 0 - endif - - let g:magit_last_updated_buffer = '' - if ( a:0 >= 1 ) - let abs_filename = magit#git#top_dir() . cur_filename - if ( bufexists(abs_filename) ) - let g:magit_last_updated_buffer = abs_filename - if exists('#User#VimagitUpdateFile') - doautocmd User VimagitUpdateFile - endif - endif - endif - - if exists('#User#VimagitRefresh') - doautocmd User VimagitRefresh - endif - - if ( a:0 >= 3 ) - if (b:state.get_files_nb(cur_section) > 0) - " if, in this order, current file, next file, previous file exists in - " current section, move cursor to it - let cur_file = 1 - for fname in [cur_filename, next_filename, prev_filename] - try - let file = b:state.get_file(cur_section, fname) - if ( cur_file ) - let hunk_id = max([0, min([len(file.get_hunks())-1, cur_hunk_id])]) - let cur_file = 0 - else - let hunk_id = 0 - endif - - if ( file.is_visible() ) - call cursor(file.get_hunks()[hunk_id].line_pos, 0) - if ( g:magit_auto_foldopen ) - foldopen - endif - else - call cursor(file.line_pos, 0) - endif - break - catch 'file_doesnt_exists' - endtry - endfor - else - " if current section is empty, move cursor to top to other section - if (cur_section == 'staged') - let cur_section = 'unstaged' - elseif (cur_section == 'unstaged') - let cur_section = 'staged' - endif - let section_line=search(g:magit_sections[cur_section], "bnw") - call cursor(section_line, 0) - endif - silent execute "normal! zt" - endif - - if exists(':AirlineRefresh') - execute "AirlineRefresh" - endif - -endfunction - -" magit#toggle_help: toggle inline help showing in magit buffer -function! magit#toggle_help() - let g:magit_show_help = ( g:magit_show_help == 0 ) ? 1 : 0 - call magit#update_buffer() -endfunction - -" magit#show_magit: prepare and show magit buffer -" it also set local mappings to magit buffer -" param[in] display: -" 'v': vertical split -" 'h': horizontal split -" 'c': current buffer (should be used when opening vim in vimagit mode -function! magit#show_magit(display, ...) - if ( &filetype == 'netrw' ) - let cur_file = "" - let cur_file_path = b:netrw_curdir - else - let cur_file = expand("%:p") - let cur_file_path = isdirectory(cur_file) ? cur_file : fnamemodify(cur_file, ":h") - endif - - let git_dir='' - let try_paths = [ cur_file_path, getcwd() ] - for path in try_paths - let git_dir=magit#git#is_work_tree(path) - if ( git_dir != '' ) - break - endif - endfor - - if ( git_dir == '' ) - echohl ErrorMsg - echom "magit can not find any git repository" - echohl None - echom "make sure that current opened file or vim current directory points to a git repository" - echom "search paths:" - for path in try_paths - echom path - endfor - return - endif - - let buffer_name=fnameescape('magit://' . git_dir) - - let magit_win = magit#utils#search_buffer_in_windows(buffer_name) - - if ( magit_win != 0 ) - silent execute magit_win."wincmd w" - elseif ( a:display == 'v' ) - silent execute "vnew " . buffer_name - " next is a workaround for vader, revert as soon as vader bug is fixed - " https://github.com/junegunn/vader.vim/issues/135 - silent execute "buffer " . buffer_name - let b:magit_only = 0 - elseif ( a:display == 'h' ) - silent execute "new " . buffer_name - let b:magit_only = 0 - elseif ( a:display == 'c' ) - if ( !bufexists(buffer_name) ) - if ( bufname("%") == "" ) - silent keepalt enew - else - silent enew - endif - silent execute "file " . buffer_name - else - silent execute "buffer " . buffer_name - endif - let b:magit_only = 1 - else - throw 'parameter_error' - endif - - call magit#git#set_top_dir(git_dir) - - let b:magit_default_show_all_files = g:magit_default_show_all_files - let b:magit_default_fold_level = g:magit_default_fold_level - let b:magit_warning_max_lines_answered = 0 - - if ( a:0 > 0 ) - let b:magit_default_show_all_files = a:1 - endif - if ( a:0 > 1 ) - let b:magit_default_fold_level = a:2 - endif - - setlocal buftype=nofile - setlocal bufhidden=hide - setlocal noswapfile - setlocal foldmethod=syntax - setlocal foldnestmax=20 - setlocal nobuflisted - setlocal nomodeline - let &l:foldlevel = b:magit_default_fold_level - setlocal filetype=magit - if ( g:magit_scrolloff != -1 ) - if ( has("patch-8.1.0864") ) - let &l:scrolloff = g:magit_scrolloff - else - let s:default_scrolloff=&scrolloff - " ugly hack, scrolloff is a global only option before patch 8.1.0864 - execute "autocmd BufLeave " . buffer_name . " :set scrolloff=" . s:default_scrolloff - execute "autocmd BufEnter " . buffer_name . " :set scrolloff=" . g:magit_scrolloff - let &scrolloff = g:magit_scrolloff - endif - endif - - augroup vimagit_buffer - autocmd! - " catch write command - execute "autocmd BufWriteCmd " . buffer_name . " :call magit#commit_command('CC')" - - " let magit buffer in read mode when cursor is not in file, to avoid - " unfortunate commit with a :wall command out of magit buffer if a commit - " message is ongoing - execute "autocmd BufEnter " . buffer_name . " - \ :if ( exists('b:magit_current_commit_mode') && - \ b:magit_current_commit_mode != '' ) | - \ call s:set_mode_write() | - \ endif" - execute "autocmd BufLeave " . buffer_name . " - \ :if ( exists('b:magit_current_commit_mode') && - \ b:magit_current_commit_mode != '' ) | - \ call s:set_mode_read() | - \ endif" - augroup END - - " s:magit_commit_mode: global variable which states in which commit mode we are - " values are: - " '': not in commit mode - " 'CC': normal commit mode, next commit command will create a new commit - " 'CA': amend commit mode, next commit command will ament current commit - " 'CF': fixup commit mode, it should not be a global state mode - let b:magit_current_commit_mode='' - let b:magit_commit_newly_open=0 - - let b:magit_diff_context=3 - - let b:magit_just_commited = 0 - - if ( magit#git#check_repo() != 0 ) - echohl ErrorMsg - echom "git repository seems to be corrupted" - echohl None - echom "To be safe, vimagit ends now" - echom "Check your repository health with git fsck" - echom "If the result shows no problem, open an issue" - return - endif - - let b:state = deepcopy(g:magit#state#state) - call magit#utils#setbufnr(bufnr(buffer_name)) - call magit#sign#init() - - call magit#mapping#set_default() - - if exists('#User#VimagitBufferInit') - doautocmd User VimagitBufferInit - endif - - call magit#update_buffer() - - function! s:jump_first_file() - let unstaged_files = b:state.get_files_ordered('unstaged') - if ( !empty(unstaged_files) ) - call cursor(unstaged_files[0].line_pos, 0) - else - let staged_files = b:state.get_files_ordered('staged') - if ( !empty(staged_files) ) - call cursor(staged_files[0].line_pos, 0) - endif - endif - endfunction - " move cursor to (in priority order if not found): - " - current file unstaged - " - current file staged - " - first unstaged file - " - first stage file - let cur_filename = matchlist(cur_file, git_dir . '\(.*\)') - if ( !empty(cur_filename) ) - let cur_file = cur_filename[1] - try - let file = b:state.get_file('unstaged', cur_file, 0) - call cursor(file.line_pos, 0) - catch 'file_doesnt_exists' - try - let file = b:state.get_file('staged', cur_file, 0) - call cursor(file.line_pos, 0) - catch 'file_doesnt_exists' - call s:jump_first_file() - endtry - endtry - else - call s:jump_first_file() - endif - -endfunction - -function! magit#close_magit() - if ( b:magit_only == 0 ) - close - else - try - edit # - catch /^Vim\%((\a\+)\)\=:E\%(194\|499\)/ - try - close - catch /^Vim\%((\a\+)\)\=:E444/ - quit - endtry - endtry - endif -endfunction - -function! s:mg_stage_closed_file(discard) - if ( getline(".") =~ g:magit_file_re ) - let list = matchlist(getline("."), g:magit_file_re) - let filename = list[2] - let section=magit#helper#get_section() - - let file = b:state.get_file(section, filename) - if ( file.is_visible() == 0 || - \ file.is_dir() == 1 ) - if ( a:discard == 0 ) - if ( section == 'unstaged' ) - call magit#git#git_add(magit#utils#add_quotes(filename)) - elseif ( section == 'staged' ) - call magit#git#git_reset(magit#utils#add_quotes(filename)) - else - echoerr "Must be in \"" . - \ g:magit_sections.staged . "\" or \"" . - \ g:magit_sections.unstaged . "\" section" - endif - else - if ( section == 'unstaged' ) - if ( file.status == '?' || file.must_be_added() ) - if ( g:magit_discard_untracked_do_delete == 1 ) - if ( delete(filename, "rf") != 0 ) - echoerr "Can not delete \"" . filename . "\"" - return - endif - else - echohl WarningMsg - echomsg "By default, vimagit won't discard " - \ "untracked file (which means delete this file)" - echomsg "You can force this behaviour, " - \ "setting g:magit_discard_untracked_do_delete=1" - echohl None - return - endif - else - call magit#git#git_checkout(magit#utils#add_quotes(filename)) - endif - else - echohl WarningMsg - echomsg "Can not discard file in \"" . - \ g:magit_sections.staged . "\" section, " - \ "unstage file first." - echohl None - return - endif - endif - - call magit#update_buffer(filename, section, 0) - - return - endif - endif - throw "out_of_block" -endfunction - -" magit#stage_block: this function (un)stage a block, according to parameter -" INFO: in unstaged section, it stages the hunk, and in staged section, it -" unstages the hunk -" param[in] block_type: can be 'file' or 'hunk' -" param[in] discard: boolean, if true, discard instead of (un)stage -" return: no -function! magit#stage_block(selection, discard) abort - let section=magit#helper#get_section() - let filename=magit#helper#get_filename() - - let file = b:state.get_file(section, filename, 0) - let header = file.get_header() - - " find current hunk position in file matching against current selection - " header - try - let hunk_id = match(map(deepcopy(file.get_hunks()), 'v:val.header'), "\\V" . a:selection[0]) - catch /^Vim\%((\a\+)\)\=:E874/ - echoerr "Escape issue with '" . a:selection[0] ."'" - return - endtry - - - if ( a:discard == 0 ) - if ( section == 'unstaged' ) - if ( file.must_be_added() ) - call magit#git#git_add(magit#utils#add_quotes(filename)) - else - call magit#git#git_apply(header, a:selection) - endif - elseif ( section == 'staged' ) - if ( file.must_be_added() ) - call magit#git#git_reset(magit#utils#add_quotes(filename)) - else - call magit#git#git_unapply(header, a:selection, 'staged') - endif - else - echoerr "Must be in \"" . - \ g:magit_sections.staged . "\" or \"" . - \ g:magit_sections.unstaged . "\" section" - endif - else - if ( section == 'unstaged' ) - if ( file.status == '?' || file.must_be_added() ) - if ( g:magit_discard_untracked_do_delete == 1 ) - if ( delete(filename, "rf") != 0 ) - echoerr "Can not delete \"" . filename . "\"" - return - endif - else - echohl WarningMsg - echomsg "By default, vimagit won't discard " - \ "untracked file (which means delete this file)" - echomsg "You can force this behaviour, " - \ "setting g:magit_discard_untracked_do_delete=1" - echohl None - return - endif - else - call magit#git#git_unapply(header, a:selection, 'unstaged') - endif - else - echoerr "Must be in \"" . - \ g:magit_sections.unstaged . "\" section" - endif - endif - - call magit#update_buffer(filename, section, hunk_id) - -endfunction - -" magit#stage_file: this function (un)stage a whole file, from the current -" cursor position -" INFO: in unstaged section, it stages the file, and in staged section, it -" unstages the file -" return: no -function! magit#stage_file() - try - call <SID>mg_stage_closed_file(0) - return - catch 'out_of_block' - try - let [start, end] = <SID>mg_select_file_block() - catch /^out_of_block$/ - echohl ErrorMsg - echomsg "Error while staging." - echohl None - echomsg "Your cursor must be:" - echomsg " - on a file header line" - echomsg " - or on a hunk header line" - echomsg " - or within a hunk" - echomsg "If you repect one of previous points, please open a new issue:" - echomsg "https://github.com/jreybert/vimagit/issues/new" - return - endtry - let selection = getline(start, end) - endtry - return magit#stage_block(selection, 0) -endfunction -" -" magit#stage_hunk: this function (un)stage/discard a hunk, from the current -" cursor position -" INFO: in unstaged section, it stages the hunk, and in staged section, it -" unstages the hunk -" param[in] discard: -" - when set to 0, (un)stage -" - when set to 1, discard -" return: no -function! magit#stage_hunk(discard) - try - call <SID>mg_stage_closed_file(a:discard) - return - catch 'out_of_block' - try - let [start,end] = <SID>mg_select_hunk_block() - catch 'out_of_block' - try - let [start,end] = <SID>mg_select_file_block() - catch /^out_of_block$/ - echohl ErrorMsg - echomsg "Error while staging." - echohl None - echomsg "Your cursor must be:" - echomsg " - on a file header line" - echomsg " - or on a hunk header line" - echomsg " - or within a hunk" - echomsg "If you repect one of previous points, please open a new issue:" - echomsg "https://github.com/jreybert/vimagit/issues/new" - return - endtry - endtry - let marked_lines = magit#sign#find_stage_signs(start, end) - if ( empty(marked_lines) ) - let selection = getline(start, end) - else - let selection = <SID>mg_create_diff_from_select( - \ map(keys(marked_lines), 'str2nr(v:val)')) - call magit#sign#remove_signs(marked_lines) - endif - endtry - return magit#stage_block(selection, a:discard) -endfunction - -" magit#stage_vselect: this function (un)stage text being sectected in Visual -" mode -" remarks: it works with full lines, and can not span over multiple chunks -" INFO: in unstaged section, it stages the file, and in staged section, it -" unstages the file -" return: no -function! magit#stage_vselect() range - " func-range a:firstline a:lastline seems to work at least from vim 7.2 - let lines = [] - let curline = a:firstline - while ( curline <= a:lastline ) - call add(lines, curline) - let curline += 1 - endwhile - try - let selection = <SID>mg_create_diff_from_select(lines) - catch /^out_of_block$/ - echohl ErrorMsg - echomsg "Error while staging a visual selection." - echohl None - echomsg "Visual selection staging has currently some limitations:" - echomsg " - selection must be limited within a single hunk" - echomsg " - only work for staging, not for unstaging" - echomsg "If you repect current limitations, please open a new issue:" - echomsg "https://github.com/jreybert/vimagit/issues/new" - return - endtry - return magit#stage_block(selection, 0) -endfunction - -" magit#mark_vselect: wrapper function to mark selected lines (see -" mg_mark_lines_in_hunk) -function! magit#mark_vselect() range - return <SID>mg_mark_lines_in_hunk(a:firstline, a:lastline) -endfunction - -" magit#ignore_file: this function add the file under cursor to .gitignore -" FIXME: git diff adds some strange characters to end of line -function! magit#ignore_file() abort - let ignore_file=magit#helper#get_filename() - call magit#utils#append_file(magit#git#top_dir() . ".gitignore", - \ [ ignore_file ] ) - call magit#update_buffer() -endfunction - -" set magit buffer in write mode -function! s:set_mode_write() - setlocal buftype=acwrite -endfunction - -" set magit buffer in read only mode -function! s:set_mode_read() - setlocal buftype=nofile -endfunction - -" magit#commit_command: entry function for commit mode -" INFO: it has a different effect if current section is commit section or not -" param[in] mode: commit mode -" 'CF': do not set global b:magit_current_commit_mode, directly call magit#git_commit -" 'CA'/'CF': if in commit section mode, call magit#git_commit, else just set -" global state variable b:magit_current_commit_mode, -function! magit#commit_command(mode) - if ( a:mode == 'CF' ) - call <SID>mg_git_commit(a:mode) - else - let section=magit#helper#get_section() - if ( section == 'commit' && -\ !(b:magit_current_commit_mode == 'CC' && a:mode == 'CA' ) ) - if ( b:magit_current_commit_mode == '' ) - echoerr "Error, commit section should not be enabled" - return - endif - " when we do commit, it is prefered ot commit the way we prepared it - " (.i.e normal or amend), whatever we commit with CC or CA. - call <SID>mg_git_commit(b:magit_current_commit_mode) - if exists('#User#VimagitLeaveCommit') - doautocmd User VimagitLeaveCommit - endif - else - let b:magit_current_commit_mode=a:mode - let b:magit_commit_newly_open=1 - call s:set_mode_write() - setlocal nomodified - endif - endif - call magit#update_buffer() -endfunction - -" magit#close_commit: cancel for commit mode -" close commit section if opened -function! magit#close_commit() - if ( b:magit_current_commit_mode == '' ) - return - endif - - let git_dir=magit#git#git_dir() - let commit_editmsg=git_dir . 'COMMIT_EDITMSG' - if ( filereadable(commit_editmsg) ) - let commit_msg=s:mg_get_commit_msg() - call writefile(commit_msg, commit_editmsg) - endif - - let b:magit_current_commit_mode='' - let b:magit_current_commit_msg=[] - if exists('#User#VimagitLeaveCommit') - doautocmd User VimagitLeaveCommit - endif - call magit#update_buffer() -endfunction - -" magit#jump_hunk: function to jump among hunks -" it closes the current fold (if any), jump to next hunk and unfold it -" param[in] dir: can be 'N' (for next) or 'P' (for previous) -function! magit#jump_hunk(dir) - let back = ( a:dir == 'P' ) ? 'b' : '' - let line = search('\%(^@@ \|' . g:magit_file_re . '\)', back . 'wn') - if ( line != 0 ) - if ( foldlevel(line('.')) == 2 ) - try - foldclose - catch /^Vim\%((\a\+)\)\=:E490/ - endtry - endif - call cursor(line, 0) - - if ( foldlevel(line('.')) == 0 ) - return - endif - " if current line if an header file of an open file, go next - if ( foldlevel(line('.')) == 1 ) - let line = search('\%(^@@ \|' . g:magit_file_re . '\)', back . 'wn') - call cursor(line, 0) - endif - while ( foldclosed(line) != -1 ) - try - foldopen - catch /^Vim\%((\a\+)\)\=:E490/ - break - endtry - endwhile - silent execute "normal! zt" - endif -endfunction - -" magit#get_staged_files: function returning an array with staged files names -" return: an array with staged files names -function! magit#get_staged_files() - return keys(b:state.dict.staged) -endfunction - -" magit#get_staged_files: function returning an array with unstaged files -" names -" return: an array with unstaged files names -function! magit#get_unstaged_files() - return keys(b:state.dict.unstaged) -endfunction - -" magit#jump_to: function to move cursor to the file location of the current -" hunk -" if this file is already displayed in a window, jump to the window, if not, -" jump to last window and open buffer, at the beginning of the hunk -function! magit#jump_to() - let section=magit#helper#get_section() - let filename=fnameescape(magit#git#top_dir() . magit#helper#get_filename()) - let header_line_nb=magit#helper#get_hunkheader_line_nb() - - let line_in_file=substitute(getline(header_line_nb), - \ '^@@ -\d\+,\d\+ +\(\d\+\),\d\+ @@.*$', '\1', "") - - " header_line_nb+2: +2 because we skip the header and the fist line - let hunk_extract=getline(header_line_nb+2, line('.')) - let line_in_hunk = len(filter(hunk_extract, 'v:val =~ "^[ +]"')) - let line_in_file += line_in_hunk - - " winnr('#') is overwritten by magit#get_win() - let last_win = winnr('#') - let buf_win = magit#utils#search_buffer_in_windows(filename) - let buf_win = ( buf_win == 0 ) ? last_win : buf_win - if ( buf_win == 0 || winnr('$') == 1 ) - rightbelow vnew - else - execute buf_win."wincmd w" - endif - - try - execute "edit " . "+" . line_in_file . " " filename - catch - if ( v:exception == 'Vim:Interrupt' && buf_win == 0) - close - elseif ( v:exception != 'Vim(edit):E325: ATTENTION' ) - throw v:exception - endif - endtry -endfunction - -function! magit#update_diff(way) - if ( a:way == "+" ) - let b:magit_diff_context+=1 - elseif ( a:way == "0" ) - let b:magit_diff_context=3 - elseif ( b:magit_diff_context > 1 ) - let b:magit_diff_context-=1 - endif - call magit#update_buffer() -endfunction - -function! magit#show_version() - return g:vimagit_version[0] . "." . - \ g:vimagit_version[1] . "." . - \ g:vimagit_version[2] -endfunction - -function! magit#get_current_mode() - if ( b:magit_current_commit_mode == '' ) - return "STAGING" - elseif ( b:magit_current_commit_mode == 'CC' ) - return "COMMIT" - elseif ( b:magit_current_commit_mode == 'CA' ) - return "AMEND" - endif -endfunction - -command! Magit call magit#show_magit('v') -command! MagitOnly call magit#show_magit('c') - -" }}} diff --git a/.config/vim/plugin/prose.vim b/.config/vim/plugin/prose.vim @@ -1,38 +0,0 @@ -let g:ProseOn=0 - -function! ToggleProse() - if !g:ProseOn - call Prose() - else - call ProseOff() - endif -endfunction - -function! Prose() - echo "Prose: On" - let g:ProseOn=1 - - noremap j gj - noremap k gk - noremap 0 g0 - noremap $ g$ - noremap A g$a - noremap I g0i - setlocal linebreak nonumber norelativenumber t_Co=0 foldcolumn=2 - hi! link FoldColumn Normal - -endfunction - -function! ProseOff() - echo "Prose: Off" - let g:ProseOn=0 - - noremap j j - noremap k k - noremap 0 0 - noremap $ $ - noremap A A - noremap I I - setlocal nolinebreak number relativenumber t_Co=256 foldcolumn=0 - -endfunction diff --git a/.config/vim/plugin/repeat.vim b/.config/vim/plugin/repeat.vim @@ -1,165 +0,0 @@ -" repeat.vim - Let the repeat command repeat plugin maps -" Maintainer: Tim Pope -" Version: 1.2 -" GetLatestVimScripts: 2136 1 :AutoInstall: repeat.vim - -" Installation: -" Place in either ~/.vim/plugin/repeat.vim (to load at start up) or -" ~/.vim/autoload/repeat.vim (to load automatically as needed). -" -" License: -" Copyright (c) Tim Pope. Distributed under the same terms as Vim itself. -" See :help license -" -" Developers: -" Basic usage is as follows: -" -" silent! call repeat#set("\<Plug>MappingToRepeatCommand",3) -" -" The first argument is the mapping that will be invoked when the |.| key is -" pressed. Typically, it will be the same as the mapping the user invoked. -" This sequence will be stuffed into the input queue literally. Thus you must -" encode special keys by prefixing them with a backslash inside double quotes. -" -" The second argument is the default count. This is the number that will be -" prefixed to the mapping if no explicit numeric argument was given. The -" value of the v:count variable is usually correct and it will be used if the -" second parameter is omitted. If your mapping doesn't accept a numeric -" argument and you never want to receive one, pass a value of -1. -" -" Make sure to call the repeat#set function _after_ making changes to the -" file. -" -" For mappings that use a register and want the same register used on -" repetition, use: -" -" silent! call repeat#setreg("\<Plug>MappingToRepeatCommand", v:register) -" -" This function can (and probably needs to be) called before making changes to -" the file (as those typically clear v:register). Therefore, the call sequence -" in your mapping will look like this: -" -" nnoremap <silent> <Plug>MyMap -" \ :<C-U>execute 'silent! call repeat#setreg("\<lt>Plug>MyMap", v:register)'<Bar> -" \ call <SID>MyFunction(v:register, ...)<Bar> -" \ silent! call repeat#set("\<lt>Plug>MyMap")<CR> - -if exists("g:loaded_repeat") || &cp || v:version < 700 - finish -endif -let g:loaded_repeat = 1 - -let g:repeat_tick = -1 -let g:repeat_reg = ['', ''] - -" Special function to avoid spurious repeats in a related, naturally repeating -" mapping when your repeatable mapping doesn't increase b:changedtick. -function! repeat#invalidate() - autocmd! repeat_custom_motion - let g:repeat_tick = -1 -endfunction - -function! repeat#set(sequence,...) - let g:repeat_sequence = a:sequence - let g:repeat_count = a:0 ? a:1 : v:count - let g:repeat_tick = b:changedtick - augroup repeat_custom_motion - autocmd! - autocmd CursorMoved <buffer> let g:repeat_tick = b:changedtick | autocmd! repeat_custom_motion - augroup END -endfunction - -function! repeat#setreg(sequence,register) - let g:repeat_reg = [a:sequence, a:register] -endfunction - - -function! s:default_register() - let values = split(&clipboard, ',') - if index(values, 'unnamedplus') != -1 - return '+' - elseif index(values, 'unnamed') != -1 - return '*' - else - return '"' - endif -endfunction - -function! repeat#run(count) - try - if g:repeat_tick == b:changedtick - let r = '' - if g:repeat_reg[0] ==# g:repeat_sequence && !empty(g:repeat_reg[1]) - " Take the original register, unless another (non-default, we - " unfortunately cannot detect no vs. a given default register) - " register has been supplied to the repeat command (as an - " explicit override). - let regname = v:register ==# s:default_register() ? g:repeat_reg[1] : v:register - if regname ==# '=' - " This causes a re-evaluation of the expression on repeat, which - " is what we want. - let r = '"=' . getreg('=', 1) . "\<CR>" - else - let r = '"' . regname - endif - endif - - let c = g:repeat_count - let s = g:repeat_sequence - let cnt = c == -1 ? "" : (a:count ? a:count : (c ? c : '')) - if ((v:version == 703 && has('patch100')) || (v:version == 704 && !has('patch601'))) - exe 'norm ' . r . cnt . s - elseif v:version <= 703 - call feedkeys(r . cnt, 'n') - call feedkeys(s, '') - else - call feedkeys(s, 'i') - call feedkeys(r . cnt, 'ni') - endif - else - if ((v:version == 703 && has('patch100')) || (v:version == 704 && !has('patch601'))) - exe 'norm! '.(a:count ? a:count : '') . '.' - else - call feedkeys((a:count ? a:count : '') . '.', 'ni') - endif - endif - catch /^Vim(normal):/ - return 'echoerr v:errmsg' - endtry - return '' -endfunction - -function! repeat#wrap(command,count) - let preserve = (g:repeat_tick == b:changedtick) - call feedkeys((a:count ? a:count : '').a:command, 'n') - exe (&foldopen =~# 'undo\|all' ? 'norm! zv' : '') - if preserve - let g:repeat_tick = b:changedtick - endif -endfunction - -nnoremap <silent> <Plug>(RepeatDot) :<C-U>exe repeat#run(v:count)<CR> -nnoremap <silent> <Plug>(RepeatUndo) :<C-U>call repeat#wrap('u',v:count)<CR> -nnoremap <silent> <Plug>(RepeatUndoLine) :<C-U>call repeat#wrap('U',v:count)<CR> -nnoremap <silent> <Plug>(RepeatRedo) :<C-U>call repeat#wrap("\<Lt>C-R>",v:count)<CR> - -if !hasmapto('<Plug>(RepeatDot)', 'n') - nmap . <Plug>(RepeatDot) -endif -if !hasmapto('<Plug>(RepeatUndo)', 'n') - nmap u <Plug>(RepeatUndo) -endif -if maparg('U','n') ==# '' && !hasmapto('<Plug>(RepeatUndoLine)', 'n') - nmap U <Plug>(RepeatUndoLine) -endif -if !hasmapto('<Plug>(RepeatRedo)', 'n') - nmap <C-R> <Plug>(RepeatRedo) -endif - -augroup repeatPlugin - autocmd! - autocmd BufLeave,BufWritePre,BufReadPre * let g:repeat_tick = (g:repeat_tick == b:changedtick || g:repeat_tick == 0) ? 0 : -1 - autocmd BufEnter,BufWritePost * if g:repeat_tick == 0|let g:repeat_tick = b:changedtick|endif -augroup END - -" vim:set ft=vim et sw=4 sts=4: diff --git a/.config/vim/plugin/surround.vim b/.config/vim/plugin/surround.vim @@ -1,619 +0,0 @@ -" surround.vim - Surroundings -" Author: Tim Pope <http://tpo.pe/> -" Version: 2.1 -" GetLatestVimScripts: 1697 1 :AutoInstall: surround.vim - -if exists("g:loaded_surround") || &cp || v:version < 700 - finish -endif -let g:loaded_surround = 1 - -" Input functions {{{1 - -function! s:getchar() - let c = getchar() - if c =~ '^\d\+$' - let c = nr2char(c) - endif - return c -endfunction - -function! s:inputtarget() - let c = s:getchar() - while c =~ '^\d\+$' - let c .= s:getchar() - endwhile - if c == " " - let c .= s:getchar() - endif - if c =~ "\<Esc>\|\<C-C>\|\0" - return "" - else - return c - endif -endfunction - -function! s:inputreplacement() - let c = s:getchar() - if c == " " - let c .= s:getchar() - endif - if c =~ "\<Esc>" || c =~ "\<C-C>" - return "" - else - return c - endif -endfunction - -function! s:beep() - exe "norm! \<Esc>" - return "" -endfunction - -function! s:redraw() - redraw - return "" -endfunction - -" }}}1 - -" Wrapping functions {{{1 - -function! s:extractbefore(str) - if a:str =~ '\r' - return matchstr(a:str,'.*\ze\r') - else - return matchstr(a:str,'.*\ze\n') - endif -endfunction - -function! s:extractafter(str) - if a:str =~ '\r' - return matchstr(a:str,'\r\zs.*') - else - return matchstr(a:str,'\n\zs.*') - endif -endfunction - -function! s:fixindent(str,spc) - let str = substitute(a:str,'\t',repeat(' ',&sw),'g') - let spc = substitute(a:spc,'\t',repeat(' ',&sw),'g') - let str = substitute(str,'\(\n\|\%^\).\@=','\1'.spc,'g') - if ! &et - let str = substitute(str,'\s\{'.&ts.'\}',"\t",'g') - endif - return str -endfunction - -function! s:process(string) - let i = 0 - for i in range(7) - let repl_{i} = '' - let m = matchstr(a:string,nr2char(i).'.\{-\}\ze'.nr2char(i)) - if m != '' - let m = substitute(strpart(m,1),'\r.*','','') - let repl_{i} = input(match(m,'\w\+$') >= 0 ? m.': ' : m) - endif - endfor - let s = "" - let i = 0 - while i < strlen(a:string) - let char = strpart(a:string,i,1) - if char2nr(char) < 8 - let next = stridx(a:string,char,i+1) - if next == -1 - let s .= char - else - let insertion = repl_{char2nr(char)} - let subs = strpart(a:string,i+1,next-i-1) - let subs = matchstr(subs,'\r.*') - while subs =~ '^\r.*\r' - let sub = matchstr(subs,"^\r\\zs[^\r]*\r[^\r]*") - let subs = strpart(subs,strlen(sub)+1) - let r = stridx(sub,"\r") - let insertion = substitute(insertion,strpart(sub,0,r),strpart(sub,r+1),'') - endwhile - let s .= insertion - let i = next - endif - else - let s .= char - endif - let i += 1 - endwhile - return s -endfunction - -function! s:wrap(string,char,type,removed,special) - let keeper = a:string - let newchar = a:char - let s:input = "" - let type = a:type - let linemode = type ==# 'V' ? 1 : 0 - let before = "" - let after = "" - if type ==# "V" - let initspaces = matchstr(keeper,'\%^\s*') - else - let initspaces = matchstr(getline('.'),'\%^\s*') - endif - let pairs = "b()B{}r[]a<>" - let extraspace = "" - if newchar =~ '^ ' - let newchar = strpart(newchar,1) - let extraspace = ' ' - endif - let idx = stridx(pairs,newchar) - if newchar == ' ' - let before = '' - let after = '' - elseif exists("b:surround_".char2nr(newchar)) - let all = s:process(b:surround_{char2nr(newchar)}) - let before = s:extractbefore(all) - let after = s:extractafter(all) - elseif exists("g:surround_".char2nr(newchar)) - let all = s:process(g:surround_{char2nr(newchar)}) - let before = s:extractbefore(all) - let after = s:extractafter(all) - elseif newchar ==# "p" - let before = "\n" - let after = "\n\n" - elseif newchar ==# 's' - let before = ' ' - let after = '' - elseif newchar ==# ':' - let before = ':' - let after = '' - elseif newchar =~# "[tT\<C-T><]" - let dounmapp = 0 - let dounmapb = 0 - if !maparg(">","c") - let dounmapb = 1 - " Hide from AsNeeded - exe "cn"."oremap > ><CR>" - endif - let default = "" - if newchar ==# "T" - if !exists("s:lastdel") - let s:lastdel = "" - endif - let default = matchstr(s:lastdel,'<\zs.\{-\}\ze>') - endif - let tag = input("<",default) - if dounmapb - silent! cunmap > - endif - let s:input = tag - if tag != "" - let keepAttributes = ( match(tag, ">$") == -1 ) - let tag = substitute(tag,'>*$','','') - let attributes = "" - if keepAttributes - let attributes = matchstr(a:removed, '<[^ \t\n]\+\zs\_.\{-\}\ze>') - endif - let s:input = tag . '>' - if tag =~ '/$' - let tag = substitute(tag, '/$', '', '') - let before = '<'.tag.attributes.' />' - let after = '' - else - let before = '<'.tag.attributes.'>' - let after = '</'.substitute(tag,' .*','','').'>' - endif - if newchar == "\<C-T>" - if type ==# "v" || type ==# "V" - let before .= "\n\t" - endif - if type ==# "v" - let after = "\n". after - endif - endif - endif - elseif newchar ==# 'l' || newchar == '\' - " LaTeX - let env = input('\begin{') - if env != "" - let s:input = env."\<CR>" - let env = '{' . env - let env .= s:closematch(env) - echo '\begin'.env - let before = '\begin'.env - let after = '\end'.matchstr(env,'[^}]*').'}' - endif - elseif newchar ==# 'f' || newchar ==# 'F' - let fnc = input('function: ') - if fnc != "" - let s:input = fnc."\<CR>" - let before = substitute(fnc,'($','','').'(' - let after = ')' - if newchar ==# 'F' - let before .= ' ' - let after = ' ' . after - endif - endif - elseif newchar ==# "\<C-F>" - let fnc = input('function: ') - let s:input = fnc."\<CR>" - let before = '('.fnc.' ' - let after = ')' - elseif idx >= 0 - let spc = (idx % 3) == 1 ? " " : "" - let idx = idx / 3 * 3 - let before = strpart(pairs,idx+1,1) . spc - let after = spc . strpart(pairs,idx+2,1) - elseif newchar == "\<C-[>" || newchar == "\<C-]>" - let before = "{\n\t" - let after = "\n}" - elseif newchar !~ '\a' - let before = newchar - let after = newchar - else - let before = '' - let after = '' - endif - let after = substitute(after ,'\n','\n'.initspaces,'g') - if type ==# 'V' || (a:special && type ==# "v") - let before = substitute(before,' \+$','','') - let after = substitute(after ,'^ \+','','') - if after !~ '^\n' - let after = initspaces.after - endif - if keeper !~ '\n$' && after !~ '^\n' - let keeper .= "\n" - elseif keeper =~ '\n$' && after =~ '^\n' - let after = strpart(after,1) - endif - if keeper !~ '^\n' && before !~ '\n\s*$' - let before .= "\n" - if a:special - let before .= "\t" - endif - elseif keeper =~ '^\n' && before =~ '\n\s*$' - let keeper = strcharpart(keeper,1) - endif - if type ==# 'V' && keeper =~ '\n\s*\n$' - let keeper = strcharpart(keeper,0,strchars(keeper) - 1) - endif - endif - if type ==# 'V' - let before = initspaces.before - endif - if before =~ '\n\s*\%$' - if type ==# 'v' - let keeper = initspaces.keeper - endif - let padding = matchstr(before,'\n\zs\s\+\%$') - let before = substitute(before,'\n\s\+\%$','\n','') - let keeper = s:fixindent(keeper,padding) - endif - if type ==# 'V' - let keeper = before.keeper.after - elseif type =~ "^\<C-V>" - " Really we should be iterating over the buffer - let repl = substitute(before,'[\\~]','\\&','g').'\1'.substitute(after,'[\\~]','\\&','g') - let repl = substitute(repl,'\n',' ','g') - let keeper = substitute(keeper."\n",'\(.\{-\}\)\(\n\)',repl.'\n','g') - let keeper = substitute(keeper,'\n\%$','','') - else - let keeper = before.extraspace.keeper.extraspace.after - endif - return keeper -endfunction - -function! s:wrapreg(reg,char,removed,special) - let orig = getreg(a:reg) - let type = substitute(getregtype(a:reg),'\d\+$','','') - let new = s:wrap(orig,a:char,type,a:removed,a:special) - call setreg(a:reg,new,type) -endfunction -" }}}1 - -function! s:insert(...) " {{{1 - " Optional argument causes the result to appear on 3 lines, not 1 - let linemode = a:0 ? a:1 : 0 - let char = s:inputreplacement() - while char == "\<CR>" || char == "\<C-S>" - " TODO: use total count for additional blank lines - let linemode += 1 - let char = s:inputreplacement() - endwhile - if char == "" - return "" - endif - let cb_save = &clipboard - set clipboard-=unnamed clipboard-=unnamedplus - let reg_save = @@ - call setreg('"',"\r",'v') - call s:wrapreg('"',char,"",linemode) - " If line mode is used and the surrounding consists solely of a suffix, - " remove the initial newline. This fits a use case of mine but is a - " little inconsistent. Is there anyone that would prefer the simpler - " behavior of just inserting the newline? - if linemode && match(getreg('"'),'^\n\s*\zs.*') == 0 - call setreg('"',matchstr(getreg('"'),'^\n\s*\zs.*'),getregtype('"')) - endif - " This can be used to append a placeholder to the end - if exists("g:surround_insert_tail") - call setreg('"',g:surround_insert_tail,"a".getregtype('"')) - endif - if &ve != 'all' && col('.') >= col('$') - if &ve == 'insert' - let extra_cols = virtcol('.') - virtcol('$') - if extra_cols > 0 - let [regval,regtype] = [getreg('"',1,1),getregtype('"')] - call setreg('"',join(map(range(extra_cols),'" "'),''),'v') - norm! ""p - call setreg('"',regval,regtype) - endif - endif - norm! ""p - else - norm! ""P - endif - if linemode - call s:reindent() - endif - norm! `] - call search('\r','bW') - let @@ = reg_save - let &clipboard = cb_save - return "\<Del>" -endfunction " }}}1 - -function! s:reindent() " {{{1 - if exists("b:surround_indent") ? b:surround_indent : (!exists("g:surround_indent") || g:surround_indent) - silent norm! '[='] - endif -endfunction " }}}1 - -function! s:dosurround(...) " {{{1 - let scount = v:count1 - let char = (a:0 ? a:1 : s:inputtarget()) - let spc = "" - if char =~ '^\d\+' - let scount = scount * matchstr(char,'^\d\+') - let char = substitute(char,'^\d\+','','') - endif - if char =~ '^ ' - let char = strpart(char,1) - let spc = 1 - endif - if char == 'a' - let char = '>' - endif - if char == 'r' - let char = ']' - endif - let newchar = "" - if a:0 > 1 - let newchar = a:2 - if newchar == "\<Esc>" || newchar == "\<C-C>" || newchar == "" - return s:beep() - endif - endif - let cb_save = &clipboard - set clipboard-=unnamed clipboard-=unnamedplus - let append = "" - let original = getreg('"') - let otype = getregtype('"') - call setreg('"',"") - let strcount = (scount == 1 ? "" : scount) - if char == '/' - exe 'norm! '.strcount.'[/d'.strcount.']/' - elseif char =~# '[[:punct:][:space:]]' && char !~# '[][(){}<>"''`]' - exe 'norm! T'.char - if getline('.')[col('.')-1] == char - exe 'norm! l' - endif - exe 'norm! dt'.char - else - exe 'norm! d'.strcount.'i'.char - endif - let keeper = getreg('"') - let okeeper = keeper " for reindent below - if keeper == "" - call setreg('"',original,otype) - let &clipboard = cb_save - return "" - endif - let oldline = getline('.') - let oldlnum = line('.') - if char ==# "p" - call setreg('"','','V') - elseif char ==# "s" || char ==# "w" || char ==# "W" - " Do nothing - call setreg('"','') - elseif char =~ "[\"'`]" - exe "norm! i \<Esc>d2i".char - call setreg('"',substitute(getreg('"'),' ','','')) - elseif char == '/' - norm! "_x - call setreg('"','/**/',"c") - let keeper = substitute(substitute(keeper,'^/\*\s\=','',''),'\s\=\*$','','') - elseif char =~# '[[:punct:][:space:]]' && char !~# '[][(){}<>]' - exe 'norm! F'.char - exe 'norm! df'.char - else - " One character backwards - call search('\m.', 'bW') - exe "norm! da".char - endif - let removed = getreg('"') - let rem2 = substitute(removed,'\n.*','','') - let oldhead = strpart(oldline,0,strlen(oldline)-strlen(rem2)) - let oldtail = strpart(oldline, strlen(oldline)-strlen(rem2)) - let regtype = getregtype('"') - if char =~# '[\[({<T]' || spc - let keeper = substitute(keeper,'^\s\+','','') - let keeper = substitute(keeper,'\s\+$','','') - endif - if col("']") == col("$") && col('.') + 1 == col('$') - if oldhead =~# '^\s*$' && a:0 < 2 - let keeper = substitute(keeper,'\%^\n'.oldhead.'\(\s*.\{-\}\)\n\s*\%$','\1','') - endif - let pcmd = "p" - else - let pcmd = "P" - endif - if line('.') + 1 < oldlnum && regtype ==# "V" - let pcmd = "p" - endif - call setreg('"',keeper,regtype) - if newchar != "" - let special = a:0 > 2 ? a:3 : 0 - call s:wrapreg('"',newchar,removed,special) - endif - silent exe 'norm! ""'.pcmd.'`[' - if removed =~ '\n' || okeeper =~ '\n' || getreg('"') =~ '\n' - call s:reindent() - endif - if getline('.') =~ '^\s\+$' && keeper =~ '^\s*\n' - silent norm! cc - endif - call setreg('"',original,otype) - let s:lastdel = removed - let &clipboard = cb_save - if newchar == "" - silent! call repeat#set("\<Plug>Dsurround".char,scount) - else - silent! call repeat#set("\<Plug>C".(a:0 > 2 && a:3 ? "S" : "s")."urround".char.newchar.s:input,scount) - endif -endfunction " }}}1 - -function! s:changesurround(...) " {{{1 - let a = s:inputtarget() - if a == "" - return s:beep() - endif - let b = s:inputreplacement() - if b == "" - return s:beep() - endif - call s:dosurround(a,b,a:0 && a:1) -endfunction " }}}1 - -function! s:opfunc(type, ...) abort " {{{1 - if a:type ==# 'setup' - let &opfunc = matchstr(expand('<sfile>'), '<SNR>\w\+$') - return 'g@' - endif - let char = s:inputreplacement() - if char == "" - return s:beep() - endif - let reg = '"' - let sel_save = &selection - let &selection = "inclusive" - let cb_save = &clipboard - set clipboard-=unnamed clipboard-=unnamedplus - let reg_save = getreg(reg) - let reg_type = getregtype(reg) - let type = a:type - if a:type == "char" - silent exe 'norm! v`[o`]"'.reg.'y' - let type = 'v' - elseif a:type == "line" - silent exe 'norm! `[V`]"'.reg.'y' - let type = 'V' - elseif a:type ==# "v" || a:type ==# "V" || a:type ==# "\<C-V>" - let &selection = sel_save - let ve = &virtualedit - if !(a:0 && a:1) - set virtualedit= - endif - silent exe 'norm! gv"'.reg.'y' - let &virtualedit = ve - elseif a:type =~ '^\d\+$' - let type = 'v' - silent exe 'norm! ^v'.a:type.'$h"'.reg.'y' - if mode() ==# 'v' - norm! v - return s:beep() - endif - else - let &selection = sel_save - let &clipboard = cb_save - return s:beep() - endif - let keeper = getreg(reg) - if type ==# "v" && a:type !=# "v" - let append = matchstr(keeper,'\_s\@<!\s*$') - let keeper = substitute(keeper,'\_s\@<!\s*$','','') - endif - call setreg(reg,keeper,type) - call s:wrapreg(reg,char,"",a:0 && a:1) - if type ==# "v" && a:type !=# "v" && append != "" - call setreg(reg,append,"ac") - endif - silent exe 'norm! gv'.(reg == '"' ? '' : '"' . reg).'p`[' - if type ==# 'V' || (getreg(reg) =~ '\n' && type ==# 'v') - call s:reindent() - endif - call setreg(reg,reg_save,reg_type) - let &selection = sel_save - let &clipboard = cb_save - if a:type =~ '^\d\+$' - silent! call repeat#set("\<Plug>Y".(a:0 && a:1 ? "S" : "s")."surround".char.s:input,a:type) - else - silent! call repeat#set("\<Plug>SurroundRepeat".char.s:input) - endif -endfunction - -function! s:opfunc2(...) abort - if !a:0 || a:1 ==# 'setup' - let &opfunc = matchstr(expand('<sfile>'), '<SNR>\w\+$') - return 'g@' - endif - call s:opfunc(a:1, 1) -endfunction " }}}1 - -function! s:closematch(str) " {{{1 - " Close an open (, {, [, or < on the command line. - let tail = matchstr(a:str,'.[^\[\](){}<>]*$') - if tail =~ '^\[.\+' - return "]" - elseif tail =~ '^(.\+' - return ")" - elseif tail =~ '^{.\+' - return "}" - elseif tail =~ '^<.+' - return ">" - else - return "" - endif -endfunction " }}}1 - -nnoremap <silent> <Plug>SurroundRepeat . -nnoremap <silent> <Plug>Dsurround :<C-U>call <SID>dosurround(<SID>inputtarget())<CR> -nnoremap <silent> <Plug>Csurround :<C-U>call <SID>changesurround()<CR> -nnoremap <silent> <Plug>CSurround :<C-U>call <SID>changesurround(1)<CR> -nnoremap <expr> <Plug>Yssurround '^'.v:count1.<SID>opfunc('setup').'g_' -nnoremap <expr> <Plug>YSsurround <SID>opfunc2('setup').'_' -nnoremap <expr> <Plug>Ysurround <SID>opfunc('setup') -nnoremap <expr> <Plug>YSurround <SID>opfunc2('setup') -vnoremap <silent> <Plug>VSurround :<C-U>call <SID>opfunc(visualmode(),visualmode() ==# 'V' ? 1 : 0)<CR> -vnoremap <silent> <Plug>VgSurround :<C-U>call <SID>opfunc(visualmode(),visualmode() ==# 'V' ? 0 : 1)<CR> -inoremap <silent> <Plug>Isurround <C-R>=<SID>insert()<CR> -inoremap <silent> <Plug>ISurround <C-R>=<SID>insert(1)<CR> - -if !exists("g:surround_no_mappings") || ! g:surround_no_mappings - nmap ds <Plug>Dsurround - nmap cs <Plug>Csurround - nmap cS <Plug>CSurround - nmap ys <Plug>Ysurround - nmap yS <Plug>YSurround - nmap yss <Plug>Yssurround - nmap ySs <Plug>YSsurround - nmap ySS <Plug>YSsurround - xmap S <Plug>VSurround - xmap gS <Plug>VgSurround - if !exists("g:surround_no_insert_mappings") || ! g:surround_no_insert_mappings - if !hasmapto("<Plug>Isurround","i") && "" == mapcheck("<C-S>","i") - imap <C-S> <Plug>Isurround - endif - imap <C-G>s <Plug>Isurround - imap <C-G>S <Plug>ISurround - endif -endif - -" vim:set ft=vim sw=2 sts=2 et: diff --git a/.config/vim/plugin/system_copy.vim b/.config/vim/plugin/system_copy.vim @@ -1,148 +0,0 @@ -if exists('g:loaded_system_copy') || v:version < 700 - finish -endif -let g:loaded_system_copy = 1 - -let s:blockwise = 'blockwise visual' -let s:visual = 'visual' -let s:motion = 'motion' -let s:linewise = 'linewise' -let s:mac = 'mac' -let s:windows = 'windows' -let s:linux = 'linux' - -function! s:system_copy(type, ...) abort - let mode = <SID>resolve_mode(a:type, a:0) - let unnamed = @@ - if mode == s:linewise - let lines = { 'start': line("'["), 'end': line("']") } - silent exe lines.start . "," . lines.end . "y" - elseif mode == s:visual || mode == s:blockwise - silent exe "normal! `<" . a:type . "`>y" - else - silent exe "normal! `[v`]y" - endif - let command = s:CopyCommandForCurrentOS() - silent call system(command, getreg('@')) - echohl String | echon 'Copied to clipboard using: ' . command | echohl None - let @@ = unnamed -endfunction - -function! s:system_paste(type, ...) abort - let mode = <SID>resolve_mode(a:type, a:0) - let command = <SID>PasteCommandForCurrentOS() - let unnamed = @@ - if mode == s:linewise - let lines = { 'start': line("'["), 'end': line("']") } - silent exe lines.start . "," . lines.end . "d" - silent exe "set paste | normal! O" . system(command) - silent exe "set nopaste" - elseif mode == s:visual || mode == s:blockwise - silent exe "normal! `<" . a:type . "`>c" . system(command) - else - silent exe "normal! `[v`]c" . system(command) - endif - echohl String | echon 'Pasted to clipboard using: ' . command | echohl None - let @@ = unnamed -endfunction - -function! s:system_paste_line() abort - let command = <SID>PasteCommandForCurrentOS() - put =system(command) - echohl String | echon 'Pasted to vim using: ' . command | echohl None -endfunction - -function! s:resolve_mode(type, arg) - let visual_mode = a:arg != 0 - if visual_mode - return (a:type == '') ? s:blockwise : s:visual - elseif a:type == 'line' - return s:linewise - else - return s:motion - endif -endfunction - -function! s:currentOS() - let os = substitute(system('uname'), '\n', '', '') - let known_os = 'unknown' - if has("gui_mac") || os ==? 'Darwin' - let known_os = s:mac - elseif has("gui_win32") || os =~? 'cygwin' || os =~? 'MINGW' - let known_os = s:windows - elseif os ==? 'Linux' - let known_os = s:linux - else - exe "normal \<Esc>" - throw "unknown OS: " . os - endif - return known_os -endfunction - -function! s:CopyCommandForCurrentOS() - if exists('g:system_copy#copy_command') - return g:system_copy#copy_command - endif - let os = <SID>currentOS() - if os == s:mac - return 'pbcopy' - elseif os == s:windows - return 'clip' - elseif os == s:linux - if !empty($WAYLAND_DISPLAY) - return 'wl-copy' - else - return 'xsel --clipboard --input' - endif - endif -endfunction - -function! s:PasteCommandForCurrentOS() - if exists('g:system_copy#paste_command') - return g:system_copy#paste_command - endif - let os = <SID>currentOS() - if os == s:mac - return 'pbpaste' - elseif os == s:windows - return 'paste' - elseif os == s:linux - if !empty($WAYLAND_DISPLAY) - return 'wl-paste -n' - else - return 'xsel --clipboard --output' - endif - endif -endfunction - -xnoremap <silent> <Plug>SystemCopy :<C-U>call <SID>system_copy(visualmode(),visualmode() ==# 'V' ? 1 : 0)<CR> -nnoremap <silent> <Plug>SystemCopy :<C-U>set opfunc=<SID>system_copy<CR>g@ -nnoremap <silent> <Plug>SystemCopyLine :<C-U>set opfunc=<SID>system_copy<Bar>exe 'norm! 'v:count1.'g@_'<CR> -xnoremap <silent> <Plug>SystemPaste :<C-U>call <SID>system_paste(visualmode(),visualmode() ==# 'V' ? 1 : 0)<CR> -nnoremap <silent> <Plug>SystemPaste :<C-U>set opfunc=<SID>system_paste<CR>g@ -nnoremap <silent> <Plug>SystemPasteLine :<C-U>call <SID>system_paste_line()<CR> - -if !hasmapto('<Plug>SystemCopy', 'n') || maparg('cp', 'n') ==# '' - nmap cp <Plug>SystemCopy -endif - -if !hasmapto('<Plug>SystemCopy', 'v') || maparg('cp', 'v') ==# '' - xmap cp <Plug>SystemCopy -endif - -if !hasmapto('<Plug>SystemCopyLine', 'n') || maparg('cP', 'n') ==# '' - nmap cP <Plug>SystemCopyLine -endif - -if !hasmapto('<Plug>SystemPaste', 'n') || maparg('cv', 'n') ==# '' - nmap cv <Plug>SystemPaste -endif - -if !hasmapto('<Plug>SystemPaste', 'v') || maparg('cv', 'v') ==# '' - xmap cv <Plug>SystemPaste -endif - -if !hasmapto('<Plug>SystemPasteLine', 'n') || maparg('cV', 'n') ==# '' - nmap cV <Plug>SystemPasteLine -endif -" vim:ts=2:sw=2:sts=2 diff --git a/.config/vim/syntax/magit.vim b/.config/vim/syntax/magit.vim @@ -1,51 +0,0 @@ -if exists("b:current_syntax") - finish -endif - -let s:vimagit_path = fnameescape(resolve(expand('<sfile>:p:h'))) -execute 'source ' . s:vimagit_path . '/../common/magit_common.vim' - -syn case match -syn sync minlines=50 - -syn include @diff syntax/diff.vim - -execute 'syn match titleEntry "' . g:magit_section_re . '\n\%(.*\n\)\{-}=\+"' -hi def link titleEntry Comment - -execute 'syn region commitMsg start=/' . g:magit_sections.commit . '/ end=/\%(' . g:magit_section_re . '\)\@=/ contains=titleEntry' -execute 'syn match commitMsgExceed "\%(=\+\n\+\_^.\{' . g:magit_commit_title_limit . '}\)\@<=.*$" contained containedin=commitMsg' -hi def link commitMsgExceed Comment - -execute 'syn match stashEntry "' . g:magit_stash_re . '"' -hi def link stashEntry String - -execute 'syn match fileEntry "' . g:magit_file_re . '"' -hi def link fileEntry String - -execute 'syn region gitStash start=/' . g:magit_stash_re . '/ end=/\%(' . - \ g:magit_stash_re . '\)\@=/ contains=stashEntry fold' - -execute 'syn region gitFile start=/' . g:magit_file_re . '/ end=/\%(' . - \ g:magit_end_diff_re . '\)\@=/ contains=gitHunk,fileEntry fold' - -execute 'syn region gitHunk start=/' . - \ g:magit_hunk_re . '/ end=/\%(' . g:magit_end_diff_re . '\|' . g:magit_hunk_re - \ '\)\@=/ contains=@diff fold' - -execute 'syn match gitInfoRepo "\%(' . g:magit_section_info.cur_repo . '\)\@<=.*$" oneline' -execute 'syn match gitInfoHead "\%(' . g:magit_section_info.cur_head . '\s*\)\@<=\S\+" oneline' -execute 'syn match gitInfoUpstream "\%(' . g:magit_section_info.cur_upstream . '\s*\)\@<=\S\+" oneline' -execute 'syn match gitInfoPush "\%(' . g:magit_section_info.cur_push . '\s*\)\@<=\S\+" oneline' -execute 'syn match gitCommitMode "\%(' . g:magit_section_info.commit_mode . '\)\@<=.*$" oneline' -"execute 'syn match gitInfoCommit "\%(' . g:magit_section_info.cur_commit . '\)\@<=.*$" contains=infoSha1 oneline' -"syntax match infoSha1 containedin=gitInfoCommit "\x\{7,}" - -highlight default link gitInfoRepo Directory -highlight default link gitInfoHead Identifier -highlight default link gitInfoUpstream Identifier -highlight default link gitInfoPush Identifier -highlight default link gitCommitMode Special -highlight default link infoSha1 Identifier - -let b:current_syntax = "magit" diff --git a/.config/vimb/config b/.config/vimb/config @@ -15,7 +15,9 @@ set home-page=http://www.haydenvh.com/h/ set smooth-scrolling=false set webinspector=true -nnoremap vh :sh! vimbhist +nnoremap vh :sh! vimbhist<CR> +nnoremap Q :q!<CR> +nmap B :sh! mpv "$(xclip -o)"<CR> shortcut-add sx=https://searx.me/?q=$0 shortcut-add sch=https://searx.ch/?q=$0 @@ -35,4 +37,4 @@ shortcut-add map=https://map.openaerialmap.org/#/ shortcut-add ebay=https://www.ebay.co.uk/sch/$0 shortcut-add am=https://www.amazon.co.uk/s?k=$0 shortcut-add 8g=https://8kun.top/g/catalog.html -shortcut-add 8g=https://8kun.top/brit/catalog.html +shortcut-add 8b=https://8kun.top/brit/catalog.html diff --git a/.config/zsh/.zshrc b/.config/zsh/.zshrc @@ -1,17 +1,33 @@ # Make alias' mkalias +# Prompt +precmd(){ + prev="$?" + branch=$(git branch 2>/dev/null | grep "\*" | tr -d '\*') + prompt="%F{3}" + prompt+="█ " + [ "$prev" != "0" ] && prompt+="%F{10}$prev " + prompt+="%F{4}" + prompt+="%n" + prompt+=" %F{6}" + prompt+="%~/" + prompt+="%F{5}" + prompt+="$branch" + prompt+="%F{5}" + prompt+=" > " + prompt+="%F" + export PROMT="$prompt" +} + # Completion autoload -Uz compinit promptinit compinit promptinit -. $HOME/.ls_colors zstyle ':completion:*' menu select zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS} -export PROMPT="%F{2}[%F{3}%F{4}%n@%F{5}%M %F{6}%~/%F{2}]%F{11}\$ %F" - # Vi-mode bindkey -v zmodload zsh/complist @@ -22,9 +38,6 @@ bindkey -M menuselect 'k' vi-up-line-or-history bindkey -M menuselect 'l' vi-forward-char bindkey -v '^?' backward-delete-char -# Alias' -. $ZDOTDIR/alias - # Keys typeset -g -A key key[Home]="${terminfo[khome]}" @@ -40,8 +53,8 @@ key[PageUp]="${terminfo[kpp]}" key[PageDown]="${terminfo[knp]}" key[ShiftTab]="${terminfo[kcbt]}" -# Functions -. $HOME/.config/zsh/functions +# Load .zsh files +. $ZDOTDIR/*.zsh # Highlighted man pages export LESS_TERMCAP_mb=$'\e[1;32m' diff --git a/.config/zsh/alias b/.config/zsh/alias @@ -1,72 +0,0 @@ -alias ls=" \ls --color" -alias l=" \ls --color" -alias la=" \ls --color -a" -alias ll=" \ls --color -lh" -alias lla=" \ls --color -lah" -alias vim=" nvim" -alias vi=" nvim" -alias v=" nvim" -alias xi=" sudo xbps-install" -alias xiu=" sudo xbps-install -S; sudo xbps-install -yu xbps; sudo xbps-install -yu" -alias xq=" sudo xbps-query" -alias xr=" sudo xbps-remove" -alias irssi=" \irssi --config ~/.config/irssi/config" -alias pipes=" \pipes -R -r 10000 -c 10 -c 11 -c 12 -c 13 -c 14 -c 15 -s 15" -alias clock=" tty-clock -s -c -C 7" -alias ytdl=" youtube-dl --add-metadata -ic" -alias ytdla=" youtube-dl --add-metadata -xic" -alias map=" telnet mapscii.me" -alias tetris=" ssh netris.rocketnine.space" -alias calcurse=" \calcurse -D ~/.config/calcurse" -alias irssi=" \irssi --home ~/.config/irssi/ -n haydenh" -alias zsleep=" sudo zzz" -alias hibernate=" sudo ZZZ" -alias rmst=" bash ~/.scripts/random/gnulinux.sh" -alias fff=" bash ~/.config/fff/config" -alias python=" python3" -alias vimb=" \vimb --no-maximize" -alias cleancache=" sudo xbps-remove -Oo; rm -rf ~/.cache ~/.mozilla ~/.local/share/webkitgtk ~/.viminfo ~/.wget-hsts ~/.lesshst ~/.sh_history ~/.python_history ~/.*history ~/.*hst ~/.dbus ~/.sciminfo ~/.viminfo ~/.w3m; sudo vkpurge rm all" -alias mkconfall=" mkmailpass; mkalias" -alias nw=" newsboat" -alias nm=" neomutt" -alias conftar=" cd ~; sshtar .config/ .tmux.conf .terminfo/ .scripts/ .alias .galias .vimrc" -alias maic=" sudo make all install clean" -alias ~d=" cd ~/general/downloads; ls" -alias ~do=" cd ~/general/documents; ls" -alias ~iw=" cd ~/images/wallpapers; ls" -alias ~i=" cd ~/images; ls" -alias ~v=" cd ~/videos; ls" -alias ~m=" cd ~/music; ls" -alias ~w=" cd ~/work; ls" -alias ~c=" cd ~/.config; ls" -alias ~s=" cd ~/.scripts; ls" -alias ~sb=" cd ~/.scripts/bin; ls" -alias ~sbdi=" cd ~/.scripts/bin/display; ls" -alias ~sbdm=" cd ~/.scripts/bin/dmenu; ls" -alias ~sbi=" cd ~/.scripts/bin/i3; ls" -alias ~sbm=" cd ~/.scripts/bin/misc; ls" -alias ~vrc=" vim ~/.vimrc" -alias ..=" cd .." -alias ...=" cd ../.." -alias ....=" cd ../../.." -alias .....=" cd ../../../.." -alias ......=" cd ../../../../.." -alias .......=" cd ../../../../../.." -alias ........=" cd ../../../../../../.." -alias .........=" cd ../../../../../../../.." -alias ..........=" cd ../../../../../../../../.." -alias ...........=" cd ../../../../../../../../../.." -alias ............=" cd ../../../../../../../../../../.." -alias -g ...=" ../.." -alias -g ....=" ../../.." -alias -g .....=" ../../../.." -alias -g ......=" ../../../../.." -alias -g .......=" ../../../../../.." -alias -g ........=" ../../../../../../.." -alias -g .........=" ../../../../../../../.." -alias -g ..........=" ../../../../../../../../.." -alias -g ...........=" ../../../../../../../../../.." -alias -g ............=" ../../../../../../../../../../.." -alias -g om=" origin master" -alias -g gm=" github master" -alias -g aic=" all install clean" diff --git a/.config/zsh/alias.zsh b/.config/zsh/alias.zsh @@ -0,0 +1,71 @@ +alias ls=" \ls --color" +alias l=" \ls --color" +alias la=" \ls --color -A" +alias ll=" \ls --color -lh" +alias lla=" \ls --color -lAh" +alias vim=" nvim" +alias vi=" nvim" +alias v=" nvim" +alias xi=" sudo xbps-install" +alias xiu=" sudo xbps-install -S; sudo xbps-install -yu xbps; sudo xbps-install -yu" +alias xq=" sudo xbps-query" +alias xr=" sudo xbps-remove" +alias irssi=" \irssi --config ~/.config/irssi/config" +alias pipes=" \pipes -R -r 10000 -c 10 -c 11 -c 12 -c 13 -c 14 -c 15 -s 15" +alias clock=" tty-clock -s -c -C 7" +alias ytdl=" youtube-dl --add-metadata -ic" +alias ytdla=" youtube-dl --add-metadata -xic" +alias map=" telnet mapscii.me" +alias tetris=" ssh netris.rocketnine.space" +alias irssi=" \irssi --home ~/.config/irssi/ -n haydenh" +alias zsleep=" sudo zzz" +alias hibernate=" sudo ZZZ" +alias rmst=" bash ~/.scripts/random/gnulinux.sh" +alias vimb=" \vimb --no-maximize" +alias cleancache=" sudo xbps-remove -Ooy; rm -rf ~/.cache ~/.mozilla ~/.local/share/webkitgtk ~/.viminfo ~/.wget-hsts ~/.lesshst ~/.sh_history ~/.python_history ~/.*history ~/.*hst ~/.dbus ~/.sciminfo ~/.viminfo ~/.w3m; sudo vkpurge rm all" +alias mkconfall=" mkmailpass; mkalias" +alias tmux=" tmux -f ~/.config/tmux/config" +alias nw=" newsboat" +alias nm=" neomutt" +alias maic=" sudo make all install clean" +alias ~d=" cd ~/general/downloads; ls" +alias ~do=" cd ~/general/documents; ls" +alias ~iw=" cd ~/images/wallpapers; ls" +alias ~i=" cd ~/images; ls" +alias ~v=" cd ~/videos; ls" +alias ~m=" cd ~/music; ls" +alias ~w=" cd ~/work; ls" +alias ~c=" cd ~/.config; ls" +alias ~s=" cd ~/.scripts; ls" +alias ~sb=" cd ~/.scripts/bin; ls" +alias ~sbdi=" cd ~/.scripts/bin/display; ls" +alias ~sbdm=" cd ~/.scripts/bin/dmenu; ls" +alias ~sbi=" cd ~/.scripts/bin/i3; ls" +alias ~sbm=" cd ~/.scripts/bin/misc; ls" +alias ~vrc=" vim ~/.vimrc" +alias ..=" cd .." +alias ...=" cd ../.." +alias ....=" cd ../../.." +alias .....=" cd ../../../.." +alias ......=" cd ../../../../.." +alias .......=" cd ../../../../../.." +alias ........=" cd ../../../../../../.." +alias .........=" cd ../../../../../../../.." +alias ..........=" cd ../../../../../../../../.." +alias ...........=" cd ../../../../../../../../../.." +alias ............=" cd ../../../../../../../../../../.." +alias -g ...=" ../.." +alias -g ....=" ../../.." +alias -g .....=" ../../../.." +alias -g ......=" ../../../../.." +alias -g .......=" ../../../../../.." +alias -g ........=" ../../../../../../.." +alias -g .........=" ../../../../../../../.." +alias -g ..........=" ../../../../../../../../.." +alias -g ...........=" ../../../../../../../../../.." +alias -g ............=" ../../../../../../../../../../.." +alias -g om=" origin master" +alias -g o=" origin" +alias -g gm=" github master" +alias -g g=" github" +alias -g aic=" all install clean" diff --git a/.config/zsh/functions b/.config/zsh/functions.zsh diff --git a/.ls_colors b/.config/zsh/ls.zsh diff --git a/.galias b/.galias @@ -1,13 +0,0 @@ -... ../.. -.... ../../.. -..... ../../../.. -...... ../../../../.. -....... ../../../../../.. -........ ../../../../../../.. -......... ../../../../../../../.. -.......... ../../../../../../../../.. -........... ../../../../../../../../../.. -............ ../../../../../../../../../../.. -om origin master -gm github master -aic all install clean diff --git a/.gitaddlist b/.gitaddlist @@ -1,57 +0,0 @@ -git add ./LICENSE -git add .alias -git add .tmux.conf -git add .gitaddlist -git add .zprofile -git add .config/zsh/ -git add ./.Xresources -git add ./.bash_profile -git add ./.bashrc -git add ./.profile -git add ./.scripts/ -git add ./.xprofile -git add ./.ls_colors -git add ./.xinitrc -git add ./.Xresources -git add .config/bash/ -git add .config/dunst/dunstrc -git add .config/picom/config -git add .config/irssi/pipeline.theme -git add .config/irssi/default.theme -git add .config/irssi/scripts/autorun/ -git add .config/irssi/config -git add .config/i3blocks/i3blocks -git add .config/i3blocks/config -git add .config/i3blocks/config2 -git add .config/grub/grub.cfg -git add .config/grub -git add .config/grub/grub -git add .config/grub/background.png -git add .config/grub/autoinstall.sh -git add .config/youtube-dl/config -git add .config/neofetch/config.conf -git add .config/mpd/mpd.conf -git add .config/fff/fff -git add .config/fff/config -git add .config/dfm/config -git add .config/dfm/bookmarks -git add .config/youtube-viewer/youtube-viewer.conf -git add .config/newsboat/config -git add .config/mpv/input.conf -git add .config/mpv/mpv.conf -git add .config/i3/config -git add .config/calcurse/keys -git add .config/calcurse/conf -git add .config/fish/config.fish -git add .config/fish/alias -git add .config/vimb/config -git add .config/vimb/style.css -git add .config/vimb/scripts.js -git add .config/neomutt/neomuttrc -git add .config/neomutt/colours -git add .config/neomutt/sidebar -git add .config/nvim/ -git rm --cache .config/nvim/.netrwhist -git add general/make.sh -git rm --cache .config/zsh/.zcompdump -git add .galias diff --git a/.local/xauth b/.local/xauth Binary files differ. diff --git a/.Xresources b/.local/xres diff --git a/.profile b/.profile @@ -1,34 +0,0 @@ -# -# .profile -# Created by Hayden Hamilton -# -# haydenvh.com -# Copyright (c) 2019 Hayden Hamilton. LICENSE:GPLv2 ./licenses/gplv2.license -# - -export LC_CTYPE="en_US.UTF-8" -export LANG="en_US.UTF-8" -export LC_ALL="C" -export SCRIPTS="$HOME/.scripts/bin" -scripts=$(ls -d $SCRIPTS/*/ | tr '\n' ':') -export PATH="$PATH:$scripts" -export EDITOR="nvim" -export TERMINAL="st" -export BROWSER="vimb" -export work="$HOME/work" -export WORK="$HOME/work" -export SUDO_ASKPASS="$HOME/.scripts/bin/dmenu/daskpass" -export PASS="$HOME/general/security/pass" -export SHELL="/usr/bin/zsh" -export ZDOTDIR="$HOME/.config/zsh" -xrdb -merge ~/.Xresources -. ~/.ls_colors -[ "$hostname" != "" ] && { - echo > /dev/null -} || [ "$HOSTNAME" != "" ] && { - export hostname="$HOSTNAME" -} || [ "$(command -v hostname)" != "" ] && { - export hostname=$(hostname) -} || { - echo "No built in way to get a hostname..." -}; diff --git a/.scripts/bin/dmenu/dircgetpass b/.scripts/bin/dmenu/dircgetpass @@ -1,7 +1,6 @@ #!/bin/bash dmenu="dmenu" . $HOME/.config/irssi/userrc -. $HOME/.dmenurc #Servers { SERVERS="RIZON FREENODE" diff --git a/.scripts/bin/misc/cvrestart b/.scripts/bin/misc/cvrestart @@ -1,8 +1,8 @@ #!/bin/sh -pkill convtodwm +pkill dwmbar pkill fetchmail -cd ~/.scripts/i3blocks -exec ./convtodwm >/dev/null 2>/dev/null & +cd ~/.scripts/dwmblocks +exec ./dwmbar >/dev/null 2>/dev/null & disown -a diff --git a/.scripts/bin/misc/dotadd b/.scripts/bin/misc/dotadd @@ -0,0 +1,39 @@ +git add ./LICENSE +git add .config/sxhkd/ +git add .local/xauth +git add .local/xres +git add .local/etc/mailcap +git add .config/alias +git add .config/tmux/config +git add .zprofile +git add .config/zsh/ +git add ./.scripts/ +git add ./.xprofile +git add ./.xinitrc +git add .config/picom/config +git add .config/irssi/pipeline.theme +git add .config/irssi/default.theme +git add .config/irssi/scripts/autorun/ +git add .config/irssi/config +git add .config/grub/grub.cfg +git add .config/grub +git add .config/grub/grub +git add .config/grub/background.png +git add .config/grub/autoinstall.sh +git add .config/youtube-dl/config +git add .config/dfm/config +git add .config/dfm/bookmarks +git add .config/youtube-viewer/youtube-viewer.conf +git add .config/newsboat/config +git add .config/mpv/input.conf +git add .config/mpv/mpv.conf +git add .config/vimb/config +git add .config/vimb/style.css +git add .config/vimb/scripts.js +git add .config/neomutt/neomuttrc +git add .config/neomutt/colours +git add .config/neomutt/sidebar +git add .config/nvim/ +git rm --cache .config/nvim/.netrwhist +git rm --cache .config/zsh/.zcompdump +git add .config/galias diff --git a/.scripts/bin/misc/mkalias b/.scripts/bin/misc/mkalias @@ -1,7 +1,4 @@ #!/bin/sh -awk '{printf "alias "$1"=\"";$1="";printf $0"\"\n"}' < ~/.alias > ~/.config/bash/alias -cp ~/.config/bash/alias ~/.config/zsh/alias -cp ~/.config/bash/alias ~/.config/fish/alias - -awk '{printf "alias -g "$1"=\"";$1="";printf $0"\"\n"}' < ~/.galias >> ~/.config/zsh/alias +awk '{printf "alias "$1"=\"";$1="";printf $0"\"\n"}' < ~/.config/alias > ~/.config/zsh/alias.zsh +awk '{printf "alias -g "$1"=\"";$1="";printf $0"\"\n"}' < ~/.config/galias >> ~/.config/zsh/alias.zsh diff --git a/.scripts/bin/misc/rmpv b/.scripts/bin/misc/rmpv @@ -35,4 +35,4 @@ randomize() { allfiles files=$(for i in `seq $count`; do randomize; done) -mpv --input-ipc-server=/tmp/mpv-socket $files +[ "$(echo "$2" | grep "music")" != "" ] && mpv --input-ipc-server=/tmp/mpv-socket $files --no-video || mpv --input-ipc-server=/tmp/mpv-socket $files diff --git a/.scripts/bin/misc/trimfiles b/.scripts/bin/misc/trimfiles @@ -6,15 +6,15 @@ # haydenvh.com # Copyright (c) 2019 Hayden Hamilton. -dirs=$(ls -d */ */*/ */*/*/ */*/*/*/ */*/*/*/*/ 2>/dev/null) -for dir in $dirs +bkp=$(pwd) + +IFS=$'\n' +for d in $(find . -type d) do - cd $dir - for f in *; do mv "$f" `echo $f | tr ' ' '.'`; done - backdir=$(echo $dir | tr "/" "\n" | wc -l) - backdir=$(($backdir-1)) - for i in `seq $backdir` + cd $d + for f in $(find . -maxdepth 1 -type f) do - cd ../ + mv "$f" $(echo "$f" | tr " " ".") done + cd $bkp done diff --git a/.scripts/bin/misc/urlhand b/.scripts/bin/misc/urlhand @@ -1,39 +1,17 @@ #!/bin/bash -array=$(cat /dev/stdin | awk '/http/' | sed 's/.*http/http/g' | awk '{print $1}' | sort) +link=$(awk '/http/' < /dev/stdin | sed 's/.*http/http/g;s/\[.*\]//g' | awk '{print $1}' | sort | dmenu -i -p "Select a url:") -clear -count=0 IFS=$'\n' -printf "" > ~/.cache/urlhand1 -printf "" > ~/.cache/urlhand3 -for link in $array -do - count=$(($count+1)) - echo "$count: $link" >> ~/.cache/urlhand3 - echo "$count:$link" | sed 's|/|\t|g' >> ~/.cache/urlhand1 -done -var=$(dmenu -i -p "Select an item" < ~/.cache/urlhand3 | grep -o '[0-9]*') -[ "$var" = "" ] && exit 0 -arg=$(grep "$var:" < ~/.cache/urlhand1 | sed 's|\t|/|g' | sed 's/^[0-9]*://') -handlers=("mpv" "popupmpv" "youtube-dl --add-metadata -ic" "youtube-dl --add-metadata -xic" "vimb --no-maximize" "surf" "w3m") -count=0 -echo -printf "" > ~/.cache/urlhand2 -printf "" > ~/.cache/urlhand4 -for item in ${!handlers[*]} -do - count=$(($count+1)) - echo "$count: ${handlers[$item]}" >> ~/.cache/urlhand4 - echo "$count:${handlers[$item]}" | sed 's|/|\t|g' >> ~/.cache/urlhand2 -done +hand=$(printf "mpv +popupmpv +youtube-dl --add-metadata -ic +youtube-dl --add-metadata -xic +vimb --no-maximize" | dmenu -i -p "Select a handler:") -var=$(dmenu -i -p "Select a handler" < ~/.cache/urlhand4 | grep -o '[0-9]*') -[ "$var" = "" ] && exit 0 -hand=$(grep "$var:" < ~/.cache/urlhand2 | sed 's|\t|/|g' | sed 's/^[0-9]*://') pkill mpvlisten hmpv pause /tmp/mpv-socket hmpv pause /tmp/mpv-socket2 -bash -c "$hand $arg" +sh -c "$hand $link" mpvlisten /tmp/mpv-socket2 /tmp/mpv-socket & diff --git a/.scripts/i3blocks/bat b/.scripts/dwmblocks/bat diff --git a/.scripts/i3blocks/cal b/.scripts/dwmblocks/cal diff --git a/.scripts/i3blocks/cpu b/.scripts/dwmblocks/cpu diff --git a/.scripts/i3blocks/disk b/.scripts/dwmblocks/disk diff --git a/.scripts/i3blocks/disk2 b/.scripts/dwmblocks/disk2 diff --git a/.scripts/i3blocks/convtodwm b/.scripts/dwmblocks/dwmbar diff --git a/.scripts/i3blocks/host b/.scripts/dwmblocks/host diff --git a/.scripts/i3blocks/mem b/.scripts/dwmblocks/mem diff --git a/.scripts/i3blocks/mpv b/.scripts/dwmblocks/mpv diff --git a/.scripts/i3blocks/net b/.scripts/dwmblocks/net diff --git a/.scripts/i3blocks/news b/.scripts/dwmblocks/news diff --git a/.scripts/i3blocks/time b/.scripts/dwmblocks/time diff --git a/.scripts/i3blocks/time2 b/.scripts/dwmblocks/time2 diff --git a/.scripts/i3blocks/title b/.scripts/dwmblocks/title diff --git a/.scripts/i3blocks/vol b/.scripts/dwmblocks/vol diff --git a/.scripts/i3blocks/weather b/.scripts/dwmblocks/weather diff --git a/.scripts/i3blocks/weather2 b/.scripts/dwmblocks/weather2 diff --git a/.scripts/tools/backupdel b/.scripts/tools/backupdel @@ -0,0 +1,77 @@ +#!/bin/sh + +backups=$(find /mnt/backups/ -type f | sort) +dir="$1" + +limit(){ + limit="$1" + [ -z $number ] && echo "No limit supplied!" && exit 1 + + tailn=$(echo "$backups" | wc -l) + tailn=$(($tailn-$limit)) + + for bkp in $(echo "$backups" | tail -"$number") + do + rm $dir/$bkp || { + echo "File does not exist!"; return 1 + } + done +} + +last(){ + number="$1" + [ -z $number ] && number="1" + + for bkp in $(echo "$backups" | tail -"$number") + do + rm $dir/$bkp || { + echo "File does not exist!"; return 1 + } + done +} + +specific(){ + rm $dir/$bkp || { + echo "File does not exist!"; return 1 + } +} + +all(){ + for bkp in $(echo "$backups" | head -n -1) + do + rm $dir/$bkp || { + echo "File does not exist!"; return 1 + } + done +} + +allall(){ + rm -rf $dir/* +} + +list(){ + echo "$backups" +} + +usage(){ + echo \ +"backupdel /path/to/dir [type of deletion] [arg to deletion / specific (grepped) backup] + +limit Keep only a certain amount of backups, deleting backups from oldest to + newest, until the amount of backups is equal to the number supplied. +last Delete the last [arg supplied or 1] backup(s) +all Delete all except from the current +allall Delete ALL including current +list List all backups +* Delete the specific (grepped) backup" +} + +case arg in "$2" + *help|*usage) usage ;; + limit) limit "$3" || usage ;; + last) last "$3" || usage ;; + all) all ;; + allall) allall ;; + list) list ;; + *) specific "$2" || usage ;; +esac diff --git a/.scripts/tools/mkbackup b/.scripts/tools/mkbackup @@ -0,0 +1,16 @@ +#!/bin/sh + +tar cjvf $1/$(date --iso-8601=hours | tr -d " :+-").tar.bz \ + /bin \ + /boot \ + /etc \ + /home \ + /lib \ + /lib32 \ + /lib64 \ + /opt \ + /root \ + /sbin \ + /usr \ + /var \ + /srv \ diff --git a/.vim b/.vim @@ -1 +0,0 @@ -.config/vim -\ No newline at end of file diff --git a/.vimrc b/.vimrc @@ -1,123 +0,0 @@ -" -" .bashrc -" Created by Hayden Hamilton -" -" haydenvh.com -" Copyright (c) 2019 Hayden Hamilton. -" - -"Note: scripts are found in .vim/plugin/ or .vim/autoload/ -" goyo - centres text -" surround - allows operation on surrounding characters -" commentary - comments stuff out -" repeat - repeat things -" vimling (ipa, deadkeys, prose) - deadkeys - -"VI-M not VI -set nocompatible - -"Leader -let mapleader="," - -"Cursor -let &t_SI.="\033[6 q" "SI = INSERT mode -let &t_SR.="\033[4 q" "SR = REPLACE mode -let &t_EI.="\033[2 q" "EI = NORMAL mode (ELSE) - -"Tab completion -set path+=** -set wildmenu -set wildmode=longest,list,full -set incsearch - -"Misc -set encoding=utf-8 - -"Set scheme -syntax on -colo ron -set background=dark -set relativenumber -set number -set hlsearch -filetype plugin on - -"Keys -map <leader>g :Goyo \| set linebreak<CR> -map <leader>c :!sudo make all install clean \| set linebreak<CR> -map <leader>oc :!groff -T pdf % - > /tmp/grff \| zathura -<Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left> -map <Leader>sv :!sent % \| set linebreak<CR> -map <leader>sc :setlocal spell! spelllang=en_us \| set linebreak<CR> -map <leader>ff :r !find \| set linebreak<CR> -map <leader>fl :r !ls \| set linebreak<CR> -map <leader>bd :bdelete \| set linebreak<CR> -map <leader>bn :bn \| set linebreak<CR> -map <leader>bp :bp \| set linebreak<CR> -map <leader>mvg :r !find -maxdepth 1 -type f -printf "mv \"\%f\"\t<++>\n"<Enter> -map <leader>mvd :w! /tmp/bmv-edit \| set linebreak<CR>:!sh /tmp/bmv-edit \| set linebreak<CR>:q \| set linebreak<CR> -map <leader>ss :set syntax= -imap <leader>ss :set syntax= -map <leader>w :w \| set linebreak<CR> -map <leader>W :w !sudo tee %<CR> -map dw diw -map cw ciw -imap <leader><leader>ss <Esc>:set syntax= - -map <leader>j 0/<++><Enter>"_c4l -map <leader>J 0/<++><Enter>"_d4l -imap <leader><leader>j <Esc>0/<++><Enter>"_c4l -map <leader>C i<++><Esc> -imap <leader><leader>c <++><Enter> - -map <leader><leader>[ i[]<Esc><Left>i -map <leader><leader>( i()<Esc><Left>i -map <leader><leader>" i""<Esc><Left>i -map <leader><leader>' i''<Esc><Left>i -map <leader><leader>{ i{}<Esc><Left>i -map <leader><leader>< i<><Esc><Left>i -imap <leader><leader>[ []<Esc><Left>i -imap <leader><leader>( ()<Esc><Left>i -imap <leader><leader>" ""<Esc><Left>i -imap <leader><leader>' ''<Esc><Left>i -imap <leader><leader>{ {}<Esc><Left>i -imap <leader><leader>< <><Esc><Left>i - -"Magit -map <leader>m :Magit \| set linebreak<CR> -let g:magit_default_fold_level=0 - -"Splits -set splitbelow splitright -noremap <leader>z :vsplit \| set linebreak<CR> -noremap <leader>Z :split \| set linebreak<CR> -noremap <C-h> <C-w>h -noremap <C-j> <C-w>j -noremap <C-k> <C-w>k -noremap <C-l> <C-w>l -noremap <C-c> <C-w>c - -"Vimling -nm <leader>ld :call ToggleDeadKeys()<CR> -imap <leader>ld <esc>:call ToggleDeadKeys()<CR>a -nm <leader>li :call ToggleIPA()<CR> -imap <leader>li <esc>:call ToggleIPA()<CR>a -nm <F8> :call ToggleProse()<CR> - -"An erotic file-browser -map <leader>eh :Sex \| set linebreak<CR> -map <leader>ev :Vex \| set linebreak<CR> -map <leader>eo :browse oldfiles \| set linebreak<CR> -map <leader>eb 100j -let g:netrw_liststyle=3 -let g:netrw_banner=0 -let g:netrw_altv=1 - -"Remove arrow keys -no <Up> <Nop> -no <Down> <Nop> -no <Left> <Nop> -no <Right> <Nop> -ino <Up> <Nop> -ino <Down> <Nop> -ino <Left> <Nop> -ino <Right> <Nop> diff --git a/.xinitrc b/.xinitrc @@ -1,6 +1,6 @@ #!/bin/bash -xrdb ~/.Xresources +xrdb ~/.local/xres setxkbmap haydenh xsetroot -cursor_name sailboat diff --git a/.xprofile b/.xprofile @@ -1 +1 @@ -.profile -\ No newline at end of file +.zprofile +\ No newline at end of file diff --git a/.zprofile b/.zprofile diff --git a/general/make.sh b/general/make.sh @@ -1,78 +0,0 @@ -all(){ - imagestarbz - downloadstargz - documentstargz - musictarbz - videostargz - mailtargz - securitytargz - gamestarbz -} - -dirclean(){ - rm -rf `find -type d` -} - -imagestarbz(){ - tar cjvf images.tar.bz images -} -downloadstargz(){ - tar czvf downloads.tar.gz downloads -} -documentstargz(){ - tar czvf documents.tar.gz documents -} -musictarbz(){ - tar cjvf music.tar.bz music -} -videostarbz(){ - tar cjvf videos.tar.bz videos -} -mailtargz(){ - tar czvf mail.tar.gz mail -} -securitytargz(){ - tar czvf security.tar.gz security -} -gamestarbz(){ - tar czvf games.tar.bz games -} - -clean(){ - rm *.tar.*z -} - -extract(){ - tar xjvf images.tar.bz - tar xzvf downloads.tar.gz - tar xzvf documents.tar.gz - tar xjvf music.tar.bz - tar xjvf videos.tar.gz - tar xzvf mail.tar.gz - tar xzvf security.tar.gz - tar xjvf games.tar.gz -} - -link(){ - cd .. - ln -s general/images images - ln -s general/music music - ln -s general/videos videos - ln -s general/images/wallpapers .wallpapers - ln -s general/mail mail - ln general/security/pass work/pass - ln -s general/games/.openttd ./ -} - -unlink(){ - unlink ../images - unlink ../music - unlink ../videos - unlink ../.wallpapers - unlink ../mail -} - -for func in $(printf "$@") -do - $func -done