Created
October 16, 2023 17:37
-
-
Save cjbarroso/a91d40c539cd893383729e3b74eed8f1 to your computer and use it in GitHub Desktop.
nvAlt-like bash function to use along with your Obsidian vault to preview and open files quickly
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Stolen from https://demu.red/blog/2021/04/a-notational-velocity-stopgap-solution-for-linux/ | |
# REQUIRES: `urlencode` command | |
# Base filesystem dir to search from | |
BASEDIR="/home/charlie/PARA/3. Recursos/307 Zettelkasten/" | |
# Name of your vault | |
VAULTNAME="PARA" | |
# Url-encoded base dir within the vault to address it using `obsidian://` URLs | |
# You can use `urlencode` here. Don't forget the last / | |
BASEVAULT=$(urlencode "3. Recursos/307 Zettelkasten/") | |
function note() { | |
pushd "$BASEDIR" 1>/dev/null && \ | |
filename=$(urlencode $(fzf -i --cycle --reverse --preview-window=down --preview='cat {}' --print-query)) | |
xdg-open "obsidian://open?vault=${VAULTNAME}&file=${BASEVAULT}${filename}" | |
popd 1>/dev/null | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment