Fix notes and add vim pager

This commit is contained in:
Daniel Flanagan 2020-01-20 14:28:45 -06:00
parent 5100983350
commit 00e919f7f5
Signed by: lytedev
GPG key ID: 5B2020A0F9921EF4
5 changed files with 15 additions and 5 deletions

View file

@ -37,6 +37,7 @@
pf = push --force-with-lease pf = push --force-with-lease
a = add -A a = add -A
cnv = commit --no-verify cnv = commit --no-verify
canv = commit --no-verify
c = commit c = commit
[merge] [merge]
@ -51,11 +52,14 @@
[pager] [pager]
branch = false branch = false
diff = nvim -c 'silent %sm/\\e.\\{-}m//g' -c 'silent %s/^diff/\\r\\rdiff/' -c 'silent set ft=diff' -c 'silent setlocal nobuflisted buftype=nofile bufhidden=wipe noswapfile' -c 'goto 1' - # remove ansi codes, pad each file's diff with newlines, show as diff, remove top padding
diff = vimpager -c 'silent %sm/\\e[^mK]*[mK]//g' -c 'silent %s/^diff/\\r\\rdiff/' -c 'silent set ft=diff' -c 'silent execute \"normal gg2dd\"'
[url "git@github.com:postmates"] [url "git@github.com:postmates"]
insteadOf = https://github.com/postmates insteadOf = https://github.com/postmates
[commit] [commit]
gpgsign = true gpgsign = true
[gpg] [gpg]
program = gpg2 program = gpg2

View file

@ -22,11 +22,11 @@ set -U BROWSER firefox-developer-edition
set -U ERL_AFLAGS "-kernel shell_history enabled -kernel shell_history_file_bytes 1024000" # iex history set -U ERL_AFLAGS "-kernel shell_history enabled -kernel shell_history_file_bytes 1024000" # iex history
# set our EDITOR to neovim if we've got it # set our EDITOR to neovim if we've got it
set -U EDITOR vim set -Ux EDITOR vim
if has_command nvim if has_command nvim
alias vim nvim alias vim nvim
alias ovim 'command vim' alias ovim 'command vim'
set -U EDITOR nvim set -Ux EDITOR nvim
end end
# load a per-device config last so anything can be overridden # load a per-device config last so anything can be overridden

2
bin/nf
View file

@ -1,5 +1,5 @@
#!/usr/bin/env sh #!/usr/bin/env sh
SUBDIR="${2:-}" SUBDIR="${2:-./}"
mkdir -p "$NOTES_PATH/$SUBDIR" mkdir -p "$NOTES_PATH/$SUBDIR"
"$EDITOR" "$NOTES_PATH/$SUBDIR/$1" "$EDITOR" "$NOTES_PATH/$SUBDIR/$1"

6
bin/vimpager Executable file
View file

@ -0,0 +1,6 @@
#!/usr/bin/env sh
nvim \
-c 'silent setlocal nobuflisted buftype=nofile bufhidden=wipe noswapfile' \
"$@" \
-

View file

@ -4,5 +4,5 @@
# `asmanviewer` variable, so launch vim that way when using vim as our man # `asmanviewer` variable, so launch vim that way when using vim as our man
# page viewer # page viewer
vim --cmd "let asmanviewer=1" -c "SuperMan $*" "$EDITOR" --cmd "let asmanviewer=1" -c "SuperMan $*"
[ "$?" != "0" ] && echo "No manual entry for $*" && exit 1 [ "$?" != "0" ] && echo "No manual entry for $*" && exit 1