diff options
author | Matthew Lemon <y@yulqen.org> | 2023-09-04 10:23:32 +0100 |
---|---|---|
committer | Matthew Lemon <y@yulqen.org> | 2023-09-04 10:23:32 +0100 |
commit | e30c304663232fde473029d1cbcae50440174696 (patch) | |
tree | 93cd11af8cae406112306d5bbb008d361c49ee1a | |
parent | cfe503b2b54b1eba25c32b3b4887f51b387c21a5 (diff) |
Fixes zetrename and adds mdlinkopen script
Diffstat (limited to '')
-rwxr-xr-x | mdlinkopen | 11 | ||||
-rwxr-xr-x | zetrename (renamed from zetrename.sh) | 8 |
2 files changed, 15 insertions, 4 deletions
diff --git a/mdlinkopen b/mdlinkopen new file mode 100755 index 0000000..5764fdc --- /dev/null +++ b/mdlinkopen @@ -0,0 +1,11 @@ +#!/bin/bash +# +# from https://facedragons.com/foss/build-a-foss-second-brain-in-vim/?utm_source=twitter&utm_medium=social&utm_campaign=ReviveOldPost +# The idea is that you call this script, type in a search term and dmenu presents a list of files in Notes that contain the +# term. Hitting enter puts it on the clip board and you can paste it into a vim file to get a link. + +SEARCHTERM=$(echo "" | dmenu) + +CHOSENFILE=$(grep -rnwli /home/lemon/Documents/Notes -e "$SEARCHTERM" | sed 's/\/home\/lemon\/Documents\/Notes\///' | dmenu -l 20) +echo $CHOSENFILE | xclip -selection c +st vim /home/lemon/Documents/Notes/"$CHOSENFILE" & @@ -1,8 +1,8 @@ -#!/usr/bin/bash +#!/bin/bash # Renaming files of the format YYYYMMDDHHMMSS-title text etc.md is a massive pain, so this script does it for you. -NOTES=/home/$USER/Documents/Notes/modzet +NOTES=/home/$USER/Documents/Notes/MOD/modzet function usage { echo @@ -15,10 +15,10 @@ if [[ $# -eq 0 ]]; then usage; exit 1 fi -# path must be of form /home/$USER/Documents/Notes/modzet/20220419133511-Title of file.md +# path must be of form /home/$USER/Notes/modzet/20220419133511-Title of file.md #re='^/tmp\/Notes\/modzet\/(.{14})-(.+)\.md' -re='^/home\/lemon\/Notes\/modzet\/(.{14})-(.+)\.md' +re='^/home\/lemon\/Documents/Notes\/MOD\/modzet\/(.{14})-(.+)\.md' if [[ "$1" =~ $re ]]; then notedate=${BASH_REMATCH[1]} oldname=${BASH_REMATCH[2]} |