auto-indent

How to auto format code indentations in VS2012? [closed]

混江龙づ霸主 提交于 2019-12-03 13:33:40
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 6 years ago . How to auto format code in VS2012 to save time typing and deleting spaces and tabs? 回答1: If you are looking to format the code as you enter the text, there are some additional settings in Tools\Options\Text Editor area. Since your example appears to be a config file (XML) look at the XML editor. Otherwise, to

Javascript indentation in VIM

独自空忆成欢 提交于 2019-12-03 08:58:36
问题 I'm trying to get VIM to indent Javascript with the '=' and related commands. When I try to auto indent the following, for example: new function($) { $.fn.setCursorPosition = function(pos) { if ($(this).setSelectionRange) { $(this).setSelectionRange(pos, pos); } else if ($(this).createTextRange) { var range = $(this).createTextRange(); range.collapse(true); range.moveEnd('character', pos); range.moveStart('character', pos); range.select(); } The result is the rather absurd: new function($) {

Brackets.io: Is there a way to auto indent / format <html>

怎甘沉沦 提交于 2019-12-03 08:06:28
问题 I am new to Brackets.io and thought I saw a shortcut key to auto indent/format HTML, however I cannot find a shortcut. Is there a shortcut or add-on that will do this for me? 回答1: I found an add-on for Brackets.io that uses auto-indent called Indentator. It uses shortcut keys Ctrl + Alt + I 回答2: You can install an indentator package. Click on File > Extension Manager... . Look for the search field and type: Indentator > Install Once Indentator is installed, you can use Ctrl + Alt + I 回答3:

Javascript indentation in VIM

天涯浪子 提交于 2019-12-02 23:02:33
I'm trying to get VIM to indent Javascript with the '=' and related commands. When I try to auto indent the following, for example: new function($) { $.fn.setCursorPosition = function(pos) { if ($(this).setSelectionRange) { $(this).setSelectionRange(pos, pos); } else if ($(this).createTextRange) { var range = $(this).createTextRange(); range.collapse(true); range.moveEnd('character', pos); range.moveStart('character', pos); range.select(); } The result is the rather absurd: new function($) { $.fn.setCursorPosition = function(pos) { if ($(this).setSelectionRange) { $(this).setSelectionRange(pos

Brackets.io: Is there a way to auto indent / format <html>

谁都会走 提交于 2019-12-02 21:40:08
I am new to Brackets.io and thought I saw a shortcut key to auto indent/format HTML, however I cannot find a shortcut. Is there a shortcut or add-on that will do this for me? Zac Smith I found an add-on for Brackets.io that uses auto-indent called Indentator. It uses shortcut keys Ctrl + Alt + I You can install an indentator package. Click on File > Extension Manager... . Look for the search field and type: Indentator > Install Once Indentator is installed, you can use Ctrl + Alt + I Beautify does a good job. It provides a "Beautify on save" option, so that you may use ctrl+s to reformate html

How to get auto indent (not smart indent) in emacs in all modes

◇◆丶佛笑我妖孽 提交于 2019-11-30 09:22:42
I'm new to emacs, and its indenting is driving me up the walls. It's too smart for its own good; it (incorrectly) thinks it knows how I want to format my source, but I don't have time to chase down every setting for every mode for every different language that I write code for; and many of those languages don't have any mode enabled at all. Here's the behaviour I'd like: TAB inserts indent RET inserts a new line then copies the blank characters from the start of the previous line to the first non-blank character, or end of line, whichever comes sooner DEL (backspace key) in the blank text

Vim: How to indent to an open paren or bracket when hitting enter?

巧了我就是萌 提交于 2019-11-30 09:02:13
I've been programming Python with Vim for a while but one thing I haven't been able to figure out how to do it set it to auto indent to the level of the last open paren. According to pep8 if you have an open paren and you need to break the line to fit in 80 columns then you're supposed to continue the next line at that open paren. Example: calling_some_really_long_function(that, has, way, too, many, arguments, to, fit, on, one, line) Obviously this is a crazy example, but that's how you're supposed to break your lines in python. What I'd really like to be able to do is set up Vim so that when

Disable auto indent globally in Emacs

℡╲_俬逩灬. 提交于 2019-11-30 08:10:03
问题 How to disable auto indent in Emacs globally or only for some modes? I have a number of packages installed for RubyOnRails (ruby, html, js, css). Let's say I want to disable autoindent for css-mode. 回答1: You may want to look for variable names containing the word electric . (This is the common Emacs parlance for actions which occur automatically when particular visible characters are typed.) In this instance, M-x apropos-variable RET electric RET shows me that there is a css-electric-keys

How to avoid namespace content indentation in vim?

跟風遠走 提交于 2019-11-29 23:55:41
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. 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 a normal block. (default 0). cino= cino=N-s namespace { namespace { void function(); void function(); } }

Notepad++: disable auto-indent after empty lines

*爱你&永不变心* 提交于 2019-11-29 23:38:25
I find the autoindent style of Notepad++ a little weird: when I am typing on an indented line, I do want it to indent the next line after I press Enter (this it does properly). However, when I am on an empty line (no indentation, no characters) and I press Enter, it indents the next line, using the same indentation as the last non-empty line. I find this extremely annoying; have you ever encountered this problem and do you know how to fix it? (Note: I'm editing HTML/PHP files.) (Also, suggestions of other good free editors for HTML/PHP are welcome, in case there is no way of changing this