indentation

How do I have bash “eat” indentation characters common to all lines in a string?

六月ゝ 毕业季﹏ 提交于 2019-12-10 23:36:05
问题 I have some multi-line string in a shell variable. All lines of the string have an unknown indentation level of at least a few white-space characters (8 spaces in my example, but can be arbitrary). Let's look at this example string for instance: I am at the root indentation level (8 spaces). I am at the root indentation level, too. I am one level deeper Am too I am at the root again I am even two levels deeper three two one common common What I want is a Bash function or command to strip away

UITableView with text that is both right-aligned and indented

喜夏-厌秋 提交于 2019-12-10 23:18:01
问题 I wanted to make a UITableView with text that is both right-aligned and indented as depicted in the image below: Unfortunately, I can not do this by writing :- cell.textLabel.textAlignment = UITextAlignmentRight; cell.indentationLevel = 10; // or even -10 Can this be done using UITableView 's properties? If not, the only way I could think of is using [myString drawInRect:withFont:]; but I would like to go through methods based on alignment and indentation before getting into that [I have

How to turn off Pydev indentation warnings for certain .py files

独自空忆成欢 提交于 2019-12-10 21:26:55
问题 I have some files in my project that are from an external source and that I never edit but sometimes step through. These files use a different indentation style from my default one (2 spaces vs. 4 spaces), and I currently many indentation warnings on them. Is there an easy way to suppress these warnings (or alternatively, specify an indentation style) on a file by file basis? I would expect to be able to solve my problem with the equivalent of a pragma line that I add at the top of the file

How To Remove Indents From Code?

天涯浪子 提交于 2019-12-10 21:24:56
问题 Lets consider this example of code... Don't look at code, but at indents. protected function _hashPassword( $password, $salt, $nuts = '' ) { if ( $nuts === '' ) { $nuts = Kohana::config( 'a11n' )->nuts; } $password = sha1( $password . $salt . $nuts ); return $password; } It's taken from much bigger source code. As you can see, it's indented by 2 tabs. I want to somehow remove indent from it without using typing. Somehow. If I use in-editor build-in 'Replace' function and remove those two tabs

Funky indentation in SML mode

拈花ヽ惹草 提交于 2019-12-10 18:32:46
问题 I installed SML Mode in Emacs and the indentation is messed up. I disabled all my .emacs customizations, but that didn't make any difference. At the end of each line in the code below, I used C-j , which is mapped to newline-and-indent . If I highlight everything and reindent ( C-M-\ ), the result makes more sense: I'm using Emacs 24.1.1 and SML Mode 6.2 on Ubuntu 12.10. What should I do? 回答1: Don't use newline-and-indent . You can use reindent-then-new-and-indent or electric-indent-mode

Operator on do indentation

耗尽温柔 提交于 2019-12-10 18:24:28
问题 hindent changed my code to: do download i inputFile onException (callProcess (List.head args) (List.tail args)) (removeFileIfExists name) `finally` removeFileIfExists inputFile I can't determine if the finally applies to the rest of the do block, or just the state beginning onException . According to this, If you see something unexpected in a list, like where, insert a closing brace before instead of a semicolon. I'm unsure if that rule is applying here. Does the `finally` apply to the rest

Convert Multiple Spaces to   At Beginning of Line with Javascript

空扰寡人 提交于 2019-12-10 17:52:00
问题 I'm working on a text input for the backend of a website. I want a couple things to be automatically corrected. Example, new lines in the textarea I convert to <br> . I also want to let the user tab over on new lines. This requires changing spaces over to   . I only want to convert spaces that are at the start of a new line though. Example, say the user types this into a textarea: This is my text! It's pretty great. This is a second line. This is a third line, that is indented by four spaces.

How to higlight tabs in Emacs

妖精的绣舞 提交于 2019-12-10 16:49:32
问题 I use spaces for indentation in source code, how can I higlight/mark tabs, that are in code? It could be red, the same as when I use (setq-default show-trailing-whitespace t) 回答1: Just use command toggle-highlight-tabs from library highlight-chars.el. Or you can turn on tab highlighting by default by adding function hc-highlight-tabs to font-lock-mode-hook in your init file: (add-hook 'font-lock-mode-hook 'hc-highlight-tabs) You can turn on/off the highlighting provided by library Highlight

How to wrap and indent long lines when using print()?

巧了我就是萌 提交于 2019-12-10 15:44:42
问题 I'm using Python to gather data from a Web service. The data itself is a list that will presented to users. I've managed it that it's printed out like: ( 1) Example of strings ( 2) Example 4 ( 3) Another Example ( 4) Another Example 2 I'm using rjust (2) for the numbers. However, if the lines are very long, the printing will be like. The breaking width is the length of terminal (rxvt, gnome-terminal): ( 1) Example of a very very very very long string and that doesn't look fine ( 2) Example of

Tidy html code based on javascript

非 Y 不嫁゛ 提交于 2019-12-10 15:23:40
问题 I am writing a javascript function which can tidy up html code. (javascript and css code tidying not necessary in the moment) Here is my code. And check it on http://jsfiddle.net/2q26K/ function tidyHtml(html) { var html = html.trim().replace(/>[^<]+</gm, function ($1) { return '>' + $1.substr(1, $1.length - 2).trim() + '<'; }).replace(/>\s+</gm, '><'); var containerElement = document.createElement('div'); containerElement.innerHTML = html; var result = containerElement.innerHTML; var