Skip to content

Instantly share code, notes, and snippets.

@eduardoarandah
Last active July 7, 2020 15:53
Show Gist options
  • Save eduardoarandah/235d88d2a062653187b218aff3c91538 to your computer and use it in GitHub Desktop.
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
# 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