indentation

Left indentation of the NSTextView

大兔子大兔子 提交于 2019-12-12 02:42:59
问题 I wrote the following code: NSMutableParagraphStyle *paragraphStyle; double indent = 100 * mm2pt / 10.0; if ( !m_textView ) return; if ( start == -1 && end == -1 ) { if( style.HasLeftIndent() ) { paragraphStyle = [[NSMutableParagraphStyle alloc] init]; [paragraphStyle setHeadIndent: indent]; [paragraphStyle setFirstLineHeadIndent: indent]; [m_textView setDefaultParagraphStyle:paragraphStyle]; [paragraphStyle release]; } } else // Set the attributes just for this range. { NSRange range =

Is there any short cuts for Xcode to tidy up the code?

依然范特西╮ 提交于 2019-12-12 02:42:26
问题 for example, I have something like this: aVarible = 123; bIndex = 234; cSomethingVerylong = 456; And I would like to intent the code like this: aVarible = 123; bIndex = 234; cSomethingVerylong = 456; How can I do so? Thank you. 回答1: You could use uncrustify: http://uncrustify.sourceforge.net/ I don't use it, so I cannot vouch for its quality, but it does claim to do exactly what you suggest in your question. If that's all you want to do, it's probably overkill, but if you want to "tidy" your

Treeview to XML with proper indentation c#

ぐ巨炮叔叔 提交于 2019-12-12 01:55:15
问题 I'm having trouble exporting Treeview to a Xml file with proper indentation, I looked through the forum but could not find anything. Here is a link on how to write Xml to Treeview Recursion, parsing xml file with attributes into treeview c# Here is my code attempting to export treeview to XML public void exportToXml(TreeView tv, string filename) { sr = new StreamWriter(filename, false, System.Text.Encoding.UTF8); //Write the header sr.WriteLine("<?xml version=\"1.0\" encoding=\"utf-8\" ?>");

How to run “gg=G” on several files?

六月ゝ 毕业季﹏ 提交于 2019-12-11 23:46:44
问题 In vim, gg=G does a great job re-indenting your current file and I'd like to do that on several files. I would like to do something like this: files=`find $1 -type f` for file in $files do vim -e -s -n "+gg=G|wq" $file done The problem is that gg=G is not a command (if you type :gg=G in vim, it throws an error), so it doesn't work... 回答1: I think I found it! (of course 10 minutes after I posted the question, even though I searched before for 4 hours) files=`find $1 -type f` for file in $files

VBScript XML indentation with CDATA

喜夏-厌秋 提交于 2019-12-11 17:54:57
问题 I would like to generate a XML file from VBScript. I found Microsoft.XMLDOM but it seems this class does not know how to indent my output file. I tried to use MSXML2 to reindent my xml but when I use it my CDATA sections vanished... VBScript: set xml = CreateObject("Microsoft.XMLDOM") set encoding = xml.createProcessingInstruction("xml", "version='1.0' encoding='ISO-8859-1'") xml.insertBefore encoding, xml.childNodes.Item(0) set foo = xml.createElement("foo") foo.setAttribute "foobar", "42"

What is the recommended layout for splitting ternary operator into multiple lines?

谁说胖子不能爱 提交于 2019-12-11 14:11:34
问题 To improve code readability I need to split my ternary operator expression into multiple lines. My only idea is something like this: very_long_function_name( ... very_long_expression_if_the_condition_is_true if the_condition else another_expression_if_the_condition_is_false) Unfortunately PyCharm claims that continuation line over-indented for visual indent is a violation of PEP8. When I wrap the operator in braces PyCharm raises no objections, but IMHO the code is less readable then. Is

Replace all spaces at the start of the line with tabs

和自甴很熟 提交于 2019-12-11 12:26:43
问题 I would like to replace all spaces at the start of the line with tabs. The below snippet works, but only for the first indentation level. How do I make it work for 1 to ∞ indentation levels? So that it replaces 12 spaces with 3 tabs (assuming a tabstop of 4)? fun! Retab() let l:spaces = repeat(' ', &tabstop) silent! execute '%s/^' . l:spaces . '/\t/g' endfun Note that using :retab doesn't seem to be an option here, since :retab doesn't just change indentation, but also changes all repeat(' ',

Sublime Text isn't indenting properly with HTML

戏子无情 提交于 2019-12-11 10:04:46
问题 Related but not identical question: Sublime Text indentation behavior. I have seen many videos in which after the autocompletion of an HTML tag, pressing enter automatically results in the closing tag appearing two lines, and the cursor being properly indenting on the second line, between the opening and closing tabs. In my situation, the autoindent function in Sublime Text 2 seems to be working poorly. Here is exactly what happens (as can be seen in the below gif). Press tab after writing

inconsistent indentation with Python after split

北慕城南 提交于 2019-12-11 07:43:36
问题 edit in progress will re-submit sometimes later edit in progress will re-submit sometimes later edit in progress will re-submit sometimes later 回答1: That should work: import re #Regex may be the easiest way to split that line with open(infile) as in_f, open(outfile,'w') as out_f: f = (i for i in in_f if i.rstrip()) #iterate over non empty lines for line in f: _, k = line.split('\t', 1) x = re.findall(r'^1..100\t([+-])chr(\d+):(\d+)\.\.(\d+).+$',k) if not x: continue out_f.write(' '.join(x[0])

Indentation of “if” in Ocaml under Emacs

ε祈祈猫儿з 提交于 2019-12-11 06:42:13
问题 I am coding Ocaml with Emacs, at the moment the setting of the indentation of if gives the following: if cond1 then e1 else if cond2 then e2 else if cond3 then e3 else e4 I would like to realize the same format as Caml programming guidelines: if cond1 then e1 else if cond2 then e2 else if cond3 then e3 else e4 Could anyone tell me which parameter is related to that? Thank you Edit1: here is my .emacs 回答1: Something seems to be wrong. Are you using the caml-mode from the OCaml distribution ?