auto-indent

How to auto-indent code in the Atom editor?

本小妞迷上赌 提交于 2019-11-28 14:57:33
How do you auto-indent your code in the Atom editor? In other editors you can usually select some code and auto-indent it. Is there a keyboard shortcut as well? Nacho L. I found the option in the menu, under Edit > Lines > Auto Indent. It doesn't seem to have a default keymap bound. You could try to add a key mapping (Atom > Open Your Keymap [on Windows: File > Settings > Keybindings > "your keymap file"]) like this one: 'atom-text-editor': 'cmd-alt-l': 'editor:auto-indent' It worked for me :) For Windows: 'atom-text-editor': 'ctrl-alt-l': 'editor:auto-indent' The accepted answer works, but

Automatic indentation for Python in Notepad++

耗尽温柔 提交于 2019-11-27 17:24:30
问题 I've been googling lots and this is getting really frustrating. It doesn't act like idle. Example: else: name = 'World' print 'Howdy', name print 'yay' but in Notepad++ else: # i press enter and this is what it does lands me here But I want to be able to do like in idle: after the : I can just press enter and keep on going. My English isn't that great. I have my filetype set to Python etc. and my format to unix. 回答1: This is what you want: Settings > Preferences > MISC. > Auto-Indent

How do I change the autoindent to 2 space in IPython notebook

房东的猫 提交于 2019-11-27 10:20:15
问题 I find that developing functions in IPython notebook allows me to work quickly. When I'm happy with the results I copy-paste to a file. The autoindent is 4 spaces, but the coding style for indentation at my company is 2 spaces. How do I change the autoindent to 2 spaces? 回答1: Based on this question and the options found here: In your custom.js file (location depends on your OS) put IPython.Cell.options_default.cm_config.indentUnit = 2; On my machine the file is located in ~/.ipython/profile

Difference between Ctrl+Shift+F and Ctrl+I in Eclipse

允我心安 提交于 2019-11-27 09:20:58
问题 I have been used Ctrl + Shift + F to correct indentation but I heard there is another shortcut to do that: Ctrl + I According a reference found in google, Ctrl + Shift + F is Reformat and Ctrl + I is Correct indentation. Is there any difference between them? or between Reformat and Correct indentation? 回答1: If you press CTRL + I it will just format tabs/whitespaces in code and pressing CTRL + SHIFT + F format all code that is format tabs/whitespaces and also divide code lines in a way that it

Custom Brace formatting with Resharper

二次信任 提交于 2019-11-27 06:08:24
I'm using Resharper 4.5 and I need custom formatting of braces when writing an array or object initializer. Resharper supports some styles: Gnu Style: int[] array = new int[] { 1, 2, 3 } but I need: int[] array = new int[] { 1, 2, 3 } Is there any way to customize this templates? You can customize ReSharper to do just that, you'll need to do the following (All in ReSharper -> Options -> C# -> Formatting Style ): In Braces Layout , set Array and object initializer to At Next line (BSD Style) . In Other , make sure that Continuous line indent multiplier is set to 1 . In Other , make sure that

How to fix/convert space indentation in Sublime Text?

只谈情不闲聊 提交于 2019-11-27 05:45:12
Example: If I have a document with 2 space indentation, and I want it to have 4 space indentation, how do I automatically convert it by using the Sublime Text editor? Here's a neat trick in Sublime Text 2 or 3 to convert your indentation spacing in a document. TL;DR: Converting from 2 spaces to 4 spaces: Ensure tab width is set to 2. Convert your 2-space indentation to tabs, switch to tab width 4, and then convert the indentation back to spaces. The detailed description: Go to: View -> Indentation It should read: Indent using spaces [x] Tab width: 2 Select: Convert Indentation to Tabs Then

How to auto-indent code in the Atom editor?

依然范特西╮ 提交于 2019-11-27 04:58:53
问题 How do you auto-indent your code in the Atom editor? In other editors you can usually select some code and auto-indent it. Is there a keyboard shortcut as well? 回答1: I found the option in the menu, under Edit > Lines > Auto Indent. It doesn't seem to have a default keymap bound. You could try to add a key mapping (Atom > Open Your Keymap [on Windows: File > Settings > Keybindings > "your keymap file"]) like this one: 'atom-text-editor': 'cmd-alt-l': 'editor:auto-indent' It worked for me :)

Tab key == 4 spaces and auto-indent after curly braces in Vim

吃可爱长大的小学妹 提交于 2019-11-26 21:11:54
How do I make vi - Vim never use tabs (converting spaces to tabs, bad!), makes the tab key == 4 spaces, and automatically indent code after curly brace blocks like Emacs does? Also, how do I save these settings so I never have to input them again? I've seen other questions related to this, but it always seems to be a little off from what I want. Ken As has been pointed out in a couple of answers below, the preferred method now is NOT to use smartindent, but instead use the following (in your .vimrc ): filetype plugin indent on " show existing tab with 4 spaces width set tabstop=4 " when

How to fix/convert space indentation in Sublime Text?

强颜欢笑 提交于 2019-11-26 12:49:10
问题 Example: If I have a document with 2 space indentation, and I want it to have 4 space indentation, how do I automatically convert it by using the Sublime Text editor? 回答1: Here's a neat trick in Sublime Text 2 or 3 to convert your indentation spacing in a document. TL;DR: Converting from 2 spaces to 4 spaces: Ensure tab width is set to 2. Convert your 2-space indentation to tabs, switch to tab width 4, and then convert the indentation back to spaces. The detailed description: Go to: View ->

Custom Brace formatting with Resharper

随声附和 提交于 2019-11-26 11:53:50
问题 I\'m using Resharper 4.5 and I need custom formatting of braces when writing an array or object initializer. Resharper supports some styles: Gnu Style: int[] array = new int[] { 1, 2, 3 } but I need: int[] array = new int[] { 1, 2, 3 } Is there any way to customize this templates? 回答1: You can customize ReSharper to do just that, you'll need to do the following (All in ReSharper -> Options -> C# -> Formatting Style ): In Braces Layout , set Array and object initializer to At Next line (BSD