1
0
mirror of https://github.com/gryf/.vim.git synced 2025-12-17 11:30:29 +01:00

Add commands for wrapper function on vw2html

This commit is contained in:
2025-02-13 09:24:42 +01:00
parent 34d7979d62
commit a55590f07c

31
vimrc
View File

@@ -343,10 +343,11 @@ function s:SetRestSettings() "{{{2
endfunction endfunction
"}}} "}}}
function s:SetVimwikiSettings() "{{{2 function s:SetVimwikiSettings() "{{{2
let b:ale_enabled=0
setlocal spell setlocal spell
map <F5> :Vimwiki2HTML<CR> setlocal makeprg=vw2html\ \"%\"
map <S-F5> :Vimwiki2HTMLBrowse<CR> map <S-F5> :Vimwiki2HTMLBrowse<CR>
map <C-F5> :VimwikiAll2HTML<CR> map <C-F5> :PyVimwikiAll2Html<CR>
endfunction endfunction
"}}} "}}}
function s:SetGitcommitSettings() "{{{2 function s:SetGitcommitSettings() "{{{2
@@ -355,8 +356,8 @@ function s:SetGitcommitSettings() "{{{2
endfunction endfunction
"}}} "}}}
autocmd BufRead *.mako set filetype=mako autocmd BufRead,BufNewFile *.mako set filetype=mako
autocmd BufRead *.ass, *asm set filetype=kickass autocmd BufRead,BufNewFile *.ass, *asm set filetype=kickass
" make the current line highlighted only on current window " make the current line highlighted only on current window
autocmd WinEnter * setlocal cursorline autocmd WinEnter * setlocal cursorline
@@ -527,6 +528,7 @@ let g:vimwiki_list = [{'path': '~/vimwiki/',
\ 'template_default': 'default', \ 'template_default': 'default',
\ 'template_ext': '.tpl', \ 'template_ext': '.tpl',
\ 'css_name': 'vimwiki_style.css'}] \ 'css_name': 'vimwiki_style.css'}]
let g:vimwiki_valid_html_tags = 'b,i,s,u,sub,sup,kbd,br,hr,span'
"redefine tab key for vimwiki "redefine tab key for vimwiki
map <Leader>wn <Plug>VimwikiNextWord map <Leader>wn <Plug>VimwikiNextWord
map <Leader>wp <Plug>VimwikiPrevWord map <Leader>wp <Plug>VimwikiPrevWord
@@ -748,6 +750,27 @@ function s:CycleDiffAlgorithm()
echom 'Set diff algorithm to: ' . split(l:nextalgo, ':')[1] echom 'Set diff algorithm to: ' . split(l:nextalgo, ':')[1]
endfunction endfunction
" Convert wiki files to HTML
command -bang -nargs=? PyVimwikiAll2Html call ConvertVimwikiToHtml(<bang>0, 0)
command -bang -nargs=? PyVimwikiHtml call ConvertVimwikiToHtml(<bang>0, 1)
function ConvertVimwikiToHtml(forced, currentfile)
if &ft != 'vimwiki'
" not vimwiki file, do nothing
return
endif
let l:command = 'vw2html'
if a:forced == 1
let l:command = l:command . ' -f'
endif
if a:currentfile == 1
let l:command = l:command . ' ' . bufname("%")
endif
call system(l:command)
echom "Conversion to HTML done with command: " . l:command
endfunction
"write files as a root using sudo "write files as a root using sudo
command W w !sudo tee "%" > /dev/null command W w !sudo tee "%" > /dev/null
"}}} "}}}