Yes really. I had never heard of userecho until you posted that link, and, correct me if Iâm wrong, but userecho is not the official forums. Also, did you bother to read the posts on that topic? A vocal group of people complaining about printing, some people posting and saying itâs not a big deal, some others giving work arounds, and the critics dismissing the work arounds. Pretty much exactly what I said.
Yes really. I had never heard of userecho until you posted that link, and, correct me if Iâm wrong, but userecho is not the official forums. Also, did you bother to read the posts on that topic? A vocal group of people complaining about printing, some people posting and saying itâs not a big deal, some others giving work arounds, and the critics dismissing the work arounds. Pretty much exactly what I said.[/quote]
Your incredibly lame retorics doesnât change the fact that 1065 upvotes exists. Well, 1064 now that you voted it down.
OK, youâve just outed yourself as Arjan. I thought that might be the case when I read one of your other threads, but I wasnât sure. At this point, Iâm only posting on this thread so that someone scanning through the forums later wonât read this thread and think this is yet another âunanswered postâ. It seems like you have a personal ax to grind against Sublime Text and Jon. Thatâs the only reason I can think of that keeps you coming back and trolling the forums this persistently.
So, let me answer the personal attack you leveled at me. I never said that there were no upvotes. I never said that no one wants this feature. I said that it is a vocal minority. Letâs do the math. There are 13880 members on the OFFICIAL forum for Sublime Text. 1065 is less than 50% of the registered users on the official forums (in fact, it is less than 10%), therefore it is a minority. Heck yeah, I downvoted it. I didnât even know userecho existed, and now Iâm making my position known by voting. Just like you probably made your position known by upvoting it.
Also, you should learn the meaning of words before you try to use them (or spell them for that manner). In fact, weâve both been using rhetoric to get our point across. Unless of course, you are going for the alternate meaning and implying that Iâve been dishonest or unreasonable. In which case, I challenge you to find an instance where Iâve been dishonest in any of our conversations. Reasonable is a more subjective measure, but I believe that Iâve been reasonable in my posts.
To bring things back on topic. The question of printing has been answered many times here, but letâs go over it againâŚ
I think the key reasons that Jon has left printing down the priority pile:
Done well, printing support across multiple platforms is non-trivial work.
Relatively few users need this function, and only occasionally. For the overwhelming use-case, thereâs a perfectly workable solution via a plugin (see below). Most of the editor is used all the time by most users, Jon is a sole-developer; Iâm guessing he wants to focus on functions that he thinks will bring maximum benefit to the editor and market impact - for most users.
A simple solution is to use the Export HTML plugin together with your browser. Apart from simple, itâs also pretty darned flexible, because once your printable code is in HTML/CSS you can do lots with it in before printing (ie. on the fly styling of fonts, colours, spacing, pagination, etc.). Thatâs programmer friendly; after all, the primary audience for sublime. As many, Iâve been doing it this way for a while and itâs both simple and flexible. Most text editorsâ inbuilt print facilities are nowhere near as flexible, though theyâll save you a couple of mouseclicks. I prefer the flexibility and see the extra couple of clicks as a non-issue.
For the above reason I really donât understand why people are so hung up on printing. Maybe Iâm missing something.
I am old-fashioned and write documentation in text files. I print technical docs about two or three times a day for review (I canât handle long on-screen reading sessions)
So I suppose I am a minority user, but using a plugin or copy-paste to another editor seems a bit silly for such a fundamental feature.
I wonder if thereâs enough functionality exposed to write a plugin to do direct printing?
Give Export HTML plugin a try, I pretty sure is good enough for 99% of people (the remaining must use another editor).
You can use a keybinding for printing.
This means that:
-You only have to hit your keybinding to launch your browser and open the printing setup window.
-Choose your printer settings and click OK.
-Close the browser.
So compared to another editor with builtin printing feature, you only have one more step (closing the browser), not a big deal when using two or three times a day.
Because when I do âExport HTML | Show Export menu | Browser print: Colorâ, my html editor starts up (NVu)
Without having looked at the source code⌠I suppose the plugin requires âhtm(l)â file types to be associated with a browser, which is a no-go for me. Is there a way to say which process to start?
[quote=âqgatesâ]A simple solution is to use the Export HTML plugin together with your browser. Apart from simple, itâs also pretty darned flexible, because once your printable code is in HTML/CSS you can do lots with it in before printing (ie. on the fly styling of fonts, colours, spacing, pagination, etc.).
For the above reason I really donât understand why people are so hung up on printing. Maybe Iâm missing something.[/quote]
I completely agree.
Futhermore, adding that I seldom print my code (or anything) âŚthis is really a non-issue to me.
Because when I do âExport HTML | Show Export menu | Browser print: Colorâ, my html editor starts up (NVu)
Without having looked at the source code⌠I suppose the plugin requires âhtm(l)â file types to be associated with a browser, which is a no-go for me. Is there a way to say which process to start?
Looking at the ExportHtml source code that you linked to, the last few lines of âExportHtml.pyâ have the following code:
if inputs"view_open"]:
self.view.window().open_file(the_html.name)
else:
# Open in web browser; check return code, if failed try webbrowser
status = desktop.open(the_html.name, status=True)
if not status:
webbrowser.open(the_html.name, new=2)
So it looks like the plugin is trying to open the html file with the default application (desktop.open), but the fallback code is what you want (webbrowser.open). A simple edit of the code should give you the preferred behaviour. If editing the code is out of the question for you, then maybe you could create a new issue with the developer asking him for a setting to control this behaviour (github.com/facelessuser/ExportHtml/issues)?
Because when I do âExport HTML | Show Export menu | Browser print: Colorâ, my html editor starts up (NVu)
Without having looked at the source code⌠I suppose the plugin requires âhtm(l)â file types to be associated with a browser, which is a no-go for me. Is there a way to say which process to start?
Looking at the ExportHtml source code that you linked to, the last few lines of âExportHtml.pyâ have the following code:
if inputs"view_open"]:
self.view.window().open_file(the_html.name)
else:
# Open in web browser; check return code, if failed try webbrowser
status = desktop.open(the_html.name, status=True)
if not status:
webbrowser.open(the_html.name, new=2)
So it looks like the plugin is trying to open the html file with the default application (desktop.open), but the fallback code is what you want (webbrowser.open). A simple edit of the code should give you the preferred behaviour. If editing the code is out of the question for you, then maybe you could create a new issue with the developer asking him for a setting to control this behaviour (github.com/facelessuser/ExportHtml/issues)?[/quote]
Thanks for the suggestions. After some looking around, I figured out how to edit the source and made sure only webbrowser.open is called. Unfortunately, that too opens NVu (or whatever the default application is)
One last tryâŚthe correct documentation link is: http://docs.python.org/3/library/webbrowser.html. Try one of the following: âgoogle-chromeâ, âchromeâ, âchromiumâ, âchromium-browserâ
None of those works - the associated application still starts. Since Python has four (!) different chrome names, I guess this is shaky business, and my bleeding edge chrome beta isnât found under those names?
I suppose you are on a Windows box.
webbrowser module is next to useless for anything except the default system browser.
It search the browser name in the system path, which is not a good idea on Windows.
You can check which browser was found in the console:
import webbrowser
webbrowser._browsers
Something like that must work, but not very useful:
Iâm one of âthose guysâ that considers integrated printing essential to their work. I really donât understand the virulence and contempt with which the people with the opposite views seem to regard this feature request.
Iâve been programming for 20 something years, and an essential part of the way I work is to print out and annotate my own code, and to share it with others for comment and revision. I understand that not everyone works that way, but because it is so important to the way I work, my primary editor will have that feature.
I have tried the other printing options, and they are just not âthere.â Print to HTML trashes programming indentation, particularly when there is a mix of spaces and tabs in the file. So I come to this forum simply to state that integrated printing is an essential feature for me, and to express my wish that it be added to Sublime 3. The developer of Sublime can do with this what he will, but Iâm not going to buy the editor unless it has this feature.
If you donât care about this feature, fine. But itâs important to me, because itâs part of the way that I work and code.
I really, really like Sublime: it is elegant, lightweight, and has personality. But the lack of integrated printing keeps me using editors that are otherwise clunkier (Notepad++, MultiEdit, SlickEdit).
I am programming for moreless 28 years, rarely I print code, but its a important feature, even Notepad has print option. Sublime Text is the best code editing tool, I bought it to support developers, they should implement this feature to support users
I wrote this plugin for my own. I hope it helps you all. Regards!
[code]
Coded by: Johan Maximus
This plugin for SublimeText3 prints the content of the current window over Windows platforms
Installation: place this âprint.pyâ file into you user packages folder. Eg.: sublimeFolder/Data/Packages/User/print.py
After that, bind the command âprintâ to a hot key you feel comfortable with. Go to âPreferencesâ, âKey Bindings - Userâ and write the next few lines:
class PrintCommand(sublime_plugin.TextCommand):
def run(self, edit):
# Reference wherever you want in your computer
path = âC:\Users\Maxi\Documents\printFile.txtâ
# Select all in the current window
content = self.view.substr(sublime.Region(0, self.view.size()))
# It opens the file âprintFileâ for writing
text_file = open(path, âwâ)
# Writes our content
text_file.write(content)
# Close the file
text_file.close()
# The sad part. It opens the file we created, containing what we want to print, with your default OS text editor (notepad in my case) and sends the print command to it.
os.startfile(path, âprintâ)
# Notepad closes after printing. Thatâs allâŚ[/code]