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

in #linux8 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.18
TRX 0.16
JST 0.029
BTC 62706.80
ETH 2439.89
USDT 1.00
SBD 2.66