Enable note searching with notational velocity script

This commit is contained in:
Marty Oehme 2019-09-03 19:01:50 +02:00
parent b5e979189b
commit c5ee7b6ca2

View file

@ -55,7 +55,10 @@ Plug 'reedes/vim-textobj-sentence' " extends the capabilities of sentence detect
" " Plug 'tpope/vim-fugitive' - Will have to take a closer look some other time
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
" Fuzzy matching
Plug 'lotabout/skim.vim'
Plug 'marty-oehme/notational-fzf-vim'
Plug 'dyng/ctrlsf.vim'
" Language Integration
@ -445,9 +448,41 @@ au FileType go nnoremap <F9> :GoCoverageToggle -short<cr>
" go to the definition of whatever you hover over
au FileType go nnoremap <F12> <Plug>(go-def)
" Call leaderf with <leader-f> (necessary to enable leaderf lazyloading)
nnoremap <leader>F :LeaderfFile<cr>
nnoremap <leader>f :LeaderfBuffer<cr>
" skim.vim (fzf alternative) fuzzy finding configuration
" extra key bindings in skim window
let g:skim_action = {
\ 'ctrl-t': 'tab split',
\ 'ctrl-h': 'split',
\ 'ctrl-v': 'vsplit' }
command! -bang -nargs=* Rg call fzf#vim#rg_interactive(<q-args>, fzf#vim#with_preview('right:50%:hidden', 'alt-h'))
" FZF buffers and files in current workdir
noremap <leader>s :Buffers<cr>
" FZF most recently used / MRU, bound to S since it is essentially a larger
" go-back intention than just buffers
noremap <leader>S :History<cr>
noremap <leader>f :Files<cr>
" FZF general full-text search in cwd with rg
noremap <C-F> :Rg<cr>
" FZF note full-text search with notational-velocity like functions
noremap <leader>n :NV<cr>
noremap <leader>N :NV!<cr>
" Configure notational-fzf-vim
let g:nv_search_paths = [ '~/Nextcloud/Notes/' ]
let g:nv_wrap_preview_text=1
" Dictionary with string keys and values. Must be in the form 'ctrl-KEY':
" 'command' or 'alt-KEY' : 'command'. See examples below.
let g:nv_fzf_binds = [
\ 'alt-a:select-all',
\ 'alt-q:deselect-all',
\ 'alt-p:toggle-preview',
\ 'alt-u:page-up',
\ 'alt-d:page-down',
\ 'ctrl-w:backward-kill-word',
\ ]
function! SearchWiki()
let l:curpath=getcwd()
@ -458,24 +493,10 @@ function! SearchWiki()
:execute(":cd " . l:curpath)
endfunction
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 <leader>wF :execute(":call SearchWiki()")<cr>
" fuzzy search wiki with leaderf
nnoremap <leader>wf :execute(":call RgWiki()")<cr>
" fuzzy search current working dir
nnoremap <C-F> :execute(":Leaderf rg")<cr>
vnoremap <C-F> <Plug>CtrlSFVwordPath
" Mostly dealing with Prose writing from here on out