From 2eec23a2c6b936d433ed396e3447f270290a7cb7 Mon Sep 17 00:00:00 2001 From: Yaroslav Date: Mon, 15 Jun 2020 00:28:32 +0300 Subject: script to start file from template --- dotfiles/.local/bin/ftv | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100755 dotfiles/.local/bin/ftv (limited to 'dotfiles/.local/bin') diff --git a/dotfiles/.local/bin/ftv b/dotfiles/.local/bin/ftv new file mode 100755 index 0000000..4b79083 --- /dev/null +++ b/dotfiles/.local/bin/ftv @@ -0,0 +1,21 @@ +#!/bin/sh + +# Script to start a new textfile from template + +templdir=$HOME"/docs/templates/" + +if [ -z "$2" ]; then + echo "Specify template filename and new filename" + exit 0 +fi + +template="$templdir$1" +file=$(readlink -f "$2") + +if [ ! -f "$template" ]; then + echo "Template $1 does not exist" + exit 0 +fi + +cp $template $file +nvim $file -- cgit v1.2.3