Merge branch 'set-up-zettel-vim' into 'master'
Set up Vim for Note-Taking See merge request marty-oehme/dotfiles!9
This commit is contained in:
commit
d398b60ca7
2 changed files with 69 additions and 8 deletions
|
@ -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 = {
|
||||
\ '<plug>(wiki-index)' : '<leader>ww',
|
||||
\ '<plug>(wiki-reload)' : '<leader>wx',
|
||||
\ '<plug>(wiki-page-rename)' : '<leader>wr',
|
||||
\ '<plug>(wiki-link-open)' : '<cr>',
|
||||
\ '<plug>(wiki-link-open-split)' : '<c-cr>',
|
||||
\ '<plug>(wiki-link-return)' : '<bs>',
|
||||
\ '<plug>(wiki-link-next)' : '<tab>',
|
||||
\ '<plug>(wiki-link-prev)' : '<s-tab>',
|
||||
\ '<plug>(wiki-graph-find-backlinks)' : '<leader>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 <tab> %
|
|||
nnoremap <tab> %
|
||||
|
||||
" select the whole buffer with <leader>-a
|
||||
map <leader>a ggVG
|
||||
nnoremap <leader>a ggVG
|
||||
|
||||
" quickly edit vimrc with leader+V
|
||||
map <leader>V :vsp ~/.config/nvim/init.vim<cr>
|
||||
nnoremap <leader>V :vsp $MYVIMRC<cr>
|
||||
" 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 <leader>VV :source $MYVIMRC<cr>
|
||||
|
||||
" since u undoes, would it not make sense that U redoes?
|
||||
nnoremap U <C-r>
|
||||
|
||||
" when in insertion mode, C-u uppercases the current word, C-l lowercases it,
|
||||
inoremap <C-u> <esc>gUiw`]a
|
||||
inoremap <C-l> <esc>guiw`]a
|
||||
|
||||
" get rid of the help message popping up when I miss esc and hit F1
|
||||
nnoremap <F1> <ESC>
|
||||
inoremap <F1> <ESC>
|
||||
|
@ -315,14 +346,11 @@ nnoremap <leader>W :%s/\s\+$//<cr>:let @/=''<CR>
|
|||
" 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 <leader>t :vsp .<cr>
|
||||
nnoremap <leader>T :tabedit .<cr>
|
||||
|
||||
" save current buffer with Ctrl-s
|
||||
nnoremap <C-s> :w<cr>
|
||||
|
||||
" open/close NERDtree with leader-e
|
||||
" whatever method tree has been opened by, leader-e closes it again
|
||||
nnoremap <leader>e :NERDTreeToggle<CR>
|
||||
|
@ -335,6 +363,34 @@ nnoremap <leader>E :NERDTreeFind<CR>
|
|||
nnoremap <leader>f :LeaderfFile<cr>
|
||||
nnoremap <leader>F :LeaderfBuffer<cr>
|
||||
|
||||
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 <leader>wF :execute(":call SearchWiki()")<cr>
|
||||
" fuzzy search wiki with leaderf
|
||||
nnoremap <leader>wf :execute(":call RgWiki()")<cr>
|
||||
nnoremap <C-F> :execute(":Leaderf rg -e *")<cr>
|
||||
vnoremap <C-F> <Plug>CtrlSFVwordPath
|
||||
|
||||
" Mostly dealing with Prose writing from here on out
|
||||
" Format current Paragraph (esp useful in prose writing)
|
||||
nnoremap <silent> <leader>q gqap
|
||||
|
|
5
.config/shell/rc.d/set-wiki-root.sh
Normal file
5
.config/shell/rc.d/set-wiki-root.sh
Normal file
|
@ -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/'
|
Loading…
Reference in a new issue