473,657 Members | 2,505 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how do you move to a new line in your text editor?

This is a real small point, but I'd like to hear what others do in this
case. It's more an 'administrative ' type question than Python code
question, but it still involves a bit of syntax.

One thing I like to do is use tabs for my indentation, because this
makes it easy to outdent when I need to start a new line in column 1. I
can press backspace once and move 4 spaces to the left.

But I read in the PEP that spaces are recommended over tabs. If this is
the case, it would involve pressing backspace 4 times (or 8, etc.) to
get back to column 1.

So I'm wondering, how do you all handle moving around in your code in
cases like this? Is there some sort of consistency to these things that
you can write rules for your text editor to know when to outdent? It
doesn't seem like you can do this reliably, though.
Mar 2 '06 #1
24 2540
John Salerno wrote:
So I'm wondering, how do you all handle moving around in your code in
cases like this? Is there some sort of consistency to these things that
you can write rules for your text editor to know when to outdent? It
doesn't seem like you can do this reliably, though.


Emacs, at least, outdents reliably with spaces. Probably some other
editors do as well, though I was kind of surprised to find out that
some editors have (compared to Emacs) weak indent inference.

If editing with spaces annoys you, it might be possible with your
editor (which seems to have a variable tab stop) to edit the file with
tabs, but save it with spaces.
Carl Banks

Mar 2 '06 #2
Carl Banks wrote:
John Salerno wrote:
So I'm wondering, how do you all handle moving around in your code in
cases like this? Is there some sort of consistency to these things that
you can write rules for your text editor to know when to outdent? It
doesn't seem like you can do this reliably, though.


Emacs, at least, outdents reliably with spaces. Probably some other
editors do as well, though I was kind of surprised to find out that
some editors have (compared to Emacs) weak indent inference.

If editing with spaces annoys you, it might be possible with your
editor (which seems to have a variable tab stop) to edit the file with
tabs, but save it with spaces.
Carl Banks


I use UltraEdit right now, and it is possible to convert spaces and tabs
back and forth, but it's just an extra step. I was thinking about trying
vim, as I've heard it's easier to learn than emacs.
Mar 2 '06 #3

John Salerno wrote:
Carl Banks wrote:
John Salerno wrote:
So I'm wondering, how do you all handle moving around in your code in
cases like this? Is there some sort of consistency to these things that
you can write rules for your text editor to know when to outdent? It
doesn't seem like you can do this reliably, though.


Emacs, at least, outdents reliably with spaces. Probably some other
editors do as well, though I was kind of surprised to find out that
some editors have (compared to Emacs) weak indent inference.

If editing with spaces annoys you, it might be possible with your
editor (which seems to have a variable tab stop) to edit the file with
tabs, but save it with spaces.


I use UltraEdit right now, and it is possible to convert spaces and tabs
back and forth, but it's just an extra step. I was thinking about trying
vim, as I've heard it's easier to learn than emacs.


Well, they don't call vi the "Very Intuitive" editor for nothing. I
suspect if you're not used to the modes and movement keys and stuff
it'll be a little steep learning at first. More power to you if you
can get used to that.

You wouldn't know if Ultraedit has some kind of hook mechanism (whereby
it can execute a macro or script or something upon loading/saving).
That could solve your problem. Obviously, having to manually convert
isn't too helpful.

Carl Banks

Mar 2 '06 #4
John Salerno wrote:
But I read in the PEP that spaces are recommended over tabs. If this is


If you like tabs, stick with tabs. There isn't any reason to use spaces
unless your boss is demanding it. Tabs are the slightly better choice,
in my humble opinion.

That said, you should be able to tell your editor how to behave in the
indent/unindent case, no matter whether you use tabs or spaces. If not,
time to switch editors! ;)

--
Paul
Mar 2 '06 #5
Carl Banks wrote:
You wouldn't know if Ultraedit has some kind of hook mechanism (whereby
it can execute a macro or script or something upon loading/saving).
That could solve your problem. Obviously, having to manually convert
isn't too helpful.


I'll have to check on that. I know I can do macros and such, but I'll
have to see about having it done automatically.
Mar 2 '06 #6
Paul McNett wrote:
That said, you should be able to tell your editor how to behave in the
indent/unindent case, no matter whether you use tabs or spaces. If not,
time to switch editors! ;)


I definitely can, I'm just a little unsure about what the special
outdenting cases might be. The way to do it in UltraEdit is to specify
which characters (on a preceding line) an outdented line should follow,
so obviously for a C language you could specify Unindent = '}' and that
would help a lot. But with Python it seems more difficult to figure out
the cases where you would outdent.

Mar 2 '06 #7
John Salerno wrote:
I use UltraEdit right now, and it is possible to convert spaces and tabs
back and forth, but it's just an extra step. I was thinking about trying
vim, as I've heard it's easier to learn than emacs.

Absolutely. It's also easier to learn to ride a Huffy than a Schwinn,
Hondas are easier to drive than Toyotas, and Evian is easier to drink
than Poland Spring.

Do yourself a favor and learn them both. Then decide which is best for you.

Bill
Mar 2 '06 #8
Bill Scherer wrote:
John Salerno wrote:
I use UltraEdit right now, and it is possible to convert spaces and
tabs back and forth, but it's just an extra step. I was thinking about
trying vim, as I've heard it's easier to learn than emacs.

Absolutely. It's also easier to learn to ride a Huffy than a Schwinn,
Hondas are easier to drive than Toyotas, and Evian is easier to drink
than Poland Spring.

Do yourself a favor and learn them both. Then decide which is best for you.

Bill


Point taken. I like to just pick something and go with it, but sometimes
I just need to experiment first.
Mar 2 '06 #9
On Thu, 02 Mar 2006 18:39:55 GMT
John Salerno <jo******@NOSPA Mgmail.com> wrote:
But I read in the PEP that spaces are recommended over tabs. If this is
the case, it would involve pressing backspace 4 times (or 8, etc.) to
get back to column 1.

So I'm wondering, how do you all handle moving around in your code in
cases like this? Is there some sort of consistency to these things that
you can write rules for your text editor to know when to outdent? It
doesn't seem like you can do this reliably, though.


I use Vim, use spaces, and have no problems. It has a shorttabstop
option, which causes backspace to backspace to the preceding multiple
of <tabwith> spaces when the curser is after a set of spaces at the
beginning of the line. It feels like I'm using tabs, but I'm not.

Also, there's some Python indenting/folding macros I picked up from Vim
Online (don't remember where exactly), that provide an indent/outdent
pair of key mappings, which also work perfectly with my usage of 4
spaces.

- Michael

--
mouse, n: a device for pointing at the xterm in which you want to type.
-- Fortune
Mar 2 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
10400
by: ajikoe | last post by:
Hello, I use windows notepad editor to write text. For example I write (in d:\myfile.txt): Helo World If I open it with python: FName = open(d:\myfile.txt,'r')
2
2424
by: Roger | last post by:
I'm trying to build a controls editor, that given a control (textbox) somewhere on a form, it can be moved using the mouse to drag-drop I have a simple form with a square text box (1" x 1") and 2 info text boxes (txtX and txtY) the square text box has this mouse move event Dim p As POINTAPI
3
2126
by: Jan E Andersen | last post by:
Is there an option for this It woul certainly make debugging much easier JE
2
1231
by: Brian Henry | last post by:
Is there any way to turn off that annoying line that breaks apart methods in the VS.NET text editor? I know you can turn off other things on the text editor, but I can not figure out how to turn that line off... it keeps hideing underscores that I can't see...
4
2429
by: David Beoulve | last post by:
Stupid question... but thanks to Jon's page here: http://www.yoda.arachsys.com/csharp/complete.html I now find myself having a good reason to keep my code lines shorter (which i tend to do for my own sake, but not unilaterally). In Ultraedit and PSPad, I can create a vertical line that shows me where the 80th (or whatever) column is. Any such mojo in the .NET editor?
1
3290
by: carlg | last post by:
There seem to be plenty of Javascript implemented WYSIWYG editors for editing rich text in a web browser, but I haven't been able to find one that shows line numbers. Even if that was the only enhancement over the standard textarea object it would be great for my needs. Does anyone know of such a widget? Thanks, -Carl Gundel, author of Liberty BASIC
9
9382
by: Peter Hartlén | last post by:
I understand that the\n and \r only means something to the C# compiler so when retrieving a line like "Hello\r\nWorld" from a resource file (localized form or self made resource file), it prints the text as just like it was written. Is there any easy way to introduce a newline (tab etc.) into a string retrieved from a resource file? Or should I create a resource string for each line? Thanks,
4
2701
by: MartinRinehart | last post by:
Thinking about unclosed multi-line quotes. When you open a multi-line quote (type '"""') what does your editor do? Does it color the remainder of your text as a quote, or does it color the line with the open quote as a quote and leave the rest of your code alone? What do you want it to do? This is a tokenizer question in disguise, of course. The simple way to
2
2134
by: noe1818 via AccessMonster.com | last post by:
Can anyone tell my why this isn't working? Me!.top=(1440/2.54)*16.78-*0.4) I want it so that for every 1 change in , a rectangular box moves 0.4 units closer to the top. The 1440/2.54 changes the pixel measurment into cm then the box is moved to a specific starting point when it is multiplied by 16.78.
0
8842
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8740
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8516
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8617
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5642
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4173
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4330
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2743
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1733
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.