开发者

How to tell Notepad++ to indent the line exactly like before I press Enter?

开发者 https://www.devze.com 2023-02-16 12:42 出处:网络
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 :

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 fo开发者_Python百科reach() line

    foreach()
    {

    if()
        {
        }
    }

How can I tell Notepad++ to automatically indent code like this?

    foreach()
    {

        if()
        {
        }
    }


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号