#Linux Two useful Vim related functions to put in the bash_aliases file.

in #linux7 years ago (edited)

Create an html duplicate of a text file. Usage: $ vimhtml file.txt. You will obtain something like file.txt.html

vimhtml() {
   [[ -f "$1" ]] || return 1; vim +'syn on | run! syntax/2html.vim | wq | q' "$1" > /dev/null 2>&1;
   }



Create a pre-formated with the sha-bang line and the execute flag file ready to be edited as bash script. Usage $ vix myscript.sh

vix() {
   [ -e "$1" ] || echo -e '#!/bin/bash\n\n' > "$1";
   chmod +x "$1";
   vi "+normal G" +startinsert "$1"
   }

Coin Marketplace

STEEM 0.26
TRX 0.11
JST 0.033
BTC 64207.05
ETH 3065.15
USDT 1.00
SBD 3.87