From 6557b8dce0bac27cffdef1298b5eab1ff1e0c17a Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Wed, 12 Jun 2019 14:24:38 +0200 Subject: [PATCH] Add quick fuzzy note search to wiki Use wf from anywhere to fuzzysearch a phrase over the notes. If no initial input is given loads all files into the interactive fuzzysearch. Use wF to load a more detailed, full-screen windows (via CtrlSF) which allows direct editing of results and more. --- .config/nvim/init.vim | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim index 08f251c..a8b24a3 100644 --- a/.config/nvim/init.vim +++ b/.config/nvim/init.vim @@ -372,9 +372,23 @@ function! SearchWiki() :execute(":cd " . l:curpath) endfunction -" search in wiki with ctrlsf -nnoremap wf :execute(":call SearchWiki()") -nnoremap CtrlSFPrompt +function! RgWiki() + let l:curpath=getcwd() + :execute(":cd " . g:wiki_root) + let l:texttofind=input("Search Notes: ") + if l:texttofind ==? "" + :execute(":Leaderf rg") + else + :execute(":Leaderf rg -e " . l:texttofind ) + endif + :execute(":cd " . l:curpath) +endfunction + +" search in wiki with ctrlsf, in fullscreen window +nnoremap wF :execute(":call SearchWiki()") +" fuzzy search wiki with leaderf +nnoremap wf :execute(":call RgWiki()") +nnoremap :execute(":Leaderf rg -e *") vnoremap CtrlSFVwordPath " Mostly dealing with Prose writing from here on out