adampresley / sublime-view-in-browser

Open the contents of your current view/tab in a web browser

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unmodified file will also be saved

huaz836 opened this issue · comments

commented

So, the file's "Date Modified" will change. This is usually not the desired results.
Sublime Text 2.0.2,windows 8

Can you describe exactly what you are seeing and the steps you take to get there please?

commented

thx. I just viewing the code,and won't change it.
before "View in Browser"
before
View in Browser
view
I didn't modified the code in sublime,nor ctrl-s
sublime shows the file was saved
view2
after
after

Ah, ok. Yes, currently the file is saved so that it can be opened in a browser, as the browser must have some file to point to. It would be possible to save to a temporary file and view that instead, but that would have negative side-effects to the ability to view files on a local server environment (https://github.com/adampresley/sublime-view-in-browser/wiki/Viewing-on-a-Local-Server). So I'm not sure that is the correct course of action.

commented

Well, I don't know how to make sublime plugin. I think if it can just read the file path, and view in broswer. Regardless of whether the file was saved. Actually a coder always ctrl-s. I don't know if it will affect on local server.

"Regardless of whether the file was saved" There is no way to load a file that isn't saved yet. At that point, unsaved, it will be in Sublime's buffer memory. Is your concern that the date/time stamp on the file's modified attribute is changed? If so why?

If you are simply trying to make changes to a file, not save them, and view it in the browser, you won't be able to do that with your existing file. You can, however, copy the file's contents to a new tab (buffer) and run View In Browser. That will save the contents to a temporary file and open in the browser.

Good
Em 14/05/2014 07:39, "Mr.Huaz" notifications@github.com escreveu:

Well, I don't know how to make sublime plugin. I think if it can just read the file path, and view in broswer. Regardless of whether the file was saved. Actually a coder always ctrl-s. I don't know if it will affect on local server.


Reply to this email directly or view it on GitHub.

commented

Yeah, sometimes I sort files by the date/time stamp, so that I can find the latest modified file. (Actually I have worried about the date/time stamp changed will affect the svn or git, but it doesn't.) And, I feel weird if the date/time stamp changed while I didn't do any modify. Am I a little bit OCD? 😔

Sorry for confused you, maybe I can't make myself understood. The auto-save is good and reasonable, but not for unmodified file, although it just change it's date/time stamp. It will be better to not deal with them.

p.s. I'm in China, maybe the other side of the earth. You may be sleeping now. The github is amazing, and I'm a newbie here. Anyway, nice to meet you 😃 .

I have pushed an update that will only save the file if it is marked as "dirty", meaning if it has modifications.