summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xu7
1 files changed, 5 insertions, 2 deletions
diff --git a/u b/u
index f2dc5ca..c660b7b 100755
--- a/u
+++ b/u
@@ -1,8 +1,11 @@
#!/usr/bin/env bash
# usage: u [query]
ref=~/src/urbit/docs/reference
-sel=$(rg --line-number '###\s`\+\+(.+)`' $ref -r '++$1' | fzf --query="$1")
+sel=$(rg --line-number '^###\s(.+)$' $ref -r '$1' \
+ | sed "s|$ref||g" \
+ | fzf --query="$1"
+)
file=$(cut -d':' -f1 <<< $sel)
line=$(cut -d':' -f2 <<< $sel)
echo +$line $file
-vim $file +$line -c 'normal zt'
+vim $ref/$file +$line -c 'normal zt'