indentation

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

Emacs - override indentation

怎甘沉沦 提交于 2019-11-30 06:35:40
I have a multiply nested namespace: namespace first {namespace second {namespace third { // emacs indents three times // I want to intend here } } } so emacs indents to the third position. However I just want a single indentation. Is it possible to accomplish this effect simply? Jürgen Hötzel Use an an absolute indentation column inside namespace: (defconst my-cc-style '("gnu" (c-offsets-alist . ((innamespace . [4]))))) (c-add-style "my-cc-style" my-cc-style) Then use c-set-style to use your own style. Note that this only works in c++-mode , c-mode doesn't know 'innamespace'. With c++-mode in

Is it possible to set indent settings in Xcode per project (or per file, even)?

醉酒当歌 提交于 2019-11-30 06:01:44
Some projects I work in uses tab key settings that equate to 3 or 4 spaces and another wants actual tabs. Another mixes the two depending on directory. Is there some way to set these settings per project, or even better, per file? If not, does someone have a clever way of dealing with this? (besides "just remember which setting you should use and change it before you start editing") Steven Kramer Update: This answer only applies to Xcode3. For newer versions, see James Turner's answer. Yes, go to View > Text > Tab Settings... There you specify the (file-specific) indentation settings which

Text indent after the first line in a paragraph

删除回忆录丶 提交于 2019-11-30 05:35:15
- A Reuters reporter in Surkhrod district in Nangarhar province, where villagers said the raids took place, said Afghan police fired at the crowd after some of them started throwing stones at local government buildings. In the above paragraph, I would like to use CSS to make all lines after the first line to automatically indent some space so that each line stays right after the - in the first line. HTML <p> - A Reuters reporter in Surkhrod district in Nangarhar province, where villagers said the raids took place, said Afghan police fired at the crowd after some of them started throwing stones

Indenting only the first line of text in a paragraph?

白昼怎懂夜的黑 提交于 2019-11-30 04:10:41
I have several paragraphs that I would like to indent, although only the first lines of these paragraphs. How would I target just the first lines using CSS or HTML? Use the text-indent property. p { text-indent: 30px; } jsFiddle . In addition to text-indent, you can use the :first-line selector if you wish to apply additional styles. p:first-line { color:red; } p { text-indent:40px; } http://jsfiddle.net/Madmartigan/d4aCA/1/ Very simple using css: p { text-indent:10px; } Will create an indentation of 10 pixels in every paragraph. I was also having a problem getting the first line of a

Haskell Error: parse error on input `='

﹥>﹥吖頭↗ 提交于 2019-11-30 03:56:57
问题 Specs GHC 6.12.1 Mac OS X 10.6.4 x64 MacBook Pro Problem I'm having trouble using let syntax. The following code refuses to compile: module Main where main = let x = 1 y = 2 z = 3 in putStrLn $ "X = " ++ show x ++ "\nY = " ++ show y ++ "\nZ = " ++ show z I tried tabbing in y = 2 and z = 3 even more. No dice. (Undesirable) Solutions The only way I've gotten the code to compile is either Replacing hard tabs with spaces. Replacing the let clause with a where clause. 回答1: Saizan on #haskell

How do I parse indents and dedents with pyparsing?

為{幸葍}努か 提交于 2019-11-30 02:16:37
Here is a subset of the Python grammar: single_input: NEWLINE | simple_stmt | compound_stmt NEWLINE stmt: simple_stmt | compound_stmt simple_stmt: small_stmt (';' small_stmt)* [';'] NEWLINE small_stmt: pass_stmt pass_stmt: 'pass' compound_stmt: if_stmt if_stmt: 'if' test ':' suite ('elif' test ':' suite)* ['else' ':' suite] suite: simple_stmt | NEWLINE INDENT stmt+ DEDENT (You can read the full grammar in the Python SVN repository: http://svn.python.org/.../Grammar ) I am trying to use this grammar to generate a parser for Python, in Python. What I am having trouble with is how to express the

How to paste source code to vim without error format?

依然范特西╮ 提交于 2019-11-30 01:40:53
When I copy a python code, and paste to vim. the indents are all error. but I paste into emacs or gedit, it is right. that is difficult to describle, let's see the screenshot. Notice:the blue and yellow line is just use the "indent guides plugin". This is the source code example: import threading import time class timer(threading.Thread): #The timer class is derived from the class threading.Thread def __init__(self, num, interval): threading.Thread.__init__(self) self.thread_num = num self.interval = interval self.thread_stop = False def run(self): #Overwrite run() method, put what you want

IndentationError: unexpected unindent WHY?

一笑奈何 提交于 2019-11-30 01:07:04
问题 IndentationError: unexpected unindent WHY??? #!/usr/bin/python import sys class Seq: def __init__(self, id, adnseq, colen): self.id = id self.dna = adnseq self.cdnlen = colen self.prot = "" def __str__(self): return ">%s\n%s\n" % (self.id, self.prot) def translate(self, transtable): self.prot = "" for i in range(0,len(self.dna),self.cdnlen): codon = self.dna[i:i+self.cdnlen] aa = transtable[codon] self.prot += aa def parseCommandOptions(cmdargs): tfname = cmdargs[1] sfname = cmdargs[2] return

Indentation sensitive parser using Parslet in Ruby?

核能气质少年 提交于 2019-11-30 00:48:42
I am attempting to parse a simple indentation sensitive syntax using the Parslet library within Ruby. The following is an example of the syntax I am attempting to parse: level0child0 level0child1 level1child0 level1child1 level2child0 level1child2 The resulting tree would look like so: [ { :identifier => "level0child0", :children => [] }, { :identifier => "level0child1", :children => [ { :identifier => "level1child0", :children => [] }, { :identifier => "level1child1", :children => [ { :identifier => "level2child0", :children => [] } ] }, { :identifier => "level1child2", :children => [] }, ] }