Explorar el Código

Improve mdvimb() to accept no args or `-` for stdin

Alois Mahdal hace 6 años
padre
commit
6995b11461
Se han modificado 1 ficheros con 6 adiciones y 2 borrados
  1. 6
    2
      dotfiles/bash/main.bashrc

+ 6
- 2
dotfiles/bash/main.bashrc Ver fichero

@@ -241,8 +241,12 @@ mdvimb() {
241 241
     #
242 242
     # Open Markdown file in Vimb (no junk)
243 243
     #
244
-    local file=$1
245
-    <"$file" Markdown | vimb -
244
+    local file=$1; shift
245
+    case $file in
246
+        "") Markdown | vimb - "$@" ;;
247
+        -)  Markdown | vimb - "$@" ;;
248
+        *)  Markdown < "$file" | vimb - "$@"
249
+    esac
246 250
 }
247 251
 
248 252
 nlfor() {