diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim index 3ee22fa..a8b24a3 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 @@ -79,8 +80,7 @@ Plug 'junegunn/limelight.vim', { 'for': ['markdown', 'txt'], 'on': 'Goyo' } " pr Plug 'rhysd/vim-grammarous', { 'for': ['markdown', 'txt'], 'on': 'Goyo' } " integrate vim with languagetool for grammar checking (needs java8) " Note-Taking Workflow -Plug 'fcpg/vim-waikiki' -Plug 'michal-h21/vim-zettel' +Plug 'lervag/wiki.vim' " For async completion Plug 'Shougo/deoplete.nvim', { 'on': [] } " automatic suggestions, can also perhaps be changed for newer plugs @@ -141,6 +141,7 @@ function! Prose() " PLUGIN: vim-textobj-sentence " enable extended sentence textobject use on md and plaintext files call textobj#sentence#init() + " hide the markdown cruft set conceallevel=3 endfunction " enable syntax highlighting for codeblocks WITHIN markdown @@ -151,6 +152,30 @@ autocmd FileType markdown,txt call Prose() " or invoke it manually by writing :Prose command! -nargs=0 Prose call Prose() +" PLUGIN: wiki.vim +if $WIKIROOT ==? "" + let g:wiki_root = '~/Nextcloud/Notes/' +else + let g:wiki_root = $WIKIROOT +endif +" filetypes to automatically enable the plugin for, seems to take file endings +" rather than vim ft +let g:wiki_filetypes = ['md', 'mkd', 'markdown', 'wiki'] +let g:wiki_link_extension = '.md' +let g:wiki_link_target_type = 'md' +let g:wiki_mappings_use_defaults = 0 +let g:wiki_mappings_global = { + \ '(wiki-index)' : 'ww', + \ '(wiki-reload)' : 'wx', + \ '(wiki-page-rename)' : 'wr', + \ '(wiki-link-open)' : '', + \ '(wiki-link-open-split)' : '', + \ '(wiki-link-return)' : '', + \ '(wiki-link-next)' : '', + \ '(wiki-link-prev)' : '', + \ '(wiki-graph-find-backlinks)' : 'wb', + \} + " PLUGIN: vim-pencil " set default wrap mode to hard - TODO test which mode works better for " me, it seems hardmode has trouble with markdown lists (see issue #31) @@ -293,17 +318,23 @@ nnoremap % nnoremap % " select the whole buffer with -a -map a ggVG +nnoremap a ggVG " quickly edit vimrc with leader+V -map V :vsp ~/.config/nvim/init.vim +nnoremap V :vsp $MYVIMRC " automatically source the vimrc file whenever it is saved (causes slowdown " when done in MANY successions) " au BufWritePost init.vim so ~/.config/nvim/init.vim +" source vimrc with keystroke combination +nnoremap VV :source $MYVIMRC " since u undoes, would it not make sense that U redoes? nnoremap U +" when in insertion mode, C-u uppercases the current word, C-l lowercases it, +inoremap gUiw`]a +inoremap guiw`]a + " get rid of the help message popping up when I miss esc and hit F1 nnoremap inoremap @@ -315,14 +346,11 @@ nnoremap W :%s/\s\+$//:let @/='' " automatically on saving " autocmd BufWritePre * :%s/\s\+$//e -" 'open new tab' with leader-t (opens new buffer and switches to it) +" 'open new buffer' with leader-t (opens new buffer and switches to it) " open actual new tab with leader-T nnoremap t :vsp . nnoremap T :tabedit . -" save current buffer with Ctrl-s -nnoremap :w - " open/close NERDtree with leader-e " whatever method tree has been opened by, leader-e closes it again nnoremap e :NERDTreeToggle @@ -335,6 +363,34 @@ 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 + +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 " Format current Paragraph (esp useful in prose writing) nnoremap q gqap diff --git a/.config/shell/rc.d/set-wiki-root.sh b/.config/shell/rc.d/set-wiki-root.sh new file mode 100644 index 0000000..3e9d535 --- /dev/null +++ b/.config/shell/rc.d/set-wiki-root.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +# set wiki root to nextcloud notes folder, +# will be picked up by vim wiki plugin as root +export WIKIROOT='~/Nextcloud/Notes/'