Hi, first off, thanks for a fantastic tool, I've used it with great joy for some 1-2 years!
Many many years ago, like 10-13 or so, I started using bashmarks which provide some very neat one-letter shell commands like g mark
, s mark
etc.
Through the years I've used different shell bookmarks tools like jump & cd-bookmark and I've always kept the original bashmark-style commands by creating similar aliases to the other bookmarking tools, as they are so convenient!
fzf-marks stared a new area of bookmarking, with the interactive menu. When searching for a bookmark I don't know the exact name of, the the fzf interactive menu is perfect! When I know the exact name, it's often easier and faster to use a direct command.
Thus I've used aliases & functions also with fzf-marks, in the style of Bashmarks. This is what I have in my shell startup file:
alias g='fzm' # Jump to mark (provided as argument)
alias s='mark' # Save current dir as mark (provided as argument)
alias e="vi $FZF_MARKS_FILE" # Edit bookmarks file.
alias l="sort $FZF_MARKS_FILE" # List all bookmarks
_fzf_marks_delete() {
local mark="$1"
if ! grep -q "^$mark : " $FZF_MARKS_FILE; then
echo "$mark is not in the bookmarks" >&2
return 2
fi
sed -i.bak -e "/^${mark} : /d" "$FZF_MARKS_FILE" && rm "$FZF_MARKS_FILE.bak"
}
alias d='_fzf_marks_delete' # Delete mark (provided as arg)
_fzf_marks_print() {
local mark="$1"
if ! grep -q "^$mark : " $FZF_MARKS_FILE; then
echo "$mark is not in the bookmarks" >&2
return 2
fi
grep "^$mark :" $FZF_MARKS_FILE | awk '{print $3}'
}
alias p='_fzf_marks_print' # Print a mark (provided as arg)
This works, but it would be neat if there was built-in support by this tool to do operations like edit, list and delete a mark!
Note: I'm not requesting that this tool should adopt the bashmark-style command names like g
, s
etc., that I can always create myself, but a requst to provide some switches or subcommands to fzfm
or mark
to do this. Maybe mark -d abookmark
could delete a bookmark named abookmark
for example.