Add gitattributes and glitter to shell

This commit is contained in:
Gwen Lofman 2019-04-14 12:46:20 -04:00
parent d705629e9c
commit a2c8161d6d
7 changed files with 81 additions and 14 deletions

View File

@ -11,7 +11,7 @@ esac
DIR="$(dirname $(readlink ~/.bashrc))"
# load all dotfiles in dotfiles repository
for DOTFILE in `find $DIR/system/.{prompt,alias,functions,path,env}.sh`
for DOTFILE in `find $DIR/system/.{prompt,alias,functions,path,env,shell}.sh`
do
[ -f "$DOTFILE" ] && source "$DOTFILE"
done

View File

@ -0,0 +1 @@
*.ipynb filter=nbstrip_full

View File

@ -6,10 +6,22 @@
[core]
editor = vi
excludesfile = ~/.gitignore_global
attributesfile = ~/.gitattributes_global
[filter "lfs"]
clean = git-lfs clean -- %f
smudge = git-lfs smudge -- %f
required = true
[filter "nbstrip_full"]
clean = "jq --indent 1 \
'(.cells[] | select(has(\"outputs\")) | .outputs) = [] \
| (.cells[] | select(has(\"execution_count\")) | .execution_count) = null \
| .metadata = {\"language_info\": {\"name\": \"python\", \"pygments_lexer\": \"ipython3\"}} \
| .cells[].metadata = {} \
'"
smudge = cat
required = true
[alias]
# "Custom" commands
# diff against characters instead of lines

View File

@ -13,9 +13,10 @@ DIR=$(pwd -L)
echo -e "\n${GREEN}linking config files...${NC}\n"
ln -sv "$DIR/.bashrc" ~
ln -sv "$DIR/profiles/.bash_profile" ~
ln -sv "$DIR/profiles/.inputrc" ~
ln -sv "$DIR/profiles/.vimrc" ~
ln -sv "$DIR/git/.gitconfig" ~
ln -sv "$DIR/git/.gitignore_global" ~
ln -sbv "$DIR/.bashrc" ~
ln -sbv "$DIR/profiles/.bash_profile" ~
ln -sbv "$DIR/profiles/.inputrc" ~
ln -sbv "$DIR/profiles/.vimrc" ~
ln -sbv "$DIR/git/.gitconfig" ~
ln -sbv "$DIR/git/.gitignore_global" ~
ln -sbv "$DIR/git/.gitattributes_global" ~

View File

@ -3,8 +3,8 @@ export PATH="/usr/local/heroku/bin:$PATH"
### Stack executibles
export PATH="/usr/local/bin/:$PATH"
export PATH="/home/gwen/.local/bin:$PATH"
export PATH="/home/gwen/.stack/programs/x86_64-linux/ghc-8.2.2/bin:$PATH"
export PATH="$HOME/.local/bin:$PATH"
export PATH="$HOME/.stack/programs/x86_64-linux/ghc-8.2.2/bin:$PATH"
### Rust/Cargo executables
export PATH="$HOME/.cargo/bin:$PATH"

View File

@ -12,11 +12,6 @@ __set_prompt() {
# If the last command didn't exit 0, display the exit code
[ "$EXIT" -ne "0" ] && PS1+="$EXIT "
# identify debian chroot, if one exists
if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
PS1+="${debian_chroot:+($(cat /etc/debian_chroot))}"
fi
PS1+="$(glit "$FMT" -e "$ELSE_FMT")"
}
export PROMPT_COMMAND=__set_prompt

58
system/.shell.sh Normal file
View File

@ -0,0 +1,58 @@
#/usr/bin/env bash
# Load completion function
complete -F _alacritty alacritty
# Completion function
_alacritty()
{
local cur prev prevprev opts
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
prevprev="${COMP_WORDS[COMP_CWORD-2]}"
opts="-h --help -V --version --live-config-reload --no-live-config-reload --print-events -q -qq -v -vv -vvv --ref-test -e --command --config-file -d --dimensions -t --title --working-directory"
# If `--command` or `-e` is used, stop completing
for i in "${!COMP_WORDS[@]}"; do
echo "${COMP_WORDS[i]}" >> ./testfile
if [[ "${COMP_WORDS[i]}" == "--command" ]] \
|| [[ "${COMP_WORDS[i]}" == "-e" ]] \
&& [[ "${#COMP_WORDS[@]}" -gt "$(($i + 2))" ]]
then
return 0
fi
done
# Make sure the Y dimension isn't completed
if [[ "${prevprev}" == "--dimensions" ]] || [[ "${prevprev}" == "-d" ]]; then
return 0
fi
# Match the previous word
case "${prev}" in
--command | -e)
# Complete all commands in $PATH
COMPREPLY=( $(compgen -c -- "${cur}") )
return 0;;
--config-file)
# Path based completion
local IFS=$'\n'
compopt -o filenames
COMPREPLY=( $(compgen -f -- "${cur}") )
return 0;;
--dimensions | -d | --title | -t)
# Don't complete here
return 0;;
--working-directory)
# Directory completion
local IFS=$'\n'
compopt -o filenames
COMPREPLY=( $(compgen -d -- "${cur}") )
return 0;;
esac
# Show all flags if there was no previous word
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
}