💾 Archived View for sdf.org › frrobert › log › 2019-07-16-vimwikioncommandline2.gmi captured on 2022-06-11 at 21:06:26. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2022-01-08)

-=-=-=-=-=-=-

---

Title: VimWiki outside of Vim Revisted

Published: 2019-07-16 15:23

Author: Fr. Robert

Tag:

Template: Blog

---

Since me last post about VimWiki on the command line I have created a new script. I have also decided to run it as a function rather than an alias.

The new function is as follows

#!/bin/sh
function notesfind(){
wordfind=$1
/bin/grep -rwi "$wordfind" /home/frrobert/Nextcloud/vimwiki | fzf |cut -f1 -d":" | xargs cat
}

The function searchs within VimWiki documents to find a word match based on the word given. They syntax is notesfind followed by the word you are searching for. The results from grep are sent to fzf where a menu is presented with all the files that include the word along with the line of the file where the word is found. Once you select the file you are interested in, the file is displayed on the command line.

To the use the script simply copy the text of the script to an empty file and change the path to the location of your VimWiki files.. The way it is written is it can be used as a shell function or a shell script.

Remember this is not designed to replace the search VimWiki but a way to access a VimWiki document without having to switch to Vim when you are doing other work on the command line.

Bibliography

VimWiki

https://github.com/vimwiki/vimwiki

cheat.sh

https://github.com/chubin/cheat.sh

fzf

https://github.com/junegunn/fzf

Luke Smith's fzf Video

https://www.youtube.com/watch?v=vt33Hp-4RXg

..