Last active
July 7, 2020 15:53
-
-
Save eduardoarandah/235d88d2a062653187b218aff3c91538 to your computer and use it in GitHub Desktop.
jslive optionalfilename.js Javascript Live Editing environment with tmux and vim. Opens tmux with vim in the left, nodemon in the right
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# jslive [yourfile.js] | |
# Test your javascript in a live reload environment | |
# Opens tmux with vim in the left, nodemon in the right | |
# Requires tmux and nodemon npm install -g nodemon | |
function jslive () { | |
# $# is args number | |
if [ $# -eq 0 ] && file=tmp.js || file=$1 | |
# Create file | |
touch $file | |
# split with tmux, left is vim, right is node | |
tmux new-session -s jslive \; \ | |
send-keys "nvim $file" ENTER \; \ | |
split-window -h \; \ | |
send-keys "nodemon $file" ENTER \; \ | |
select-pane -L \; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment