如何在文本编辑器中移动到新行? [英] how do you move to a new line in your text editor?

查看:82
本文介绍了如何在文本编辑器中移动到新行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是一个非常小的问题,但我想听听其他人在这个案件中所做的事情。它更像是一个''管理''类型问题而不是Python代码

问题,但它仍然涉及一些语法。


我有一件事我要做的就是使用制表符进行缩进,因为当我需要在第1列中开始一个新行时,这个

可以很容易地突然出现。我可以按退格键一次并向左移动4个空格。


但是我在PEP中读到了建议空格超过标签。如果这是

的情况,它将涉及按退格4次(或8等)到

返回第1列。

所以我想知道,你们如何处理你们的代码中的这些?b $ b这样的情况?这些东西是否存在某种一致性?

您可以为文本编辑器编写规则以了解何时出现问题?但是,b $ b看起来你似乎无法可靠地做到这一点。

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.

推荐答案

John Salerno写道:
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,至少是可靠的空间。可能还有一些其他的b $ b编辑也会这样做,虽然我有点惊讶地发现一些编辑有些(与Emacs相比)弱缩进推理。


如果使用空格进行编辑会让您烦恼,可以使用

编辑器(似乎有一个变量制表位)来编辑文件

标签,但用空格保存。

Carl Banks



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


Carl Banks写道:
Carl Banks wrote:
John Salerno写道:
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可靠地使用空格。可能还有一些其他的编辑也这么做,虽然我有点惊讶地发现有些编辑(与Emacs相比)弱缩进推理。

如果用空格编辑惹恼你,你的
编辑器(似乎有一个变量制表位)可以用
标签编辑文件,但用空格保存。

Carl银行



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




我现在使用UltraEdit,可以来回转换空格和标签

,但它只是额外的一步。我正在考虑尝试使用

vim,因为我听说它比emacs更容易学习。



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.




John Salerno写道:

John Salerno wrote:
Carl Banks写道:
Carl Banks wrote:
John Salerno写道:
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可靠地使用空格。可能还有一些其他的编辑也这么做,虽然我有点惊讶地发现有些编辑(与Emacs相比)弱缩进推理。

如果用空格编辑惹恼你,你的
编辑器(似乎有一个变量制表位)可以用
标签编辑文件,但用空格保存。



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.



我现在使用UltraEdit,可以来回转换空格和制表符,但这只是一个额外的步骤。我正在考虑尝试使用
vim,因为我听说它比emacs更容易学习。



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.




嗯,他们不是称vi为非常直观编辑什么都没有。我怀疑如果你不习惯模式和运动键和东西

它起初会有点陡峭的学习。如果你能获得更多的权力,那么
可以适应这种情况。


你不会知道Ultraedit是否有某种钩子机制(由此

它可以在加载/保存时执行宏或脚本等。

这可以解决您的问题。显然,必须手动转换

并不是太有用。


Carl Banks



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

这篇关于如何在文本编辑器中移动到新行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆