I have never used Python before. However I am trying to create a simple plugin that will allow me to open my PHP, HTML, HTM files in a web browser
I will show you the parts I have so far and hopefully someone with more knowledge can help me complete this.
FILE = Context.sublime-menu
{ "command": "openonserver", "caption": "Open on Server" }
]
FILE = openonserver.sublime-commands
{
"caption": "Open file on Server",
"command": "openonserver"
}
]
FILE= openonserver.sublime-settings
{
"server_url": "http://localhost/",
"local_file_path": "E:\Server\htdocs\",
}
So what I have is
[list=]
*]The code to add a context menu so I can just simply right click in file and click to open it on the server
*]Code to add it as a command
*]A setting file where I can set the file path to my dev server where the files I will be opening are located and a setting to set the url to where it should open the file in the browser
[/list]
What I need the .py file to do is take the full file path and if the value for setting local_file_path exist in the path, it should replace it with the value of setting server_url
So a file path of
E:\Server\htdocs\mytest_project_\some\folder_\test.php
would get replaced with a value of
http://localhost/mytest_project_/some/folder_/test.php
I then need it to launch the web browser with this modified path
I don’t think this should be too hard but I know nothing of Python, if someone could help me I would appreciate it and I think others will find this useful as well