开发者

Does anyone know of a text editor that allows you to indent highlighted chunks of code all at once?

I am extremely OCD when it comes to the layout of my code, and it's a pain to press the down arrow key and Tab a hundred times in a row. Does anyone use a text editor that has the function of indenting chunks of code at the same time? Such as, if I have this:

<div>
    <img src="blahblah" style="float:left" />
    <span>Hey it's a picture.</span>
</div>

<div>
    <img src="somephoto" style="float:right" />
    <span>Another picture</span>
</div>

...then I come back later and want to wrap both divs in another div, but it comes out like this:

<div>
<div>
    <img src="blahblah" style="float:left" />
    <span>Hey it's a picture.</span>
</div>

<div>
    <img src="somephot开发者_运维知识库o" style="float:right" />
    <span>Another picture</span>
</div>
</div>

When I want it to look like this:

<div>
    <div>
        <img src="blahblah" style="float:left" />
        <span>Hey it's a picture.</span>
    </div>

    <div>
        <img src="somephoto" style="float:right" />
        <span>Another picture</span>
    </div>
</div>

Obviously this is a minor example, but when it comes to large files this becomes quite a hassle. I use Bluefish on Ubuntu and Notepad++ on Windows, and neither seem to come with the capability to indent a block of code all at once. What are your thoughts?


Any decent text editor, including Notepad++, can do this.

Select the lines and press Tab.


Yup go with Notepad++, its brilliant. Dont forget Shift + Tab too though, just as useful:)


Any decent text editor will have this functionality implemented into the editor.

They already mentioned Notepad++, but there's also Geany which is available for Windows and Linux (Also has the ability for auto close tags), Droidedit for Android,Smultron for OS X users, and if you love web based apps like myself there's the CodeMirror JavaScript library.

If you want to indent a large selection of code use Tab. If you want to unindent/outdent a large selection of code use SHIFT + Tab.

Becomes very helpful. Also CTRL + F to find text, CTRL + H to replace text (Notepad++ has a replace all function, but Geany does not)

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜