Tell me more ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I often want to print a piece of code to either mull over it or discuss it with someone else. However the text editors I use all seem to turn on word wrap when printing. Gedit for example has an option to turn off text wrap, but it prints out with the text wrapped anyway.

I find this very difficult to read, (I remember a lot of my code by its "shape", so this completely messes it up).

Can anyone recommend a Linux text editor, preferably with (Python) syntax highlighting, where you can turn off word wrap when printing.

share|improve this question
2  
Just what should it do when the code has lines longer than will fit on the page, if it isn't allowed to word wrap? Clip them to the page width? – Michael Kjörling Feb 6 at 15:28
I think you should seek an alternative program which formats your code in such a way as to break lines in ways that keep your code still easily readable. It's also a good idea in general as it keeps your code tidy and consistent. – Neil Feb 6 at 15:42
Vim! (You use the command :set nowrap) – daviewales Feb 6 at 15:42
2  
What! There can't possibly be a valid use case for keeping code lines short. That has been obviated by widescreen monitors. </sarcasm> – Karl Bielefeldt Feb 6 at 15:48
@Michael K It should do what the screen display does, and let it disappear off to the side. I don't mind the far right part of the lines missing, as I will be familiar with the code, and be able to remember it. I find it nearly impossible to read wrapped code. – wobbily_col Feb 6 at 15:48
show 4 more comments

closed as off topic by superM, Karl Bielefeldt, gnat, Glenn Nelson, Ryathal Feb 6 at 15:40

Questions on Programmers Stack Exchange are expected to relate to software development within the scope defined in the FAQ. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about closed questions here.

1 Answer

Try enscript:

enscript -c filename
share|improve this answer
1  
While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. – Glenn Nelson Feb 6 at 15:57

Not the answer you're looking for? Browse other questions tagged or ask your own question.