diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim index 3ee22fa..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 @@ -79,7 +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 'lervag/wiki.vim' Plug 'michal-h21/vim-zettel' " For async completion @@ -141,6 +142,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 +153,24 @@ autocmd FileType markdown,txt call Prose() " or invoke it manually by writing :Prose command! -nargs=0 Prose call Prose() +" PLUGIN: wiki.vim +let g:wiki_root = '~/Nextcloud/Notes/' +" 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' + +" PLUGIN: vim-zettel +" gives nice short format of YYMMDDHHMM +let g:zettel_format = "%y%m%d%H%M" +" disable the standard key mappings of the plugin +let g:zettel_default_mappings = 0 +augroup filetype_vimwiki + autocmd! + autocmd FileType markdown xmap z ZettelNewSelectedMap +augroup END + " 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 +313,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 +341,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 +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