Re: Global indent
In article mailman.13359.1408831344.18130.python-l...@python.org, Anders Wegge Keller we...@wegge.dk wrote: On Sun, 24 Aug 2014 00:56:11 +1000 Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: Despite my comments, I don't actually have any objection to people who choose to use Emacs, or Vim, or edit their text files by poking the hard drive platter with a magnetised needle if they prefer :-) But I do think it's silly of them to claim that Emacs has no learning curve, or to fail to recognise how unfamiliar and different the UIs are compared to nearly everything else a computer user is likely to be familiar with in 2014. Really, they don't! At least not for the people, for whom they are necessary tools. When I started in my present job, remote access was a dial-up modem, that could do 2400 baud, if you were lucky[1]. With such a shitty connection, a text-only editor is indisputably the right thing. Curiously enough, even today the same lousy kind of connections prevail. We still have a sizeable modem bank at my job. We still do our remote support over a telnet/ssh session. And we still are unable to reliable get the connection speeds[2], that would make anything with a GUI remotely pleasant. So emacs and vim still have their niches. Those of us, who are old enough to have started our first job in a glorified teletype, OR have to support systems that are only reachable over RFC-1149 quality datalinks, belong there. The rest of you would probably be better off with something nicer. 1. Meaning a real switched landline all the way from Denmark to Tokyo. Ending up with two satellite up/down-links was a killer. 2. We have an installation in the Philippines, where we ended up installing a satellite uplink. It feels like we have doubled the connectivity of the entire Manilla area by doing so. And it's still painfully slow. Right. I remember having a 300 baud dial up line. Edwin's editor (ee), the editor I'm using right now, was optimised for screen access, and I could do cursor based full screen editing, quite passably, doing a vt100 emulation on my Osborne CP/M machine. (I've a non transferable license and ee is not for sale.) -- //Wegge Groetjes Albert -- Albert van der Horst, UTRECHT,THE NETHERLANDS Economic growth -- being exponential -- ultimately falters. albert@spearc.xs4all.nl =n http://home.hccnet.nl/a.w.m.van.der.horst -- https://mail.python.org/mailman/listinfo/python-list
Re: Global indent
On 23 August 2014 22:55, Rustom Mody rustompm...@gmail.com wrote: On Sunday, August 24, 2014 2:27:56 AM UTC+5:30, Joshua Landau wrote: Ay, so is any editor with an API. I use Sublime mostly because it's pretty, fast and has a Python-based API. The only actual feature it has that some others don't is multiple selections, and even then a lot do. You mean this? http://emacsrocks.com/e13.html Yup. -- https://mail.python.org/mailman/listinfo/python-list
Re: Global indent
Seymore4Head wrote: Is there a way to indent everything again? Say I have a while statement with several lines of code and I want to add a while outside that. That means indenting everything. Is there a global way to do that? In kwrite, kate, geany, and any other sensible editor, you select the text you want to indent and press the tab key. If your editor is not sensible, it may replace the entire block of text with a single tab. In that case, hit Ctrl-Z, or Undo from the Edit menu, and your text will be returned. In that case, check the menu commands offered by your editor, especially the Edit and Tools menu (if it has a Tools menu). In kwrite, I find Indent and Unindent commands under Tools. In geany, I find Increase Indent and Decrease Indent under EditCommands submenu. (In case your editor is not only not sensible, but out-and-out microcephalic, I suggest you try it on a sample piece of text first, in case it does not allow you to undo.) -- Steven -- https://mail.python.org/mailman/listinfo/python-list
Re: Global indent
Rob Gaddi wrote: Emacs and vim both have huge learning curves that I've decided aren't worth climbing. In my opinion, they are designed for people willing and able to commit to memory dozens, even hundreds, of obscure key sequences to get the simplest thing done. They are not designed for easy exploration of the application: you either know the command that you want, or you're stuck. Besides, the standard text editor is ed: http://www.gnu.org/fun/jokes/ed-msg.html Notepad++ is an excellent GUI text editor for Windows. Geany is nearly as good, and runs on anything. I have never used Notepad++, but I can give Geany good reviews. It's nearly as good as kate in KDE 3, and much better than kate in KDE 4. -- Steven -- https://mail.python.org/mailman/listinfo/python-list
Re: Global indent
Marko Rauhamaa wrote: Rob Gaddi rgaddi@technologyhighland.invalid: Emacs and vim both have huge learning curves Really now? When you start emacs, it advises you to start the builtin tutorial. You need a tutorial for a text editor??? If that's supposed to prove how easy Emacs is, you have failed miserably. Any application which requires a tutorial should consider it a UI failure. Ideally applications should be intuitive in the sense that all features should be self-explanatory, obvious, and easily discovered. Of course, the more complex the application, the less this is likely to be true, but every feature that requires explanation is a feature that is begging for improvement. That's how I learned it in the 1980's and didn't experience any learning curve. No learning curve at all? That means one of two things: - either you *instantly* intuited every single Emacs feature the moment you started the application; or - Emacs has no features at all. I'm pretty sure neither of those is the case :-) Nowadays, emacs has a GUI that makes you productive immediately without any keyboard commands. I have seen complete newbies adopt emacs without any kind of duress or hardship. I just started up emacs, and got a GUI window with an abstract picture of a gnu and a bunch of instructions which I didn't get a chance to read. I clicked on the text, and the instructions disappeared. I don't know how to get them back. They were replaced with what looks like a blank page ready to type into, except it starts with this ominous warning: ;; This buffer is for notes you don't want to save, and for Lisp evaluation. ;; If you want to create a file, visit that file with C-x C-f, ;; then enter the text in that file's own buffer. Why would I be writing notes I don't want to save? If I did, wouldn't I, you know, just *not save them* instead of write them in a special buffer (whatever that is!)? Lisp evaluation? I don't have any speech impediments, thank you very much. Okay, so let's try creating a file, using those instructions. I dutifully type C-x C-f and, apart from C-x C-f appearing on the screen, nothing happens. I wait a while in case it's just slow. Ah, silly me, I need to *enter* the command to make it happen. So I press Enter. Nothing happens except the cursor moves down a line. Perhaps Emacs has frozen? The blinking cursor is still blinking, so that's unlikely. Okay, let's click the blank page icon, the universal symbol for creating a new, blank document. That at least is recognisable. Well, that's just bizarre. I expected a new document. Instead, I got a message in the status bar at the bottom of the page, saying: Find file: /home/steve/ and the blinking cursor. I don't want to find a file, and if I did I would use my computer's Find or Search application, not a text editor. So still no new document I can type into. When all else fails, use the menus. So I try the File menu. It's a bit disconcerting that, alone of all the applications I've used on eight different platforms (Windows 95, 98, XP, Classic Mac, Mac OS X, Linux with Gnome, KDE and Xfce window managers), the mouse pointer points the other way when over a menu, but hey, I'm a sophisticated user and I refuse to be put off by such a minor, albeit gratuitous, difference. But there is no New Document command, and I am stymied again. I shall not be defeated by a mere text editor. I click the New Document icon again, hoping that what failed last time will succeed this time. But at least I am not entirely insane, for although I did not get a new document, at least something different occurred: an error message appeared in the status bar: Command attempted to use minibuffer while in minibuffer This is the moment that I decide to give up on Emacs and take up something trivial in comparison, like being a Soyuz pilot, если вы знаете, что я имею в виду. -- Steven -- https://mail.python.org/mailman/listinfo/python-list
Re: Global indent
Steven D'Aprano steve+comp.lang.pyt...@pearwood.info: Marko Rauhamaa wrote: When you start emacs, it advises you to start the builtin tutorial. You need a tutorial for a text editor??? If that's supposed to prove how easy Emacs is, you have failed miserably. You see, I tend to read even the assembly instructions of Ikea furniture and the user manual of a dryer. More frustrating than having to read a well-thought-out manual is * not being able to accomplish something * not having any manual For example, I never got Eclipse despite having to use it for two years. That's how I learned it in the 1980's and didn't experience any learning curve. No learning curve at all? That means one of two things: - either you *instantly* intuited every single Emacs feature the moment you started the application; or No, I just worked through the tutorial. It was fascinating and only took a couple of hours IIRC. That's the way learned almost everything (including Python). I just started up emacs, [...] Well, that's just bizarre. I'm not making you use emacs, you know. Marko -- https://mail.python.org/mailman/listinfo/python-list
Re: Global indent
Dan Stromberg wrote: The first time I saw vi, I hated it. I thought Why would anyone actually choose such a terrible editor? But then I was forced to use vi for a while, and I'm glad I was. I choose it over other editors now. vi/vim give you a pretty much orthogonal set of verbs and nouns in an editing language. Sorry, but I have no idea what you mean by orthogonal set of verbs and nouns in an editing language. Can you explain? When I have to use editors that make you arrow-key around or click with a mouse, I feel like it's painfully slow - especially if I need to do the same thing 5 times in a row. Sure, some editors let you define macros - vi/vim do that too. But AFAIK, only vi/vim allow you to define a repeatable action without forethought. I find that between find/replace and Block Selection editing, I can't really say I've missed either the lack of editing macros or these orthogonal verbs, whatever they are. Occasionally I move a large editing job into Python, but I wouldn't want to learn a separate language for that. -- Steven -- https://mail.python.org/mailman/listinfo/python-list
Re: Global indent
Am 23.08.14 11:08, schrieb Steven D'Aprano: I just started up emacs, and got a GUI window with an abstract picture of a gnu and a bunch of instructions which I didn't get a chance to read. I clicked on the text, and the instructions disappeared. I don't know how to get them back. They were replaced with what looks like a blank page ready to type into, except it starts with this ominous warning: ;; This buffer is for notes you don't want to save, and for Lisp evaluation. ;; If you want to create a file, visit that file with C-x C-f, ;; then enter the text in that file's own buffer. [...] (lots of frustrating user experience deleted) This is the moment that I decide to give up on Emacs and take up something trivial in comparison, like being a Soyuz pilot, если вы знаете, что я имею в виду. Well done, Steve! This is the exact reason that I do not recommend gvim to anybody, who asks me an editor question, though I use it myself for practically any text editing task. (I'm pretty sure you did that C-f ... thing on purpose to make your point clear. and that you actually understand it was meant to represent pressing Ctrl-key). There are ways to put these editors into Beginner's mode, for vim there is evim, and for sure emacs has something similar, where the editor behaves more like you expect. In evim, this means you can't go to command mode, and you need to use the menus and toolbars to save/load text. But if you do that, you also loose the functionality that comes from the command mode - it's actually better to recommend Notepad++ or kate. Sometimes I impress my colleagues with what they call magic, i.e. creating special repeated lists of numbers by a few keystrokes in gvim, and that has triggered the request from them to learn a bit of (g)vim. But when they asked me, which editor they should use, I pointed them to kate. Christian -- https://mail.python.org/mailman/listinfo/python-list
Re: Global indent
On Sat, 23 Aug 2014 18:19:21 +1000, Steven D'Aprano wrote: Rob Gaddi wrote: Emacs and vim both have huge learning curves that I've decided aren't worth climbing. In my opinion, they are designed for people willing and able to commit to memory dozens, even hundreds, of obscure key sequences to get the simplest thing done. They are not designed for easy exploration of the application: you either know the command that you want, or you're stuck. Besides, the standard text editor is ed: http://www.gnu.org/fun/jokes/ed-msg.html Notepad++ is an excellent GUI text editor for Windows. Geany is nearly as good, and runs on anything. I have never used Notepad++, but I can give Geany good reviews. It's nearly as good as kate in KDE 3, and much better than kate in KDE 4. I'll give Geany another thumbs up it is quite well featured but still light weight (i tend to do my personal work on a netbook so I don't have much in the way of resources) for the original problem Shift Cursor UP/Down to highlight the block then Ctrl-I to indent or Ctrl-u to unindent. -- Is it weird in here, or is it just me? -- Steven Wright -- https://mail.python.org/mailman/listinfo/python-list
Re: Global indent
On 22/08/2014 20:46, Seymore4Head wrote: http://gvim.en.softonic.com/ Has a snazzy look, but I think it is not compatible with Windows so it looks like I might have to try Emacs. Others will disagree but I find keeping Windows and *nix separate helps me a lot. So I'll use emacs on Linux for C++/Python/Tcl and VisualStudio / NotePad++ on Windows. Using Windows style editors on Windows just seems to be easier, whenever I try emacs on Windows it doesn't feel right and I start thinking more about the editor and less about what is being edited. You may be comfortable with emacs on Windows but part of my job is producing C++ and C# code for Windows so VisualStudio is the order of the day and so using NotePad++ for Python works for me. YMMV Andy -- https://mail.python.org/mailman/listinfo/python-list
Re: Global indent
(Since this is already an editor war...) On 23 August 2014 10:41, Christian Gollwitzer aurio...@gmx.de wrote: Sometimes I impress my colleagues with what they call magic, i.e. creating special repeated lists of numbers by a few keystrokes in gvim, and that has triggered the request from them to learn a bit of (g)vim. I have yet to be truly impressed by Vim, in that Sublime Text with a few extensions seems to do the same things just as easily. I find that Vim and Emacs users consistently underrate the powers of these editors, presumably because they've never put nearly as much effort into them as they have into their Vim or Emacs. For example, to make a numbered list in (my) Sublime Text (fully custom shortcuts ahead): Alt-1 Alt-0 Alt-0 to repeat the next command 100 times Enter to insert 100 new lines, so 101 in total Ctrl-A to select all text (can be done more fancily, but keep this simple for now) Ctrl-l to select lines (creates multiple selections), ignoring the blank end of selection $: to write some text Ctrl-Shift-Home to select to beginning of line Ctrl-e to replace $ with consecutive numbers (also supports using Python's {} with all of its formatting options) With an increment function and macros: 1: to write some text Ctrl-q to start macro recording Ctrl-d to duplicate line (and select it) Leftto go to start of selection INCREMENT to increment number (emulated by evaluating 1+number with Python [1, +, Ctrl-left, Shift-Home, Ctrl-Shift-e]) Ctrl-q to finish macro recording Alt-1 Alt-0 Alt-0 to repeat the next command 100 times Ctrl-Shift-qto repeat macro Compare with Vim: http://stackoverflow.com/questions/4224410/macro-for-making-numbered-lists-in-vim -- https://mail.python.org/mailman/listinfo/python-list
Re: Global indent
On Saturday 23 August 2014 06:17:24 alister did opine And Gene did reply: On Sat, 23 Aug 2014 18:19:21 +1000, Steven D'Aprano wrote: Rob Gaddi wrote: Emacs and vim both have huge learning curves that I've decided aren't worth climbing. In my opinion, they are designed for people willing and able to commit to memory dozens, even hundreds, of obscure key sequences to get the simplest thing done. They are not designed for easy exploration of the application: you either know the command that you want, or you're stuck. Besides, the standard text editor is ed: http://www.gnu.org/fun/jokes/ed-msg.html Notepad++ is an excellent GUI text editor for Windows. Geany is nearly as good, and runs on anything. I have never used Notepad++, but I can give Geany good reviews. It's nearly as good as kate in KDE 3, and much better than kate in KDE 4. I'll give Geany another thumbs up I would too, but for the code carving I do, gedit has syntax highlighters for calling attention to GCode formatting mistakes, Geany doesn't. It does look like a capable editor, but it just doesn't fit my instant needs. it is quite well featured but still light weight (i tend to do my personal work on a netbook so I don't have much in the way of resources) for the original problem Shift Cursor UP/Down to highlight the block then Ctrl-I to indent or Ctrl-u to unindent. Cheers, Gene Heskett -- There are four boxes to be used in defense of liberty: soap, ballot, jury, and ammo. Please use in that order. -Ed Howdershelt (Author) Genes Web page http://geneslinuxbox.net:6309/gene US V Castleman, SCOTUS, Mar 2014 is grounds for Impeaching SCOTUS -- https://mail.python.org/mailman/listinfo/python-list
Re: Global indent
On Saturday, August 23, 2014 2:38:10 PM UTC+5:30, Steven D'Aprano wrote: Marko Rauhamaa wrote: Rob Gaddi : Emacs and vim both have huge learning curves Really now? When you start emacs, it advises you to start the builtin tutorial. You need a tutorial for a text editor??? If that's supposed to prove how easy Emacs is, you have failed miserably. Any application which requires a tutorial should consider it a UI failure. Ideally applications should be intuitive in the sense that all features should be self-explanatory, obvious, and easily discovered. Of course, the more complex the application, the less this is likely to be true, but every feature that requires explanation is a feature that is begging for improvement. That's how I learned it in the 1980's and didn't experience any learning curve. No learning curve at all? That means one of two things: - either you *instantly* intuited every single Emacs feature the moment you started the application; or - Emacs has no features at all. I'm pretty sure neither of those is the case :-) Nowadays, emacs has a GUI that makes you productive immediately without any keyboard commands. I have seen complete newbies adopt emacs without any kind of duress or hardship. I just started up emacs, and got a GUI window with an abstract picture of a gnu and a bunch of instructions which I didn't get a chance to read. I clicked on the text, and the instructions disappeared. I don't know how to get them back. They were replaced with what looks like a blank page ready to type into, except it starts with this ominous warning: ;; This buffer is for notes you don't want to save, and for Lisp evaluation. ;; If you want to create a file, visit that file with C-x C-f, ;; then enter the text in that file's own buffer. Why would I be writing notes I don't want to save? If I did, wouldn't I, you know, just *not save them* instead of write them in a special buffer (whatever that is!)? Lisp evaluation? I don't have any speech impediments, thank you very much. Okay, so let's try creating a file, using those instructions. I dutifully type C-x C-f and, apart from C-x C-f appearing on the screen, nothing happens. I wait a while in case it's just slow. Ah, silly me, I need to *enter* the command to make it happen. So I press Enter. Nothing happens except the cursor moves down a line. Perhaps Emacs has frozen? The blinking cursor is still blinking, so that's unlikely. Okay, let's click the blank page icon, the universal symbol for creating a new, blank document. That at least is recognisable. Well, that's just bizarre. I expected a new document. Instead, I got a message in the status bar at the bottom of the page, saying: Find file: /home/steve/ and the blinking cursor. I don't want to find a file, and if I did I would use my computer's Find or Search application, not a text editor. So still no new document I can type into. When all else fails, use the menus. So I try the File menu. It's a bit disconcerting that, alone of all the applications I've used on eight different platforms (Windows 95, 98, XP, Classic Mac, Mac OS X, Linux with Gnome, KDE and Xfce window managers), the mouse pointer points the other way when over a menu, but hey, I'm a sophisticated user and I refuse to be put off by such a minor, albeit gratuitous, difference. But there is no New Document command, and I am stymied again. I shall not be defeated by a mere text editor. I click the New Document icon again, hoping that what failed last time will succeed this time. But at least I am not entirely insane, for although I did not get a new document, at least something different occurred: an error message appeared in the status bar: Command attempted to use minibuffer while in minibuffer This is the moment that I decide to give up on Emacs and take up something trivial in comparison, like being a Soyuz pilot, если вы знаете, что я имею в виду. emacs = Editor for Middle Aged Computer Scientists - Generally Not Used vi = a program with two modes -- one in which it beeps and the other in which it corrupts your file -- https://mail.python.org/mailman/listinfo/python-list
Re: Global indent
Christian Gollwitzer wrote: Am 23.08.14 11:08, schrieb Steven D'Aprano: This is the moment that I decide to give up on Emacs and take up something trivial in comparison, like being a Soyuz pilot, если вы знаете, что я имею в виду. Well done, Steve! This is the exact reason that I do not recommend gvim to anybody, who asks me an editor question, though I use it myself for practically any text editing task. (I'm pretty sure you did that C-f ... thing on purpose to make your point clear. and that you actually understand it was meant to represent pressing Ctrl-key). Of course I did, but only because I've been a Linux user and programmer for about 15 years now. Except for Emacs, the rest of the world says Ctrl-F (or Command-F if you have a Mac), and use it to mean Find. Emacs is a universe of its own, but you can hardly be a Linux programmer without coming across Emacs terminology enough to at least recognise it. There are ways to put these editors into Beginner's mode, for vim there is evim, and for sure emacs has something similar, where the editor behaves more like you expect. In evim, this means you can't go to command mode, and you need to use the menus and toolbars to save/load text. But if you do that, you also loose the functionality that comes from the command mode - it's actually better to recommend Notepad++ or kate. Despite my comments, I don't actually have any objection to people who choose to use Emacs, or Vim, or edit their text files by poking the hard drive platter with a magnetised needle if they prefer :-) But I do think it's silly of them to claim that Emacs has no learning curve, or to fail to recognise how unfamiliar and different the UIs are compared to nearly everything else a computer user is likely to be familiar with in 2014. I'm especially annoyed and/or amused by the tendency of many people to assume that there are only three editors: Emacs, Vim (one of which is used by all right-thinking people, the other being sent by the Devil to tempt us from righteousness) and Notepad (which is used only by the most primitive, deprived savages who are barely capable of bashing out Hello World using one finger). Besides, ed is the one true editor *wink* My own feeling is that Emacs and/or Vim very likely are extraordinarily powerful, and for those who want to take the time and effort to become proficient they can probably solve certain editing tasks more quickly than I can. But that's okay: I suspect that they're optimizing for the wrong things, or at least things for which I personally have no interest in optimizing: while they can probably replace the third letter of every second word in all sentences beginning with W ten times faster than I can, that's hardly a bottleneck in my world. I've watched touch-typing Vim users, and they can pound the keys much faster than me, but that seems to mean that they just make mistakes faster than me. (Possibly unfair, since everyone probably loses accuracy when being watched. But still, it's the only data I have.) When I'm programming, actual fingers on keys is just a small proportion of the time spent. Most of my time is reading, thinking and planning, with typing and editing a distant fourth, and I not only don't mind moving off the keyboard onto the mouse, but actually think that's a good thing to shift my hands off the keyboard and use a different set of muscles. So I'm not especially receptive to arguments that Vim or Emacs will make me more productive. But, to each their own. -- Steven -- https://mail.python.org/mailman/listinfo/python-list
Re: Global indent
On Fri, 22 Aug 2014 14:19:29 -0400, Seymore4Head Seymore4Head@Hotmail.invalid wrote: Is there a way to indent everything again? Say I have a while statement with several lines of code and I want to add a while outside that. That means indenting everything. Is there a global way to do that? I did two things. I decided to skip trying a second level of while loops for the moment. I also took a block of text and highlighted it and then pushed tab. It worked. Thanks everyone -- https://mail.python.org/mailman/listinfo/python-list
Re: Global indent
Hi Steven, I agree with all you said. Am 23.08.14 16:56, schrieb Steven D'Aprano: Christian Gollwitzer wrote: There are ways to put these editors into Beginner's mode, for vim there is evim, and for sure emacs has something similar, where the editor behaves more like you expect. In evim, this means you can't go to command mode, and you need to use the menus and toolbars to save/load text. But if you do that, you also loose the functionality that comes from the command mode - it's actually better to recommend Notepad++ or kate. I'm especially annoyed and/or amused by the tendency of many people to assume that there are only three editors: Emacs, Vim (one of which is used by all right-thinking people, the other being sent by the Devil to tempt us from righteousness) and Notepad (which is used only by the most primitive, deprived savages who are barely capable of bashing out Hello World using one finger). Just in case that was misleading: Notepad++ is a different editor than Notepad: http://notepad-plus-plus.org/ This one I actually recommend to people on Windows, who ask me, which editor should they use. Christian -- https://mail.python.org/mailman/listinfo/python-list
Re: Global indent
Am 23.08.14 16:19, schrieb Joshua Landau: (Since this is already an editor war...) On 23 August 2014 10:41, Christian Gollwitzer aurio...@gmx.de wrote: Sometimes I impress my colleagues with what they call magic, i.e. creating special repeated lists of numbers by a few keystrokes in gvim, and that has triggered the request from them to learn a bit of (g)vim. I have yet to be truly impressed by Vim, in that Sublime Text with a few extensions seems to do the same things just as easily. I find that Vim and Emacs users consistently underrate the powers of these editors, presumably because they've never put nearly as much effort into them as they have into their Vim or Emacs. I never looked into Sublime, because it costs money. But no doubt it is a powerful editor, judging from comments of other people. For example, to make a numbered list in (my) Sublime Text (fully custom shortcuts ahead): Alt-1 Alt-0 Alt-0 to repeat the next command 100 times [ ... some keystrokes ...] Ctrl-Shift-qto repeat macro Compare with Vim: http://stackoverflow.com/questions/4224410/macro-for-making-numbered-lists-in-vim I'd actually do this in gvim to put numbers at each line: - Select text (by mouse, or v + cursor movements) - ! awk '{print NR . $0}' Yes, it is cheating, it pipes the selected text through an external tool. But why should I do the tedious exercise of constructing an editor macro, when an external tool like awk can do the same so much easier? Christian -- https://mail.python.org/mailman/listinfo/python-list
Re: Global indent [levity]
On Sat, 23 Aug 2014 19:08:10 +1000, Steven D'Aprano wrote: Marko Rauhamaa wrote: Rob Gaddi rgaddi@technologyhighland.invalid: Emacs and vim both have huge learning curves Really now? When you start emacs, it advises you to start the builtin tutorial. You need a tutorial for a text editor??? Did you ever watch a bar scene in a cowboy western, and suddenly there's a loud noise, and a shout in a growly voice, and you just know that a brawl is about to break out? -- To email me, substitute nowhere-runbox, invalid-com. -- https://mail.python.org/mailman/listinfo/python-list
Re: Global indent
On 2014-08-23 19:31, Steven D'Aprano wrote: Sorry, but I have no idea what you mean by orthogonal set of verbs and nouns in an editing language. Can you explain? In the context of vi/vim, an orthogonal set of verbs and nouns in an editing language mean that you have a collection of verbs (such as d=delete, v=visual/highlight, y=yank/copy, c=change, zf=fold, gU=transform-to-uppercase, gu=transform-to-lowercase, g~=swap-case, g?=ROT13, ==reformat, etc) and nouns (often called motions as most of them can be used to move the cursor in normal-mode) such as b=back, }=next-paragraph-boundary, {=previous-paragraph-boundary, *=next-match-of-the-word-under-the-cursor, etc. They're orthogonal because learning a new verb allows you to apply it to all of the nouns/motions you already know; and learning a new noun/motion lets you use it with any of the verbs you know. And you can prefix any command (verb+noun) with a count which increases the power further. Thus, learning one new thing has a multiplying effect. I find that between find/replace and Block Selection editing, I can't really say I've missed either the lack of editing macros or these orthogonal verbs, whatever they are. Occasionally I move a large editing job into Python, but I wouldn't want to learn a separate language for that. Much of the power comes in the repeatability of last action. Once the editor understands that your last action meant transform-to-uppercase from the cursor to the end of the line, you can move anywhere else in the document and instruct the editor to do the same thing with a single command (in vi/vim, that's the period). Drew Neil's _Practical Vim_ spends quite a bit of ink covering the implications of repeatability. [from another message from Steven] When I'm programming, actual fingers on keys is just a small proportion of the time spent. Most of my time is reading, thinking and planning, with typing and editing a distant fourth, and I not only don't mind moving off the keyboard onto the mouse, but actually think that's a good thing to shift my hands off the keyboard and use a different set of muscles. So I'm not especially receptive to arguments that Vim or Emacs will make me more productive. I agree that a much smaller percentage of my time is spent actually entering text and a far greater amount of time is spent navigating (reading/thinking/planning) the document. Most vi/vim users spend their time in normal mode where that navigation is quick and can all be done from a keyboard. I find that [and from yet another message from Steven] You need a tutorial for a text editor??? If that's supposed to prove how easy Emacs is, you have failed miserably. Indeed, both vim and emacs provide tutorials precisely because they are NOT so easy to get started with. But while I might not need instruction for a hand-saw to remove a small tree, if I had multiple trees to cut down, I might want a chainsaw and seek to read the instructions to get the most out of my investment. And if I had a LOT of trees to cut down, I might make a major investment https://www.youtube.com/watch?v=LYKg0gbRFns and read the heck out of the instructions. I happen to use vi/vim because it works just about everywhere (and even comes installed from the factory on most *nix-likes), but as long as people are using an editor that is sufficient to meet their needs, I'm content to live in amicable harmony. It's when your needs exceed what your editor can provide that I start to recommend editor-shopping. I can't help you if you choose something other than Vim, but I can encourage complainers to use a more powerful editor. [and yet one other message from Steven] Besides, the standard text editor is ed: THERE is the truth ;-) (and...it's far more powerful than Notepad) -tkc -- https://mail.python.org/mailman/listinfo/python-list
Re: Global indent
On 2014-08-23 15:19, Joshua Landau wrote: I have yet to be truly impressed by Vim, in that Sublime Text with a few extensions seems to do the same things just as easily Can it be run remotely in a tmux session which can be accessed via SSH from multiple machines? ;-) Using the command-line: it's a terminal condition. -tkc -- https://mail.python.org/mailman/listinfo/python-list
Re: Global indent
On 23 August 2014 17:17, Christian Gollwitzer aurio...@gmx.de wrote: Am 23.08.14 16:19, schrieb Joshua Landau: On 23 August 2014 10:41, Christian Gollwitzer aurio...@gmx.de wrote: Sometimes I impress my colleagues with what they call magic, i.e. creating special repeated lists of numbers by a few keystrokes in gvim, and that has triggered the request from them to learn a bit of (g)vim. I have yet to be truly impressed by Vim, in that Sublime Text with a few extensions seems to do the same things just as easily. I find that Vim and Emacs users consistently underrate the powers of these editors, presumably because they've never put nearly as much effort into them as they have into their Vim or Emacs. I never looked into Sublime, because it costs money. But no doubt it is a powerful editor, judging from comments of other people. Ay, so is any editor with an API. I use Sublime mostly because it's pretty, fast and has a Python-based API. The only actual feature it has that some others don't is multiple selections, and even then a lot do. My point is more about how using Emacs or Vim and having a powerful editor is mostly the symptom of the same thing, not a causal relation. For example, to make a numbered list in (my) Sublime Text (fully custom shortcuts ahead): [ ... some keystrokes ...] I'd actually do this in gvim to put numbers at each line: - Select text (by mouse, or v + cursor movements) - ! awk '{print NR . $0}' Yes, it is cheating, it pipes the selected text through an external tool. But why should I do the tedious exercise of constructing an editor macro, when an external tool like awk can do the same so much easier? Because it normally happens more like this: Move to copy something that I wish to postfix with a number Ctrl-d a few times to select copies of that fragment Write $ and select it Press Ctrl-e to turn $s into numbers Luckily that one doesn't happen too often either because numbering things sequentially is better left to loops. The key binding is primarily used for evaluating snippets of code inline. -- https://mail.python.org/mailman/listinfo/python-list
Re: Global indent
On Sunday, August 24, 2014 2:27:56 AM UTC+5:30, Joshua Landau wrote: Ay, so is any editor with an API. I use Sublime mostly because it's pretty, fast and has a Python-based API. The only actual feature it has that some others don't is multiple selections, and even then a lot do. You mean this? http://emacsrocks.com/e13.html -- https://mail.python.org/mailman/listinfo/python-list
Re: Global indent
On Sun, 24 Aug 2014 00:56:11 +1000 Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: Despite my comments, I don't actually have any objection to people who choose to use Emacs, or Vim, or edit their text files by poking the hard drive platter with a magnetised needle if they prefer :-) But I do think it's silly of them to claim that Emacs has no learning curve, or to fail to recognise how unfamiliar and different the UIs are compared to nearly everything else a computer user is likely to be familiar with in 2014. Really, they don't! At least not for the people, for whom they are necessary tools. When I started in my present job, remote access was a dial-up modem, that could do 2400 baud, if you were lucky[1]. With such a shitty connection, a text-only editor is indisputably the right thing. Curiously enough, even today the same lousy kind of connections prevail. We still have a sizeable modem bank at my job. We still do our remote support over a telnet/ssh session. And we still are unable to reliable get the connection speeds[2], that would make anything with a GUI remotely pleasant. So emacs and vim still have their niches. Those of us, who are old enough to have started our first job in a glorified teletype, OR have to support systems that are only reachable over RFC-1149 quality datalinks, belong there. The rest of you would probably be better off with something nicer. 1. Meaning a real switched landline all the way from Denmark to Tokyo. Ending up with two satellite up/down-links was a killer. 2. We have an installation in the Philippines, where we ended up installing a satellite uplink. It feels like we have doubled the connectivity of the entire Manilla area by doing so. And it's still painfully slow. -- //Wegge -- https://mail.python.org/mailman/listinfo/python-list
Re: Global indent
Anders Wegge Keller we...@wegge.dk: Curiously enough, even today the same lousy kind of connections prevail. We still have a sizeable modem bank at my job. We still do our remote support over a telnet/ssh session. And we still are unable to reliable get the connection speeds[2], that would make anything with a GUI remotely pleasant. I do emacs over SSH terminal connections all the time both for business and pleasure. I have occasionally even run the SSH connection (and emacs) from my cell phone. The connections aren't all that lousy, but I wouldn't run X11 over them. Rdesktop is ok but not nearly as convenient as a terminal connection. Marko -- https://mail.python.org/mailman/listinfo/python-list
Global indent
Is there a way to indent everything again? Say I have a while statement with several lines of code and I want to add a while outside that. That means indenting everything. Is there a global way to do that? -- https://mail.python.org/mailman/listinfo/python-list
Re: Global indent
On Fri, Aug 22, 2014 at 1:19 PM, Seymore4Head Seymore4Head@hotmail.invalid wrote: Say I have a while statement with several lines of code and I want to add a while outside that. That means indenting everything. Is there a global way to do that? Depends on your text editor/IDE. In Emacs using either python-mode.el or python.el, I use C-c to shift the selected region right, C-c to shift it left. Other editors probably have similar commands. Skip -- https://mail.python.org/mailman/listinfo/python-list
Re: Global indent
On 8/22/2014 2:19 PM, Seymore4Head wrote: Is there a way to indent everything again? Say I have a while statement with several lines of code and I want to add a while outside that. That means indenting everything. Is there a global way to do that? This sort of simple task is why fancy text editors were invented. I use and recommend gvim (press in select mode using the standard python plugin), but there are plenty of options out there. -- Neil Cerutti -- https://mail.python.org/mailman/listinfo/python-list
Re: Global indent
On Fri, Aug 22, 2014 at 11:44 AM, Neil D. Cerutti ne...@norwich.edu wrote: On 8/22/2014 2:19 PM, Seymore4Head wrote: Is there a way to indent everything again? Say I have a while statement with several lines of code and I want to add a while outside that. That means indenting everything. Is there a global way to do that? This sort of simple task is why fancy text editors were invented. I use and recommend gvim (press in select mode using the standard python plugin), but there are plenty of options out there. Here's another way of saying it (for vi or vim or other vi clone): 1) Go to the top of the region you want to indent. 2) Type ma in command mode to set a mark named a. 3) Go to the bottom of the region you want to indent. 4) Type 'a to indent, one level, everything between the mark named a and the cursor HTH -- https://mail.python.org/mailman/listinfo/python-list
Re: Global indent
On Fri, 22 Aug 2014 14:19:29 -0400, Seymore4Head Seymore4Head@Hotmail.invalid wrote: Is there a way to indent everything again? Say I have a while statement with several lines of code and I want to add a while outside that. That means indenting everything. Is there a global way to do that? Ok.so the answer is no using IDLE (Python GUI) The top two answers so far are Emacs and gvim. http://gvim.en.softonic.com/ Has a snazzy look, but I think it is not compatible with Windows so it looks like I might have to try Emacs. Thanks everyone -- https://mail.python.org/mailman/listinfo/python-list
Re: Global indent
On Fri, 22 Aug 2014 15:46:33 -0400 Seymore4Head Seymore4Head@Hotmail.invalid wrote: On Fri, 22 Aug 2014 14:19:29 -0400, Seymore4Head Seymore4Head@Hotmail.invalid wrote: Is there a way to indent everything again? Say I have a while statement with several lines of code and I want to add a while outside that. That means indenting everything. Is there a global way to do that? Ok.so the answer is no using IDLE (Python GUI) The top two answers so far are Emacs and gvim. http://gvim.en.softonic.com/ Has a snazzy look, but I think it is not compatible with Windows so it looks like I might have to try Emacs. Thanks everyone Emacs and vim both have huge learning curves that I've decided aren't worth climbing. Notepad++ is an excellent GUI text editor for Windows. Geany is nearly as good, and runs on anything. -- Rob Gaddi, Highland Technology -- www.highlandtechnology.com Email address domain is currently out of order. See above to fix. -- https://mail.python.org/mailman/listinfo/python-list
Re: Global indent
On 22 August 2014 19:44:39 BST, Neil D. Cerutti ne...@norwich.edu wrote: This sort of simple task [indenting blocks of text] is why fancy text editors were invented. I use and recommend gvim (press in select mode using the standard python plugin), but there are plenty of options out there. Even without the Python add-on this should work. It shifts the text based on the 'shiftwidth' setting. I vaguely remember using some other editors (one or more of Nedit, Gedit, Kate, Notepad++, Eclipse) that use, or can be configured to use, the tab key to indent selected text rather than replacing it with a tab character. Shift-tab probably out dented too. Simon -- Sent from Kaiten Mail. Please excuse my brevity. -- https://mail.python.org/mailman/listinfo/python-list
Re: Global indent
Rob Gaddi rgaddi@technologyhighland.invalid: Emacs and vim both have huge learning curves Really now? When you start emacs, it advises you to start the builtin tutorial. That's how I learned it in the 1980's and didn't experience any learning curve. Nowadays, emacs has a GUI that makes you productive immediately without any keyboard commands. I have seen complete newbies adopt emacs without any kind of duress or hardship. Marko -- https://mail.python.org/mailman/listinfo/python-list
Re: Global indent
On 8/22/2014 3:54 PM, Rob Gaddi wrote: On Fri, 22 Aug 2014 15:46:33 -0400 Seymore4Head Seymore4Head@Hotmail.invalid wrote: On Fri, 22 Aug 2014 14:19:29 -0400, Seymore4Head Seymore4Head@Hotmail.invalid wrote: Is there a way to indent everything again? Say I have a while statement with several lines of code and I want to add a while outside that. That means indenting everything. Is there a global way to do that? Ok.so the answer is no using IDLE (Python GUI) The top two answers so far are Emacs and gvim. http://gvim.en.softonic.com/ Has a snazzy look, but I think it is not compatible with Windows so it looks like I might have to try Emacs. gvim runs just fine on Windows. http://www.vim.org/download.php Thanks everyone Emacs and vim both have huge learning curves that I've decided aren't worth climbing. Notepad++ is an excellent GUI text editor for Windows. Geany is nearly as good, and runs on anything. They do have a very long learning incline but it isn't actually as steep as it looks--it's just that it keeps going up as far as you can see. :) If simple things weren't simple to do, neither product would have ever succeeded. The GUI version of Vim (gvim), has beginner modes and Windows-like modes to help with the transitional phases. -- Neil Cerutti -- https://mail.python.org/mailman/listinfo/python-list
Re: Global indent
On Sat, Aug 23, 2014 at 5:46 AM, Seymore4Head Seymore4Head@hotmail.invalid wrote: On Fri, 22 Aug 2014 14:19:29 -0400, Seymore4Head Seymore4Head@Hotmail.invalid wrote: Is there a way to indent everything again? Say I have a while statement with several lines of code and I want to add a while outside that. That means indenting everything. Is there a global way to do that? Ok.so the answer is no using IDLE (Python GUI) This is very much an editor question, so you ought to have said *right at the beginning* that you're using Idle's editor. Try selecting a bunch of text and hitting Tab. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Global indent
On 22/08/2014 21:20, Chris Angelico wrote: On Sat, Aug 23, 2014 at 5:46 AM, Seymore4Head Seymore4Head@hotmail.invalid wrote: On Fri, 22 Aug 2014 14:19:29 -0400, Seymore4Head Seymore4Head@Hotmail.invalid wrote: Is there a way to indent everything again? Say I have a while statement with several lines of code and I want to add a while outside that. That means indenting everything. Is there a global way to do that? Ok.so the answer is no using IDLE (Python GUI) This is very much an editor question, so you ought to have said *right at the beginning* that you're using Idle's editor. Try selecting a bunch of text and hitting Tab. ChrisA There are also indent and dedent options on the format menu. Using default settings on Windows 8.1, python 3.4.1 these are CTRL+] and CTRL+[ respectively. -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence -- https://mail.python.org/mailman/listinfo/python-list
Re: Global indent
On Fri, Aug 22, 2014 at 1:16 PM, Neil D. Cerutti ne...@norwich.edu wrote: Emacs and vim both have huge learning curves that I've decided aren't worth climbing. Notepad++ is an excellent GUI text editor for Windows. Geany is nearly as good, and runs on anything. They do have a very long learning incline but it isn't actually as steep as it looks--it's just that it keeps going up as far as you can see. :) If simple things weren't simple to do, neither product would have ever succeeded. The GUI version of Vim (gvim), has beginner modes and Windows-like modes to help with the transitional phases. Learning vi: http://stromberg.dnsalias.org/~strombrg/vi.ref.6 The first time I saw vi, I hated it. I thought Why would anyone actually choose such a terrible editor? But then I was forced to use vi for a while, and I'm glad I was. I choose it over other editors now. vi/vim give you a pretty much orthogonal set of verbs and nouns in an editing language. When I have to use editors that make you arrow-key around or click with a mouse, I feel like it's painfully slow - especially if I need to do the same thing 5 times in a row. Sure, some editors let you define macros - vi/vim do that too. But AFAIK, only vi/vim allow you to define a repeatable action without forethought. -- https://mail.python.org/mailman/listinfo/python-list