Compare commits

...

2 Commits

Author SHA1 Message Date
Hektor Misplon d6d23f913b
Improve zettelkasten preview 2023-12-18 13:54:07 +01:00
Hektor Misplon 24aeb3ffe3
Extract 'utils' config 2023-12-18 13:50:23 +01:00
2 changed files with 25 additions and 16 deletions

6
.vim/plugin/utils.vim Normal file
View File

@ -0,0 +1,6 @@
function! SynGroup()
let l:s = synID(line('.'), col('.'), 1)
echo synIDattr(l:s, 'name') . ' -> ' . synIDattr(synIDtrans(l:s), 'name')
endfun
com! -nargs=0 Syn :call SynGroup()

35
.vimrc
View File

@ -62,7 +62,6 @@ nn s= <c-w>=| " Equalize splits
nn sb :Lex<cr>| " File tree
nn <leader><leader> :noh<cr> |"
nn <leader>t :term<cr>| " Open terminal
nn <leader>o :!xdg-open http://localhost:8080/%:t:r.html & <cr>
" Remaps
ino <nowait> jj <esc>| " Normal now
nn <left> <nop>| " Hard mode
@ -222,11 +221,7 @@ let g:pandoc#syntax#conceal#cchar_overrides = { "atx": " ", "li": "·" }
" }}}
" `euclio/vim-markdown-composer` {{{
let g:markdown_composer_custom_css = ['file:///home/h/.zk/pandoc.css']
let g:markdown_composer_external_renderer='pandoc -f markdown+latex_macros-yaml_metadata_block -t html5 --mathjax --bibliograph /home/h/.zk/references.bib --citeproc --lua-filter=/home/h/.wiki/lua-filters/diagram-generator/diagram-generator.lua --lua-filter=/home/h/.wiki/filters/html-links.lua --lua-filter=/home/h/.zk/filters/tikz.lua'
let g:markdown_composer_autostart = 0
" }}}
@ -366,23 +361,31 @@ au FileType javascript set mps+==:;
" JSONC (see https://github.com/neoclide/jsonc.vim/pull/9")
au BufNewFile,BufRead */.vscode/*.json setlocal filetype=jsonc
" Hacky way to pass on active note to script for automated for HTML preview
au BufEnter /home/h/.zk/*.md silent exe '!echo % > /home/h/.zk/current-zettel.txt'
au BufEnter /home/h/.zk/*.md silent exe '!cat %:r.html > /home/h/.zk/current-zettel-content.html'
let s:zk_preview_enabled = 0
let s:live_server_job = -1
au BufEnter /home/h/.zk/*.md silent exe '!echo "%" > /home/h/.zk/current-zettel.txt'
function! ToggleZKPreview()
if s:zk_preview_enabled == 1
let s:zk_preview_enabled = 0
call jobstop(s:live_server_job)
au! ZKPreview
else
let s:zk_preview_enabled = 1
let s:live_server_job = jobstart('live-server --watch=/home/h/.zk/current-zettel-content.html --open=current-zettel-content.html --port=8080')
augroup ZKPreview
au BufEnter /home/h/.zk/*.md silent exe '!cat "%:r.html" > /home/h/.zk/current-zettel-content.html'
au BufWritePost /home/h/.zk/*.md silent exe '!make && cat "%:r.html" > /home/h/.zk/current-zettel-content.html'
augroup END
endif
endfunction
command! ToggleZKPreview call ToggleZKPreview()
" }}}
nn <leader>o :ToggleZKPreview<cr> :!xdg-open http://localhost:8080/%:t:r.html & <cr>
highlight QuickScopeSecondary cterm=underline
highlight QuickScopePrimary ctermbg=253 ctermfg=232 cterm=none
highlight Pmenu ctermfg=232
function! SynGroup()
let l:s = synID(line('.'), col('.'), 1)
echo synIDattr(l:s, 'name') . ' -> ' . synIDattr(synIDtrans(l:s), 'name')
endfun
com! -nargs=0 Syn :call SynGroup()
" Taken from /usr/share/vim/vim90/defaults.vim
augroup vimStartup
au!