X-Git-Url: https://git.sthu.org/?p=vimconf.git;a=blobdiff_plain;f=macros.vim;h=58599670c737d4e4f01f920551b31a873f571155;hp=73ce12864cca1fefa1aaf7c031349ed54bca252c;hb=a6f5b4dbb1b87a7a39b922a1a725a1706bff9c95;hpb=5c61509b1a17b26699b378136e93f3e9c99207ae diff --git a/macros.vim b/macros.vim index 73ce128..5859967 100644 --- a/macros.vim +++ b/macros.vim @@ -93,13 +93,15 @@ function RunPandoc() let cssopts = "-c pandoc.css" endif - execute ":!pandoc " . cssopts . " --self-contained --toc " . @% . " -o " . @% . ".html" + execute ":!pandoc " . cssopts . " --self-contained --toc '" . @% . "' -o '" . @% . "'.html" endfunction + function RunMarkdownpy(prog) execute ":!" . a:prog . " " . @% . " > " . @% . ".html" endfunction + function RunMarkdown() if executable("pandoc") call RunPandoc() @@ -113,6 +115,16 @@ function RunMarkdown() endfunction +function OnBattery() + if has('macunix') + return match(system('pmset -g batt'), "Now drawing from 'Battery Power'") != -1 + elseif has('unix') + return readfile('/sys/class/power_supply/AC/online') == ['0'] + endif + return 0 +endfunction + + if filereadable($HOME . '/.vim/macros-local.vim') source ~/.vim/macros-local.vim endif