diff --git a/.vim/after/plugin/wiki.vim b/.vim/after/plugin/wiki.vim index 11b8352..91a63f7 100644 --- a/.vim/after/plugin/wiki.vim +++ b/.vim/after/plugin/wiki.vim @@ -1,5 +1,44 @@ -" " Change local buffer to directory of current file after the plugin has loaded +" Change local buffer to directory of current file after the plugin has loaded autocmd VimEnter * lcd %:p:h " " Override wiki index mapping to also cd into the wiki -nm ww (wiki-index) \| :lcd %:p:h +nm ww (wiki-index) +" nm l (wiki-next-link) +" nm h (wiki-prev-link) +" nm j (wiki-link-follow) +" nm k (wiki-link-return) +" nm s (wiki-link-follow-split) +" nm v (wiki-link-follow-vsplit) + +autocmd BufEnter *.md if expand('%:t') =~ '_' | echo 'hierarchical relation' | endif +autocmd BufEnter *.md if expand('%:t') =~ '--' | echo 'non-hierarchical relation' | endif +autocmd BufEnter *.md if expand('%:t') =~ '<>' | echo 'dichotomy' | endif +autocmd BufEnter *.md if expand('%:t') =~ 'my-' | echo 'personal file' | endif +autocmd BufEnter *.md if expand('%:t') =~ 'project-' | echo 'project file' | endif +autocmd BufEnter *.md if expand('%:t') =~ 'project_' | echo 'project file' | endif + +" Only load wiki.vim for zk directory +let g:wiki_global_load=0 +let g:wiki_root='~/.zk' +let g:wiki_index_name='index' +let g:wiki_zotero_root='~/doc/Zotero' +let g:wiki_filetypes=['md'] +let g:wiki_completion_case_sensitive=0 + +" Links +let g:wiki_link_extension='' +" Do not automatically transform to link, use `wf` for this +let g:wiki_link_toggle_on_follow=0 +let g:wiki_link_target_type='md' + +" E.g. transform `My link` into `[My link](my-link.md)` +function Slugify(text) abort + return [substitute(tolower(a:text), '\s\+', '-', 'g'), a:text] +endfunction + +let g:wiki_map_text_to_link='Slugify' + +vmap wf (wiki-link-toggle-visual) + +" Automatically save when navigation +let g:wiki_write_on_nav=1 diff --git a/.vimrc b/.vimrc index 7108153..6446004 100644 --- a/.vimrc +++ b/.vimrc @@ -173,42 +173,6 @@ vm f :Ag " -" }}} - -" `lervag/wiki.vim` {{{ - -" Only load wiki.vim for zk directory -let g:wiki_global_load=0 -let g:wiki_root='~/.zk' -let g:wiki_index_name='index' -let g:wiki_zotero_root='~/doc/Zotero' -let g:wiki_filetypes=['md'] -let g:wiki_completion_case_sensitive=0 - -" If we are on a wiki link - -" TODO: configure the following -" let g:wiki_file_handlenmap r - -" Links -" FIXME: figure out what '' vs '.md' does -let g:wiki_link_extension='.md' -" Do not automatically transform to link, use `wf` for this -let g:wiki_link_toggle_on_follow=0 -let g:wiki_link_target_type='md' - -let g:wiki_map_text_to_link='Slugify' - -" E.g. transform `My link` into `[My link](my-link.md)` -function Slugify(text) abort - return [substitute(tolower(a:text), '\s\+', '-', 'g'), a:text] -endfunction - -vmap wf (wiki-link-toggle-visual) - -" Automatically save when navigation -let g:wiki_write_on_nav=1 - " }}} " `tools-life/taskwiki` {{{