indentation

Emacs ruby-mode indentation behavior

久未见 提交于 2019-11-28 21:27:49
class Foo attr_accessor :a, :time, # ms since epoch :b, :c end In text mode, the variables listed after 'a' would indent as written above, but in ruby mode they would instead be flush with 'attr_accessor'. How can I get ruby mode to indent like text mode in this situation? Note that I'd like to be able to select the whole file and hit c-m-\ to get the above indentation in addition to all the other ruby-mode.el indentation rules. This hack should work in the majority of cases. (defadvice ruby-indent-line (after line-up-args activate) (let (indent prev-indent arg-indent) (save-excursion (back-to

How to avoid namespace content indentation in vim?

纵饮孤独 提交于 2019-11-28 20:59:06
问题 How to set vim to not indent namespace content in C++? namespace < identifier > { < statement_list > // Unwanted indentation } Surprisingly, 'cinoptions' doesn't provide a way to edit namespace content indentation. 回答1: Not sure when it was introduced but my installed version of vim, v7.3.353 has a cino option that handles cpp namespace explicitly. I am currently using the example value: cino=N-s and as per :help cinoptions-values NN Indent inside C++ namespace N characters extra compared to

Is there any way to make Visual Studio stop indenting namespaces?

雨燕双飞 提交于 2019-11-28 18:31:25
Visual Studio keeps trying to indent the code inside namespaces. For example: namespace Foo { void Bar(); void Bar() { } } Now, if I un-indent it manually then it stays that way. But unfortunately if I add something right before void Bar(); - such as a comment - VS will keep trying to indent it. This is so annoying that basically because of this only reason I almost never use namespaces in C++. I can't understand why it tries to indent them (what's the point in indenting 1 or even 5 tabs the whole file ?), or how to make it stop. Is there a way to stop this behavior? A config option, an add-in

Does Python have a built-in function for unindenting a multiline string?

扶醉桌前 提交于 2019-11-28 18:10:22
Say I have the string s = """ Controller = require 'controller' class foo view: 'baz' class: 'bar' constructor: -> Controller.mix @ """ Every line in the string now has a global 4 space indentation. If this string was declared inside a function, it would have a 8 space global indentation, etc. Does Python have a function for removing the global left indentation of string? I would like that function output to be: Controller = require 'controller' class foo view: 'baz' class: 'bar' constructor: -> Controller.mix @" Not a built-in function, but a function in the standard library: textwrap.dedent(

How to I configure emacs in java mode so that it doesn't automatically align method parameters

霸气de小男生 提交于 2019-11-28 17:09:35
问题 In emacs, when I type: public void foo(String one, String two) { It tabifies like this: public void foo(String one, String two) { I'd rather it didn't, and just aligned parameters like other line continuations. How can I configure it not to do this? 回答1: This comes from the Info manual for Emacs CC Mode, using GNU Emacs 23.1 on Windows: Start building your Java class that's not indenting properly. In your case, exactly what you've typed above. Move your cursor to the start of the line that's

Emacs cc-mode indentation problem with C++0x enum class

*爱你&永不变心* 提交于 2019-11-28 17:00:36
Emacs cc-mode does not appear to yet recognize the type-safe enum class introduced in C++0x. The result I get is a double indentation for second, third, etc enums: enum class Color { Blue, Red, Orange, Green }; What I would like is: enum class Color { Blue, Red, Orange, Green }; Can you recommend a good command to add to .emacs which will make cc-mode treat enum class the same way it treats the plain old enum ? This is the problem: cc-mode relies somewhat on the assumption that keywords are single words. Adding support for enum_class instead of enum class would just be a matter of changing a

How to correct indentation in IntelliJ

↘锁芯ラ 提交于 2019-11-28 16:26:35
How can indentation be automatically (not manually) corrected in IntelliJ? In Eclipse, it's possible to just highlight the code that needs indenting, right-click, and select Source > Correct indentation . Is there any method for doing the same thing in IntelliJ? CrazyCoder Code → Reformat Code... (default Ctrl + Alt + L ) for the whole file or Code → Auto-Indent Lines (default Ctrl + Alt + I ) for the current line or selection. You can customise the settings for how code is auto-formatted under File → Settings → Editor → Code Style . To ensure comments are also indented to the same level as

SQL Statement indentation good practice [closed]

ぐ巨炮叔叔 提交于 2019-11-28 16:18:04
What is the accepted practice for indenting SQL statements? For example, consider the following SQL statement: SELECT column1, column2 FROM table1 WHERE column3 IN ( SELECT TOP(1) column4 FROM table2 INNER JOIN table3 ON table2.column1 = table3.column1 ) How should this be indented? Many thanks. SELECT column1 , column2 FROM table1 WHERE column3 IN ( SELECT TOP(1) column4 FROM table2 INNER JOIN table3 ON table2.column1 = table3.column1 ) I like to have all "," in front , this way I never search them when an error at line X from the SQL editor. This is an example for those who do not use this

How to indent the fluent interface pattern “correctly” with eclipse?

我是研究僧i 提交于 2019-11-28 16:11:16
I just created a generator for some fluent interfaces. Now I have lots of code looking like this: new MyFluentInterface() .setFirst( "first" ) .setSecond( "second" ) .setThird( "third" ) .invoke( obj ); I like the indentation shown above, but I can't find a way to configure eclipse to indent this correctly. eclipse always indents like this: new MyFluentInterface() .setFirst( "first" ) .setSecond( "second" ) .setThird( "third" ) .invoke( obj ); How can I configure eclipse so that it indents this fluent interface pattern as shown in my first code example? With Eclipse 3.6, this seems doable by

Indent starting from the second line of a paragraph with CSS

血红的双手。 提交于 2019-11-28 16:02:33
How can I indent starting from the second line of a paragraph? I've tried p { text-indent: 200px; } p:first-line { text-indent: 0; } and p { margin-left: 200px; } p:first-line { margin-left: 0; } and (with position:relative;) p { left: 200px; } p:first-line { left: 0; } Is it literally just the second line you want to indent, or is it from the second line (ie. a hanging indent )? If it is the latter, something along the lines of this JSFiddle would be appropriate. HTML <div>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna