Browse Source

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

Alois Mahdal 6 years ago
parent
commit
6995b11461
1 changed files with 6 additions and 2 deletions
  1. 6
    2
      dotfiles/bash/main.bashrc

+ 6
- 2
dotfiles/bash/main.bashrc View File

241
     #
241
     #
242
     # Open Markdown file in Vimb (no junk)
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
 nlfor() {
252
 nlfor() {