如何告诉记事本++与按 Enter 之前一样缩进该行吗?
我正在使用 Notepad++ 编写 PHP,我发现按 Enter 之前没有相同缩进的方式相当令人不安。假设我有一个像这样的代码块:
foreach()
{
if()
{
}
}
如果我将指针移到 if() 行的开头,然后按 Enter,该行将具有像 foreach() 行一样的缩进
foreach()
{
if()
{
}
}
我如何告诉 Notepad++ 自动缩进这样的代码?
foreach()
{
if()
{
}
}
I'm using Notepad++ to write PHP and I find the way of not having same indent as before pressing Enter is rather disturbing. Let say I have a block of code like this :
foreach()
{
if()
{
}
}
If I move the pointer to the beginning of if() line, and press Enter, this line will have indentation like foreach() line
foreach()
{
if()
{
}
}
How can I tell Notepad++ to automatically indent code like this?
foreach()
{
if()
{
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
按 Home 键,插入符号将在最后一个空格/制表符和字母 i 之间移动。现在,如果您按 Enter,则会生成一个新行,其中 if 语句保持其缩进级别。
如果您使用 Home 键跳转到代码行的开头,您会发现它默认在最后一个缩进空格和第一个非空格字符之间移动插入符号。反复按下该键可在此位置和行的开头之间切换。这比用鼠标指向并单击行的开头要有效得多。
Press the Home key and the caret will be moved between the last space/tab and the letter i. Now if you hit Enter, a new line is produced with the if statement keeping its indentation level.
If you use the Home key to jump to the start of lines of code, you'll find that it defaults to moving the caret between the last indent whitespace and the first non-whitespace character. Pressing the key again and again toggles it between this position and the very start of the line. It's way more efficient than pointing and clicking the start of the line with the mouse.