Skip to content
This repository has been archived by the owner on Sep 15, 2023. It is now read-only.

How to use it? #2

Closed
ofenerci opened this issue Feb 13, 2023 · 2 comments
Closed

How to use it? #2

ofenerci opened this issue Feb 13, 2023 · 2 comments

Comments

@ofenerci
Copy link

Hello,
Could you provide some commands how to use it?

@IanoNjuguna
Copy link

IanoNjuguna commented Sep 14, 2023

Hello,

Check out the demo GIF

@heittpr
Copy link
Owner

heittpr commented Sep 15, 2023

Hi! Sorry for the (very) late reply.

All of the available commands are defined here:

plug.command(:P5Preview) do |nvim|
cwd = nvim.command_output(:pwd)
if serverPid == nil
serverPid = spawn("browser-sync start --no-open --no-ui --no-notify --port #{port} -w -f --server #{cwd}")
end
if browserPid == nil
browserPid = spawn("chromium --app=http://localhost:#{port}")
end
nvim.command("echo 'server running on port #{port}'")
end
plug.command(:P5PreviewStop) do |nvim|
if serverPid != nil
kill(serverPid, browserPid)
serverPid, browserPid = nil
nvim.command("echo 'server terminated'")
else
nvim.command("echo 'the server is not running'")
end
end
plug.command(:P5ServerStatus) do |nvim|
if serverPid != nil
nvim.command("echo 'pid: #{serverPid} | port: #{port}'")
else
nvim.command("echo 'the server is not running'")
end
end
# template files
plug.command(:P5Template) do |nvim|
e = nvim.command_output(":echo expand('%:e')")
case e
when 'js'
insert_template('sketch.js', nvim)
when 'html'
insert_template('index.html', nvim)
end
end
end

I don't really plan on maintaining this project. It was meant to be more of a quick proof of concept for me to learn some Ruby. But I appreciate your interest! Feel free to fork it or continue using as is if it serves you.

@heittpr heittpr closed this as completed Sep 15, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants