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

in #linux4 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 1.18
TRX 0.15
JST 0.138
BTC 58872.56
ETH 3912.88
BNB 684.05
SBD 7.28