Add full-text search to notes

Adds full-text search with CtrlSF vim plugin. Activated via
<leader>wf, to spell wiki-find (mirrors <leader>ww for wiki-index).

Optimizations can certainly be done.
This commit is contained in:
Marty Oehme 2019-06-11 14:55:55 +02:00
parent eb955beba1
commit f7b304966c

View file

@ -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 <leader>E :NERDTreeFind<CR>
nnoremap <leader>f :LeaderfFile<cr>
nnoremap <leader>F :LeaderfBuffer<cr>
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 <leader>wf :execute(":call SearchWiki()")<cr>
nnoremap <C-F> <Plug>CtrlSFPrompt
vnoremap <C-F> <Plug>CtrlSFVwordPath
" Mostly dealing with Prose writing from here on out
" Format current Paragraph (esp useful in prose writing)
nnoremap <silent> <leader>q gqap