indentation

Jade indentation errors

こ雲淡風輕ζ 提交于 2019-12-02 18:53:46
So for my Express site, I'm using jade. So I decided to try modifying my layout file so I can start designing my site. I modified the original layout code (which worked), but I started getting indentation errors in any file that extends layout like this: 500 Error: /home/kevin/Blue/views/layout.jade:6 4| p Hello World Invalid indentation, you can use tabs or spaces but not both 4| p Hello World Invalid indentation, you can use tabs or spaces but not both at Object.Lexer.indent (/home/kevin/Blue/node_modules/jade/lib/lexer.js:679:15) at Object.Lexer.next (/home/kevin/Blue/node_modules/jade/lib

2 Spaces or 1 Tab, what's the standard for indentation in the Rails Community?

依然范特西╮ 提交于 2019-12-02 18:49:56
I've noticed that most of the HTML/XML/HAML that gets generated from plugins uses 2 spaces instead of 1 tab. I use textmate and have tabs set to 4 spaces for HAML/HTML/XML and 2 spaces for Javascript/Ruby, but I only have to press the tab key once to get nice indentation. Pressing the space bar twice and delete twice seems like too much work :p. Do you manually type two spaces, or is some middle layer converting tabs to two spaces? Or do just a few of you use tabs? 2 spaces is generally agreed-upon. As for all the arguments about different editors showing tabs with different widths... It is a

LaTeX: indent from second line

纵饮孤独 提交于 2019-12-02 18:49:42
I want to indent from the second line. I want to write in LaTeX something like this: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin eu tempor velit. Fusce accumsan ultrices fringilla. Praesent sed odio mi. Mauris non ligula turpis. Duis posuere lacus nec diam interdum dictum suscipit magna molestie. Vestibulum nibh dolor, interdum eget rhoncus ut, sodales eget justo. Morbi blandit lorem sit amet nulla egestas aliquam. Nunc pharetra est at nibh ullamcorper in commodo erat dignissim. Cras et suscipit enim. Nunc adipiscing ligula at ligula egestas id ullamcorper felis luctus.

Vim Auto Indent with newline

老子叫甜甜 提交于 2019-12-02 18:46:34
How do I get vim to place the cursor within the braces starting on a new line, ie with | denoting the cursor position : class { | } right now with my settings it only does this class { |} I got this in my .vimrc file set autoindent shiftwidth=2 tabstop=2 noexpandtab Basically I just want how a normal IDE would indent it. update: I found how to do this with inoremap { {<CR>}<Esc>O Put this in your .vimrc : imap <C-Return> <CR><CR><C-o>k<Tab> Assuming autoindent and smartindent are set correctly, typing Ctrl + Return between braces will put your cursor where you want it to be. I found that

If you break long code lines, how do you indent the stuff on the next line?

末鹿安然 提交于 2019-12-02 18:25:31
Sometimes you have to write in your source long lines, that are better to break. How do you indent the stuff ceated by this. You can indent it the same: very long statement; other statement; That makes it harder to differentiate from the following code, as shown in the example. On the other hand you could indent it one level: very long statement; other statement; That makes it easier, but it can happen, that the long line is the start of a nested block, that you want to indent, like this: if ((long test 1) && (long test 2) && (long test 3)) { code executed if true; } In this case again it's

Showing trailing spaces in vim

久未见 提交于 2019-12-02 17:00:40
I've set the following options in .vimrc set listchars=tab:▸\ ,trail:· set list And expected to see dots in those places where spaces are used for tabulation in the code (I use spaces, not tabs). However, the result is different: Could you please recommend how to reach the desired result? Thanks! You should check this link . I'm using the match command solution : :highlight ExtraWhitespace ctermbg=red guibg=red :match ExtraWhitespace /\s\+$/ This page also provides list based solutions which I haven't personally tried. And expected to see dots in those places where spaces are used for

XCode 3.2: Changing the default “Code Sense” indentation and whitespaces

亡梦爱人 提交于 2019-12-02 16:25:31
I'm working with XCode 3.2 (on "Snow Leopard") which (still) has this nice "Text Macro" auto-completion feature (eg. if you type if it will expand to if (<#condition#>) { <#statements#> } ). These macros are also available via "Edit->Insert Text Macro". Unfortunately, the default templates don't match my beloved indentation and whitespace style so I'd like to modify them. According to this slightly outdated StackOverflow thread the corresponding definitions should be located at /Developer/Library/Xcode/Specifications/{C,HTML}.xctxtmacro but I can't find anything there using Snow Leopard and

How to remove tab indent from several lines in IDLE?

无人久伴 提交于 2019-12-02 16:12:45
If you want to indent several lines in Python IDLE you just mark the lines and hit Tab. But what if you want to remove the indent from several lines? Shift+Tab does not work for that in IDLE. If you're using IDLE, and the Norwegian keyboard makes Ctrl-[ a problem, you can change the key. Go Options->Configure IDLE. Click the Keys tab. If necessary, click Save as New Custom Key Set. With your custom key set, find "dedent-region" in the list. Click Get New Keys for Selection. etc I tried putting in shift-Tab and that worked nicely. If you're using IDLE, you can use Ctrl+] to indent and Ctrl+[ to

How can I use tabs for indentation in IntelliJ IDEA?

三世轮回 提交于 2019-12-02 16:02:01
How can I use tabs instead of multiple spaces for indentation in IntelliJ IDEA 11.0? I have "Use tab character" checked under "Code Style" > "General" > "Default Indent Options". And also tried to have "Smart tabs" checked, but it doesn't help. From the documentation : If this check box is selected, tab characters are used: On pressing the Tab key For indentation For code reformatting Otherwise, spaces are used instead of tabs. Paweł Obrok File > Settings > Editor > Code Style > Java > Tabs and Indents > Use tab character Substitute weapon of choice for Java as required. IntelliJ IDEA 15 Only

Can a line of Python code know its indentation nesting level?

可紊 提交于 2019-12-02 14:46:05
From something like this: print(get_indentation_level()) print(get_indentation_level()) print(get_indentation_level()) I would like to get something like this: 1 2 3 Can the code read itself in this way? All I want is the output from the more nested parts of the code to be more nested. In the same way that this makes code easier to read, it would make the output easier to read. Of course I could implement this manually, using e.g. .format() , but what I had in mind was a custom print function which would print(i*' ' + string) where i is the indentation level. This would be a quick way to make