]> git.rmz.io Git - dotfiles.git/commitdiff
vim: add readline function to sh.snippets
authorSamir Benmendil <me@rmz.io>
Mon, 1 Feb 2016 22:31:47 +0000 (22:31 +0000)
committerSamir Benmendil <me@rmz.io>
Mon, 1 Feb 2016 22:49:49 +0000 (22:49 +0000)
vim/ultisnips/sh.snippets

index 1ea5c21221789818d8dbcbabb818fc19b7608a53..f17a0b58cd8f4710b02b40d9ab3f9cac12e2ac76 100644 (file)
@@ -12,6 +12,12 @@ snippet ar "${array[@]}" w
 \${${1:array}[${2:@}]}$0
 endsnippet
 
+snippet readline "Read a file line by line" b
+while ${1:IFS='' }read -r ${2:line} || [[ -n "$$2" ]]; do
+       ${0:echo "Text read from file: $$2"}
+done < "\$${3:file}"
+endsnippet
+
 snippet getopt
 version="${1:0.1}"