···11-#!/bin/bash
22-33-if ! git config --get user.email >/dev/null
44-then
55- printf "No identity set, set one using 'git identity <name>'" \
66- | cowsay -f dragon-and-cow -W 60
77- echo ""
88-99- git identity --list
1010-1111- exit 1
1212-fi
-3
git/.config/git/hooks.d/lfs/post-checkout
···11-#!/bin/sh
22-command -v git-lfs >/dev/null 2>&1 || { echo >&2 "\nThis repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting .git/hooks/post-merge.\n"; exit 2; }
33-git lfs post-checkout "$@"
-3
git/.config/git/hooks.d/lfs/post-commit
···11-#!/bin/sh
22-command -v git-lfs >/dev/null 2>&1 || { echo >&2 "\nThis repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting .git/hooks/post-merge.\n"; exit 2; }
33-git lfs post-commit "$@"
-3
git/.config/git/hooks.d/lfs/post-merge
···11-#!/bin/sh
22-command -v git-lfs >/dev/null 2>&1 || { echo >&2 "\nThis repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting .git/hooks/post-merge.\n"; exit 2; }
33-git lfs post-merge "$@"
-3
git/.config/git/hooks.d/lfs/pre-push
···11-#!/bin/sh
22-command -v git-lfs >/dev/null 2>&1 || { echo >&2 "\nThis repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting .git/hooks/post-merge.\n"; exit 2; }
33-git lfs pre-push "$@"
···11-#!/bin/sh
22-33-# An example hook script to verify what is about to be pushed. Called by "git
44-# push" after it has checked the remote status, but before anything has been
55-# pushed. If this script exits with a non-zero status nothing will be pushed.
66-#
77-# This hook is called with the following parameters:
88-#
99-# $1 -- Name of the remote to which the push is being done
1010-# $2 -- URL to which the push is being done
1111-#
1212-# If pushing without using a named remote those arguments will be equal.
1313-#
1414-# Information about the commits which are being pushed is supplied as lines to
1515-# the standard input in the form:
1616-#
1717-# <local ref> <local sha1> <remote ref> <remote sha1>
1818-#
1919-# This sample shows how to prevent push of commits where the log message starts
2020-# with "WIP" (work in progress).
2121-2222-2323-z40=0000000000000000000000000000000000000000
2424-2525-IFS=' '
2626-while read local_ref local_sha remote_ref remote_sha
2727-do
2828- if [ "$local_sha" = "$z40" ]
2929- then
3030- # Handle delete
3131- :
3232- else
3333- if [ "$remote_sha" = "$z40" ]
3434- then
3535- master_branch="$(git config --get riff.wip.master)"
3636- # New branch, examine all commits
3737- if [ -z "$master_branch" ]
3838- then
3939- range="$local_sha"
4040- else
4141- range="$local_sha...$master_branch"
4242- fi
4343- else
4444- # Update to existing branch, examine new commits
4545- range="$remote_sha..$local_sha"
4646- fi
4747-4848- # Check for WIP commit
4949- commit="$(git rev-list --count -i --grep '^WIP' "$range")"
5050- if [ "$commit" -ne "0" ]
5151- then
5252- echo "Found WIP $commit commit(s) in $local_ref, not pushing"
5353- exit 1
5454- fi
5555- fi
5656-done
5757-5858-exit 0
-88
git/.config/git/hooks/hook.sh
···11-#!/bin/bash
22-33-hooks=(post-checkout post-commit post-merge pre-commit pre-push prepare-commit-msg)
44-55-usage() {
66- echo "$0 [install|help]"
77- echo 'Version 0.1.0'
88- echo 'Copyright (c) Łukasz Niemier <opensource@niemier.pl>'
99- echo
1010- echo 'Simple git hooks management system'
1111- echo
1212- echo 'install [hook_dir]'
1313- echo ' Installs hooks for given repo.'
1414- echo
1515- echo ' [hook_dir] - directory where install hooks, defaults to .git/hooks'
1616- echo ' in current Git working directory'
1717- echo 'help'
1818- echo ' display this message'
1919- echo
2020- echo 'To use this as default set of hooks when creating new repo then:'
2121- echo
2222- echo " 1. Run '$0 ~/.githooks'"
2323- echo ' 2. Run 'git config --global core.hooksPath ~/.githooks''
2424- echo
2525-}
2626-2727-install() {
2828- source="${BASH_SOURCE[0]}"
2929- HOOK_DIR="${1:-"$(git rev-parse --show-toplevel)/.git/hooks"}"
3030-3131- echo "Install handler"
3232- echo
3333-3434- mkdir -p "$HOOK_DIR"
3535- cp -i "$source" "$HOOK_DIR/hook.sh"
3636-3737- echo "Installing hooks"
3838- echo
3939-4040- for hook in "${hooks[@]}"
4141- do
4242- echo "Installing $hook"
4343- ln -si "hook.sh" "$HOOK_DIR/$hook"
4444- done
4545-}
4646-4747-hook() {
4848- git_dir=$(git rev-parse --git-dir)
4949- script="$(basename "$0")"
5050- PLUG_DIRS=("$(command git config --global --get hooks.path)" "$git_dir/hooks/hooks.d" "$(command git config --worktree --get hooks.path)")
5151-5252- test -d "$git_dir"/rebase-merge -o -d "$git_dir"/rebase-apply && exit 0
5353-5454- input="$(mktemp)"
5555- touch "$input"
5656- trap '{ rm -f "$input"; }' EXIT
5757- cat - > "$input"
5858-5959- for dir in "${PLUG_DIRS[@]}"
6060- do
6161- if [ -d "$dir" ]
6262- then
6363- find "$dir" -maxdepth 2 -and -name "$script" -print0 2>/dev/null \
6464- | xargs -0 -n1 -I% sh -c 'input="$1"; shift; if [ -x "$1" ]; then printf "\n## $(basename "$(dirname "$1")")\n" && "$@" < "$input" && echo ok; fi' -- "$input" % "$@"
6565- retval="$?"
6666-6767- if [ ! "$retval" -eq 0 ]
6868- then
6969- return "$retval"
7070- fi
7171- fi
7272- done
7373-}
7474-7575-case "$1" in
7676- install)
7777- shift
7878- install "$@"
7979- exit
8080- ;;
8181- help|-h|--help|version|-v|-V|--version)
8282- shift
8383- usage
8484- exit
8585- ;;
8686- *)
8787- hook "$@"
8888-esac
···1313 (set vim.g.loaded_matchit true)
1414 (set vim.g.matchup_surround_enabled true))
15151616-(set vim.g.choosewin_label :QWERTYUIOP)
1616+(set vim.g.choosewin_label :QWERTASDF)
17171818(do ; Colors
1919 (cmd.colorscheme :blame)
···263263 (setup :nvim-treesitter.configs
264264 {:highlight {:enable true
265265 ; Currently disable as it do not work as expected
266266- :disable [:erlang :make]}
266266+ :disable [:erlang :make :diff]}
267267 :matchup {:enable true}
268268 :indent {:enable true}
269269 :incremental_selection {:enable true}})))
+2-2
vim/.config/nvim/plugin/pastebin.vim
···66function s:pastebin(line1, line2) abort
77 let l:filename = expand("%:p:t")
88 let l:lines = getline(a:line1, a:line2)
99- let l:url = trim(system("curl --netrc-optional -F 'f:1=@-;filename=\"".l:filename."\"' ix.io", l:lines))
99+ let l:url = trim(system("ubin", l:lines))
10101111 let @+ = l:url
12121313 echom "URL: ".l:url
1414endfunction
15151616-command! -range=% IX call <SID>pastebin(<line1>, <line2>)
1616+command! -range=% Ubin call <SID>pastebin(<line1>, <line2>)
+41
vim/.config/nvim/syntax/prr.vim
···11+" Vim syntax file
22+" Language: prr
33+" Maintainer: Daniel Xu <dxu@dxuuu.xyz>
44+" Last Change: 2022 Mar 25
55+" Credits: Bram Moolenaar <Bram@vim.org>
66+"
77+" This version is copied and edited from diff.vim
88+99+" Check whether an earlier file has defined a syntax already
1010+if exists("b:current_syntax")
1111+ finish
1212+endif
1313+1414+syn region prrFile start=/^> diff/ end=/^> diff/ms=s-1,me=s-1 transparent fold keepend contains=prrHeader,prrIndex,prrChunk
1515+1616+syn region prrChunk start=/^> @@/ start=/^\n> /rs=e-2 end=/^> @@/ms=s-1,me=s-1 end=/^> diff/ms=s-1,me=s-1 end=/^$/ transparent fold keepend contains=CONTAINED,prrTag
1717+1818+syn match prrAdded contained "^> +.*"
1919+syn match prrRemoved contained "^> -.*"
2020+2121+syn match prrHeader contained "^> diff.*"
2222+syn match prrIndex contained "^> index.*"
2323+syn match prrChunkH contained "^> @@.*"
2424+2525+syn match prrTag "^@.*" contains=prrTagName,prrResult transparent
2626+2727+syn match prrTagName contained "@prr" nextgroup=prrResult
2828+syn keyword prrResult contained approve reject comment
2929+3030+" Define the default highlighting.
3131+" Only used when an item doesn't have highlighting yet
3232+hi def link prrAdded Identifier
3333+hi def link prrRemoved Special
3434+3535+hi def link prrTagName Keyword
3636+hi def link prrResult String
3737+hi def link prrHeader Include
3838+hi def link prrIndex Comment
3939+hi def link prrChunkH Function
4040+4141+let b:current_syntax = "prr"