From 00e919f7f53f046fbd621dd92a30376020bd73ff Mon Sep 17 00:00:00 2001 From: Daniel Flanagan Date: Mon, 20 Jan 2020 14:28:45 -0600 Subject: [PATCH] Fix notes and add vim pager --- apps/git/config | 6 +++++- apps/shell/fish/config.fish | 4 ++-- bin/nf | 2 +- bin/vimpager | 6 ++++++ bin/vman | 2 +- 5 files changed, 15 insertions(+), 5 deletions(-) create mode 100755 bin/vimpager diff --git a/apps/git/config b/apps/git/config index 023cf5e..49f172b 100644 --- a/apps/git/config +++ b/apps/git/config @@ -37,6 +37,7 @@ pf = push --force-with-lease a = add -A cnv = commit --no-verify + canv = commit --no-verify c = commit [merge] @@ -51,11 +52,14 @@ [pager] 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"] insteadOf = https://github.com/postmates + [commit] gpgsign = true + [gpg] program = gpg2 diff --git a/apps/shell/fish/config.fish b/apps/shell/fish/config.fish index bf0ec94..f095bfe 100755 --- a/apps/shell/fish/config.fish +++ b/apps/shell/fish/config.fish @@ -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 our EDITOR to neovim if we've got it -set -U EDITOR vim +set -Ux EDITOR vim if has_command nvim alias vim nvim alias ovim 'command vim' - set -U EDITOR nvim + set -Ux EDITOR nvim end # load a per-device config last so anything can be overridden diff --git a/bin/nf b/bin/nf index 04fe516..6e007b5 100755 --- a/bin/nf +++ b/bin/nf @@ -1,5 +1,5 @@ #!/usr/bin/env sh -SUBDIR="${2:-}" +SUBDIR="${2:-./}" mkdir -p "$NOTES_PATH/$SUBDIR" "$EDITOR" "$NOTES_PATH/$SUBDIR/$1" diff --git a/bin/vimpager b/bin/vimpager new file mode 100755 index 0000000..f7af268 --- /dev/null +++ b/bin/vimpager @@ -0,0 +1,6 @@ +#!/usr/bin/env sh + +nvim \ + -c 'silent setlocal nobuflisted buftype=nofile bufhidden=wipe noswapfile' \ + "$@" \ + - diff --git a/bin/vman b/bin/vman index 238809e..627f01a 100755 --- a/bin/vman +++ b/bin/vman @@ -4,5 +4,5 @@ # `asmanviewer` variable, so launch vim that way when using vim as our man # page viewer -vim --cmd "let asmanviewer=1" -c "SuperMan $*" +"$EDITOR" --cmd "let asmanviewer=1" -c "SuperMan $*" [ "$?" != "0" ] && echo "No manual entry for $*" && exit 1