From f7b304966ccbb8e96f82b182be7b1517d3c9b3ca Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Tue, 11 Jun 2019 14:55:55 +0200 Subject: [PATCH] Add full-text search to notes Adds full-text search with CtrlSF vim plugin. Activated via wf, to spell wiki-find (mirrors ww for wiki-index). Optimizations can certainly be done. --- .config/nvim/init.vim | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim index 6866411..d178ee3 100644 --- a/.config/nvim/init.vim +++ b/.config/nvim/init.vim @@ -56,6 +56,7 @@ Plug 'reedes/vim-textobj-sentence' " extends the capabilities of sentence detect Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' } " show a directory listing within vim Plug 'Xuyuanp/nerdtree-git-plugin', { 'on': 'NERDTreeToggle' } " show git status in nerdtree for files and dirs Plug 'Yggdroot/LeaderF', { 'on': ['Leaderf', 'LeaderfFile', 'LeaderfBuffer'], 'do': './install.sh' } " fuzzy matcher, apparently faster than fzf, ctrlp, unit, denite +Plug 'dyng/ctrlsf.vim' " Language Integration Plug 'sheerun/vim-polyglot' " syntax plugins for almost every language @@ -357,6 +358,20 @@ nnoremap E :NERDTreeFind nnoremap f :LeaderfFile nnoremap F :LeaderfBuffer +function! SearchWiki() + let l:curpath=getcwd() + :execute(":cd " . g:wiki_root) + let l:texttofind=input("Search in Notes: ") + :execute(":CtrlSF " . l:texttofind) + :CtrlSFFocus + :execute(":cd " . l:curpath) +endfunction + +" search in wiki with ctrlsf +nnoremap wf :execute(":call SearchWiki()") +nnoremap CtrlSFPrompt +vnoremap CtrlSFVwordPath + " Mostly dealing with Prose writing from here on out " Format current Paragraph (esp useful in prose writing) nnoremap q gqap