Add support for gdb-dashboard
[vimconf.git] / macros.vim
index cba6b844c37b1578f3d811bac9626e10b69e0e0a..b33bf4da65992365e37c3886d23716cc993d43ce 100644 (file)
@@ -10,6 +10,11 @@ function TexTransUmlaute()
   execute ':%s/²/\^2/&'
 endfunction
 
+function! s:texTableBfEntries()
+    execute 's/\( *\)\([^ &][^&]*[^ &]\)\( \+\)/\1\\textbf{\2}\3/g'
+endfunction
+
+command! -range TexTableBfEntries call s:texTableBfEntries()
 
 "Open current file with a specific program
 function OpenIn(prog)
@@ -96,10 +101,17 @@ function RunPandoc()
   execute ":!pandoc " . cssopts . " --self-contained --toc '" . @% . "' -o '" . @% . "'.html"
 endfunction
 
+
 function RunMarkdownpy(prog)
   execute ":!" . a:prog . " " . @% . " > " . @% . ".html"
 endfunction
 
+
+function RunAsciidoctor()
+  execute ":!asciidoctor " . @%
+endfunction
+
+
 function RunMarkdown()
   if executable("pandoc")
     call RunPandoc()
@@ -113,6 +125,27 @@ function RunMarkdown()
 endfunction
 
 
+function RunAsciidoc()
+  if executable("asciidoctor")
+    call RunAsciidoctor()
+  else
+    echo "No asciidoc implementation found."
+  endif
+endfunction
+
+
+function OnBattery()
+  if has('macunix')
+    return match(system('pmset -g batt'), "Now drawing from 'Battery Power'") != -1
+  elseif has('unix')
+    if filereadable('/sys/class/power_supply/AC/online')
+      return readfile('/sys/class/power_supply/AC/online') == ['0']
+    endif
+  endif
+  return 0
+endfunction
+
+
 if filereadable($HOME . '/.vim/macros-local.vim')
   source ~/.vim/macros-local.vim
 endif