indentation

Changing indentation settings in the Spyder editor for Python

泄露秘密 提交于 2019-11-29 17:47:51
问题 I am using the Spyder editor for Python. I need to change the indentation setting (e.g., let "tab" mean "4 spaces"). How do I accomplish this? 回答1: Tools >>> Preferences >>> Editor >>> Advanced settings >>> Indentation characters 回答2: go to >>>Tools in the menu bar Preferences >>> Editor >>> Advanced settings >>> Indentation characters set indentation characters: to "4 spaces" hurray! Mission accomplished 来源: https://stackoverflow.com/questions/36187784/changing-indentation-settings-in-the

Is there a way to enforce using tabs instead of spaces?

微笑、不失礼 提交于 2019-11-29 16:46:21
问题 StyleCop offers to check for consistent use of spaces, but sadly lacks the opposite idea: Force source code to use tabs. Is there some way to add this functionality? It does not have to be StyleCop, other tools are welcome as well. 回答1: You can use StyleCop+ plugin to enforce usage of tabs. After downloading StyleCopPlus.dll place it in Custom Rules folder inside the main StyleCop folder C:\Program Files (x86)\StyleCop 4.7\Custom Rules or directly in the main folder. Now, when opening a

How can I add auto indentation to UITextView when user type new line?

一世执手 提交于 2019-11-29 15:19:57
How can I add auto indentation to UITextView when user type new line? Example: line1 line2 <user has typed "Enter"> <cursor position> line3 <user has typed "Enter"> <cursor position> Lyndsey Scott Although it seems as if the OP isn't in fact looking for standard indentation in this case, I'm leaving this up for future answer seekers. Here's how you can automatically add an indent after every newline entry. I've adapted this answer from my similar recent answer about automatically adding bullet points at every newline . - (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange

Python: I'm getting an 'indented block' error on the last 3 quotes (“”\") of my comments under functions. What's up?

拜拜、爱过 提交于 2019-11-29 14:51:30
Super odd, no? The offending code: def main(): """ main function """ # Argument handling args = sys.argv[1:] if not args: print "usage is: ... The third quote is where I get the usual indentation error: >>>Import someScript Traceback (most recent call last): File "<stdin>", line 1, in <module> File "someScript.py", line 24 """ ^ If I delete the comments (obviously I don't want to) then the next function to be defined gets the same error, at the same location of its comments. If I delete all comments from functions, the error goes away. I don't understand! Why expect an indent there? I'm

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

天大地大妈咪最大 提交于 2019-11-29 14:05:45
问题 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

Is there a utility to indent C++ programs [closed]

若如初见. 提交于 2019-11-29 11:44:58
问题 I am trying to use "indent" program to indent C++ programs. But it does not seem to work fine. It is messing up the indentation much more. It is a Class file. Can you please suggest the right options for it or another program that works? Thanks 回答1: Try Artistic Style: Artistic Style is a source code indenter, formatter, and beautifier for the C, C++, C# and Java programming languages. 回答2: in visual studio, CTRL + a , CTRL + k , CTRL + f will auto-indent the entire file you're working in.

IOS7 UITableView grouped like in Settings App

安稳与你 提交于 2019-11-29 11:16:34
问题 In IOS7 the UITableView does not have indentation anymore when using style=grouped. How can enable the indentation, so that the UITableView behaves like the settings app from apple? 回答1: There is a much simpler way to achieve this. Place your UITableView away from the sides. eg: using Autolayout you'd have a leading and trailing space of 15px (or whatever you want). You're now creating the 'indentation' that Apple used to give you for free with grouped table views. Adjust the layer to add

Proper indentation in Django templates (without monkey-patching)?

旧街凉风 提交于 2019-11-29 11:07:16
I want to generate human-readable HTML and CSS code (properly indented) preprocessed by the Django template system for my standalone application. I've modified the render method from the NodeList class found in the django.template.base module. My code seems to work properly, but I'm using monkey-patching to replace the old render method. Is there a more elegant way that does not use monkey-patching in this case? Or maybe monkey-patching is the best way here? My code looks like this: ''' This module monkey-patches Django template system to preserve indentation when rendering templates. '''

Emacs version 24.4: New obnoxious loss of indentation on hitting RETURN

ⅰ亾dé卋堺 提交于 2019-11-29 10:30:38
Starting with Emacs 24.4, when I type a line beginning with white space (a typical way to denote a new paragraph) and at the end of it I hit RETURN, the white space disappears. This problem appears also with 'emacs -Q'. My .emacs file uses a rather plain text-mode paragraphing scheme, namely, (setq default-major-mode 'text-mode) (add-hook 'text-mode-hook 'paragraph-indent-minor-mode) which has been working without problems for a dozen years. The bug appeared when I installed the current (24.4) version. Basically, I type: This is a line beginning with four spaces and as soon as I type RETURN my

Git Diff Indent/Pretty Print/Beautify Before Diff

烂漫一生 提交于 2019-11-29 10:12:56
Is there a way to make Git indent /beautify/pretty print two versions of C++ source files before diffing them? I don't want Git to show me the myriads of changes introduced after someone auto-formatted the code. Example usage: I hit git difftool --indent-before-diffing path/to/file and get the changes after both the original version of path/to/file and the modified version of path/to/file have been indented. If you can find an application that does the indenting for you, you could use the method described here for odt files: Add the following line to your .gitattributes file: *.odt diff=odt