indentation

C++ access modifier auto indentation in Visual Studio 2010 slowly driving me crazy - can it be changed?

你说的曾经没有我的故事 提交于 2019-11-26 22:04:48
问题 When programming C++ in Visual Studio, it insists on giving me these awful indentations on access modifiers - my condolences if anyone actually likes them this way ;) (a joke folks!) public class MyClass { public: MyClass(); ~MyClass(); int wowAnInt(); } Needless to say, I want this: public class MyClass { public: MyClass(); ~MyClass(); int wowAnInt(); } Is there any way to achieve this using anything (I've got ReSharper and Highlighter) or perhaps vanilla VS? 回答1: The closest you can get

Indentation in generated PDF using JasperReports

孤街浪徒 提交于 2019-11-26 21:50:15
问题 I have a piece of HTML stored in a database as: <ul> <li>Pretend you're talking to a busy colleague and have to sum up your entire question in one sentence: what details can you include that will help someone identify and solve your problem?</li> <li>Spelling, grammar and punctuation are important! Remember, this is the first part of your question others will see - you want to make a good impression. If you're not comfortable writing in English, ask a friend to proof-read it for you. </li>

Grab a line's whitespace/indention with Python

为君一笑 提交于 2019-11-26 21:36:17
问题 Basically, if I have a line of text which starts with indention, what's the best way to grab that indention and put it into a variable in Python? For example, if the line is: \t\tthis line has two tabs of indention Then it would return '\t\t'. Or, if the line was: this line has four spaces of indention Then it would return four spaces. So I guess you could say that I just need to strip everything from a string from first non-whitespace character to the end. Thoughts? 回答1: import re s = "\t

Vim: gg=G aligns left, does not auto-indent

白昼怎懂夜的黑 提交于 2019-11-26 21:34:54
问题 When I try to fix the indentation of an HTML file with gg=G , each line loses its indentation and becomes left-justified. Does anybody know what could be going on here? test.html <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <title>Indent test</title> </head> <body> <div id="test"> <div id="test2"> </div> </div> </body> </html> test.html after running gg=G: <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <title>Indent test<

Tab key == 4 spaces and auto-indent after curly braces in Vim

吃可爱长大的小学妹 提交于 2019-11-26 21:11:54
How do I make vi - Vim never use tabs (converting spaces to tabs, bad!), makes the tab key == 4 spaces, and automatically indent code after curly brace blocks like Emacs does? Also, how do I save these settings so I never have to input them again? I've seen other questions related to this, but it always seems to be a little off from what I want. Ken As has been pointed out in a couple of answers below, the preferred method now is NOT to use smartindent, but instead use the following (in your .vimrc ): filetype plugin indent on " show existing tab with 4 spaces width set tabstop=4 " when

Haskell “where” indentation: why must it be indented past identifier?

六月ゝ 毕业季﹏ 提交于 2019-11-26 20:10:11
问题 This code: import Data.Char (digitToInt) myInt :: String -> Int myInt [] = error "bad input: empty string" myInt (x:xs) | x == '-' = -1 * myInt xs | otherwise = foldl convert 0 (x:xs) where convert acc x | x `elem` ['0'..'9'] = 10 * acc + digitToInt x | otherwise = error ("bad input: not an int - " ++ [x]) Fails: Prelude> :l safeListFs.hs [1 of 1] Compiling Main ( safeListFs.hs, interpreted ) safeListFs.hs:9:8: parse error (possibly incorrect indentation) Failed, modules loaded: none. But

How do I deal with many levels of indentation?

廉价感情. 提交于 2019-11-26 19:10:29
I am writing a script that has a very logically complicated loop: main = do inFH <- openFile "..." ReadMode outFH <- openFile "..." WriteMode forM myList $ \ item -> ... if ... then ... else do ... case ... of Nothing -> ... Just x -> do ... ... The code soon flies to the right, so I was thinking breaking it into pieces, using for example where clauses. The problem is, many of these ... contain reading/writing statements to the two handles inFH and outFH , and using a where statement will render those two names out of context. I would have to send in these two variables everytime I use a where

How to implement custom indentation when pretty-printing with the JSON module?

时光总嘲笑我的痴心妄想 提交于 2019-11-26 18:55:10
So I'm using Python 2.7, using the json module to encode the following data structure: 'layer1': { 'layer2': { 'layer3_1': [ long_list_of_stuff ], 'layer3_2': 'string' } } My problem is that I'm printing everything out using pretty printing, as follows: json.dumps(data_structure, indent=2) Which is great, except I want to indent it all, except for the content in "layer3_1" — It's a massive dictionary listing coordinates, and as such, having a single value set on each one makes pretty printing create a file with thousands of lines, with an example as follows: { "layer1": { "layer2": { "layer3_1

How do I autoindent in Netbeans?

淺唱寂寞╮ 提交于 2019-11-26 18:48:30
问题 In eclipse you can click Ctrl + I at any line, and it'll automatically indent the line or group of lines according to the indentation scheme you chose in the settings. I'm really missing this feature in Netbeans. Is there any equivalent feature? I'm aware of Alt + Shift + F but it's not good enough. I want to indent a group of lines, and not all the file. 回答1: Open Tools -> Options -> Keymap , then look for the action called "Re-indent current line or selection" and set whatever shortcut you

How do I fix the indentation of an entire file in Vi?

六眼飞鱼酱① 提交于 2019-11-26 17:52:51
问题 In Vim, what is the command to correct the indentation of all the lines? Often times I'll copy and paste code into a remote terminal and have the whole thing messed up. I want to fix this in one fell swoop. 回答1: = , the indent command can take motions. So, gg to get the start of the file, = to indent, G to the end of the file, gg=G . 回答2: Before pasting into the terminal, try :set paste and then :set nopaste after you're done. This will turn off the auto-indent, line-wrap and other features