#!/bin/sh if [ "$#" -eq 0 ]; then # shellcheck disable=2046 set -- "$( rg '#' "$ZK_NOTEBOOK_DIR" --type=markdown --with-filename --max-count=1 --no-line-number | sed 's/# //' | fzf-tmux "$FZF_TMUX_OPTS" -- --tac --print-query -d: --with-nth -1 \ --preview-window='right,80,<80(up,75%,border-bottom)' \ --preview="bat --color=always --style=plain -l=md -- {1}" | tail -1 | cut -d: -f1 )" fi if [ -z "$1" ]; then exit 1 elif [ -f "$1" ]; then $EDITOR -c "cd $ZK_NOTEBOOK_DIR" "$1" else zk new --title="$1" fi