From 95d79cd39a97daf3bc32b891abff366403802b2b Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Mon, 20 May 2019 18:18:48 +0200 Subject: [PATCH 1/5] add basic wiki and zettel structure --- .config/nvim/init.vim | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim index 3ee22fa..e6c5555 100644 --- a/.config/nvim/init.vim +++ b/.config/nvim/init.vim @@ -79,7 +79,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 +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,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 = '~/projects/vim-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) From 54e31a85acbc4b8a3281196dbc83741f9d4d440e Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Mon, 20 May 2019 22:21:53 +0200 Subject: [PATCH 2/5] add uppercasing in vim --- .config/nvim/init.vim | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim index e6c5555..8a79965 100644 --- a/.config/nvim/init.vim +++ b/.config/nvim/init.vim @@ -323,6 +323,10 @@ map V :vsp ~/.config/nvim/init.vim " 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 @@ -340,6 +344,7 @@ nnoremap t :vsp . nnoremap T :tabedit . " save current buffer with Ctrl-s +" TODO do I need this? I reflexively use :w nnoremap :w " open/close NERDtree with leader-e From d3cc983eff21f5db20c262613bb0990d75e177ff Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Tue, 21 May 2019 13:44:44 +0200 Subject: [PATCH 3/5] add common vim bindings * set up beggining/end of line with H/L * set surround current word/visually selected word with " * set text expansion for @@ marty.oehme@gmail.com - email * set text expansion for ccopy - copyright notice * set common typos autocorrection --- .config/nvim/init.vim | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim index 8a79965..69d69b7 100644 --- a/.config/nvim/init.vim +++ b/.config/nvim/init.vim @@ -312,13 +312,15 @@ 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 @@ -338,15 +340,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 -" TODO do I need this? I reflexively use :w -nnoremap :w - " open/close NERDtree with leader-e " whatever method tree has been opened by, leader-e closes it again nnoremap e :NERDTreeToggle From eb955beba1c5758bdbc4189064b2904e9d01d614 Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Fri, 7 Jun 2019 10:49:52 +0200 Subject: [PATCH 4/5] Change wiki root to Nextcloud notes --- .config/nvim/init.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim index 69d69b7..6866411 100644 --- a/.config/nvim/init.vim +++ b/.config/nvim/init.vim @@ -153,7 +153,7 @@ autocmd FileType markdown,txt call Prose() command! -nargs=0 Prose call Prose() " PLUGIN: wiki.vim -let g:wiki_root = '~/projects/vim-notes' +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'] From f7b304966ccbb8e96f82b182be7b1517d3c9b3ca Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Tue, 11 Jun 2019 14:55:55 +0200 Subject: [PATCH 5/5] 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