简体   繁体   中英

Editor with support for mixed spaces and tabs?

Is there any text editor (for Windows) which has good support for mixed spaces and tabs, for languages like C++/C#/Java (and bonus points for Python/Ruby/etc.)?
ie Tabs would be used for indentation , and spaces would be used for alignment .


As an example, say represents a tab, . represents a space, and represents the current position of the cursor.

If I have the following in my text editor:

template<class T1,
.........class T2>
class Foo
{
  → template<int M,
  → .........int N>
  → void foo(int bar,■
}

I want to be able to press the ⏎ Enter key, and see:

template<class T1,
.........class T2>
class Foo
{
  → template<int M,
  → .........int N>
  → void foo(int bar,
  → .........■
}

after which I should be able to type the next parameter, close the parenthesis, and press ⏎ Enter , and have the cursor automatically go back to the correct position, using tabs/spaces as shown:

template<class T1,
.........class T2>
class Foo
{
  → template<int M,
  → .........int N>
  → void foo(int bar,
  → .........int baz) {
  →  →  ■
}

Of course, if I pressed Backspace or Shift-Tab or whatever, it should clear to the appropriate stop -- which is probably the beginning of the indent that is of the same type as the current one. And stuff like that.

Note:

I realize that many editors (SciTE, Visual Studio, and probably Emacs, Vim, etc.) can be scripted with regexes (or crude parsing code) to do something that works, oh, 80% of the time.

But I'm looking for something with hopefully a bit more robust support, with lexing support for the current language to figure out what to do. After all, editor mistakes shouldn't be harder to fix than indenting manually in the first place -- otherwise I'd just do it manually instead, and never use the feature!

Not sure if this qualifies to be an answer. However, my gvim with current vimrc does exactly what you are looking for with tabs and spaces. I strongly recommend using Gvim . Its a matter of personal choice, there may be better or worse editors.

You can highlight any language on vim using se syn= command

What you won't find is lexing support or the intelli-sense - at lease in usable ways.

Have a look at the screenshot. Here is a link to vimrc that I have adapted.

EDIT I really suspect if there is an editor utopia so to speak. You may have to strike a balance based on "right tool for the job" principle.

在此处输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM