Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Notepad++ keeping spaces in indent

When pressing enter in Notepad++ to create a new line, is it possible to obtain the exact indentation of the previous line for the new line? No matter what I've tried, Notepad++ will always replace as many spaces as possible with tabs.

As an example, say I have the following (---> is a tab, . is a space, | is the cursor):

--->--->a_very_long_variable_name = another_long_name
--->--->..........................+ yet_another_variable|;

Lets say I want to add a third operand on a new line. After pressing Enter, I would expect the following:

--->--->a_very_long_variable_name = another_long_name
--->--->..........................+ yet_another_variable
--->--->..........................|;

Unfortunately, what Notepad++ actually produces is this:

--->--->a_very_long_variable_name = another_long_name
--->--->..........................+ yet_another_variable
--->--->--->--->--->--->--->--->..|;

Does anyone know of a setting or plugin that can be used to get an exact copy of the indentation, rather than replacing spaces by tabs?

It would also be nice if block indenting/unindenting would only affect the number of leading tabs, rather than again changing spaces to tabs.

like image 920
zennehoy Avatar asked Dec 20 '12 13:12

zennehoy


1 Answers

I came across this question looking for something similar (working on multiple projects with different indentation styles), and thought I'd provide an answer for anyone else stumbling across this.

There's a nice plugin which makes Notepad++ keep indentation without doing any conversion, "TabIndentSpaceAlign": http://code.google.com/p/kereds-notepad-plus-plus-plugins/

Also available from the Notepad++ Plugin manager. Don't forget to enable the plugin after installing it! (see Plugins menu)

like image 65
zinga Avatar answered Nov 05 '22 16:11

zinga