indentation

Indenting in VIM with all the files in Folder

痞子三分冷 提交于 2019-11-26 10:17:43
问题 I have a folder containing hundreds of TTL (TeraTermLanguage) files. Now I wanted indent all these files. I have created teraterm.vim for indentation and I open a file using VIM and do \"gg=G\" and whole file gets indented properly. But is there any way, where I can indent all the files in folder. I wanted to do with help of Shell. But in VIM I couldnt pass file indent command as the argument to VIM. Please suggest which is the best way I can do indentation to all the files in VIM. 回答1: Much

Set 4 Space Indent in Emacs in Text Mode

回眸只為那壹抹淺笑 提交于 2019-11-26 10:05:48
问题 I\'ve been unsuccessful in getting Emacs to switch from 8 space tabs to 4 space tabs when pressing the TAB in buffers with the major mode text-mode . I\'ve added the following to my .emacs : (setq-default indent-tabs-mode nil) (setq-default tab-width 4) ;;; And I have tried (setq indent-tabs-mode nil) (setq tab-width 4) No matter how I change my .emacs file (or my buffer\'s local variables) the TAB button always does the same thing. If there is no text above, indent 8 spaces If there is text

How do I force Sublime Text to indent two spaces per tab?

纵饮孤独 提交于 2019-11-26 10:04:07
问题 Is there a way to force Sublime Text 2 to always indent two spaces per tab when working with Ruby files? I know that indentation can be set under the view -> indentation menu option, but it does not stick. Every time I open a new file and hit tab, it reverts back to four spaces. 回答1: If you want it for all files, go to Preferences -> Settings - Default/User . But as several comments below indicate, Syntax Specific settings can limit it to just the languages you choose. To limit this

How do you auto format code in Visual Studio?

笑着哭i 提交于 2019-11-26 10:03:59
问题 I know Visual Studio can auto format to make my methods and loops indented properly, but I cannot find the setting. 回答1: To format a selection: Ctrl + K , Ctrl + F To format a document: Ctrl + K , Ctrl + D See the pre-defined keyboard shortcuts. (These two are Edit.FormatSelection and Edit.FormatDocument .) 回答2: For Visual Studio 2010/2013/2015/2017 Format Document ( Ctrl+K , Ctrl+D ) so type Ctrl+K , AND THEN Ctrl+D as it is a sequence Format Selection ( Ctrl+K , Ctrl+F ) Toolbar Edit ->

What indentation is required for a case statement within a let statement?

最后都变了- 提交于 2019-11-26 09:58:58
问题 Working in haskell, found odd behavior, stripped it down to bare bones This Works a :: Bool a = case True of True -> True False -> False But when I try b :: IO Bool b = do let b\' = case True of True -> True False -> False return b\' I get ghci>:l test.hs [1 of 1] Compiling Main ( test.hs, interpreted ) test.hs:16:14: parse error on input ‘->’ Failed, modules loaded: none. So I try c :: IO Bool c = do let c\' = case True of True -> True False -> False return c\' And this works. What? Why? Why

Python's interpretation of tabs and spaces to indent

て烟熏妆下的殇ゞ 提交于 2019-11-26 09:49:37
问题 I decided, that I learn a bit of Python. The first introduction says that it uses indentation to group statements. While the best habit is clearly to use just one of these what happens if I interchange them? How many spaces will be considered equal to one tab? Or will it fail to work at all if tabs and spaces are mixed? 回答1: Spaces are not treated as equivalent to tab. A line indented with a tab is at a different indentation from a line indented with 1, 2, 4 or 8 spaces. Proof by counter

Auto-indent in Notepad++

你说的曾经没有我的故事 提交于 2019-11-26 08:46:58
问题 We always write code like this formal: void main(){ if(){ if() } But when I use Notepad++, the display is: void main(){ if(){ if() } How do I use Notepad++ to auto indent? Thanks to Jonathan, I have set it, but it does not take any effect. The snapshot is below: I am using Notepad++ version 5.1.3. 回答1: Notepad++ will only auto-insert subsequent indents if you manually indent the first line in a block; otherwise you can re-indent your code after the fact using TextFX > TextFX Edit > Reindent C

JavaScript error (Uncaught SyntaxError: Unexpected end of input)

三世轮回 提交于 2019-11-26 08:45:34
问题 I have some JavaScript code that works in FireFox but not in Chrome or IE. In the Chrome JS Console I get the follow error: \"Uncaught SyntaxError: Unexpected end of input\". The JavaScript code I am using is: <script> $(function() { $(\"#mewlyDiagnosed\").hover(function() { $(\"#mewlyDiagnosed\").animate({\'height\': \'237px\', \'top\': \"-75px\"}); }, function() { $(\"#mewlyDiagnosed\").animate({\'height\': \'162px\', \'top\': \"0px\"}); }); </script> It says the error is on the last line

How do I deal with many levels of indentation?

泪湿孤枕 提交于 2019-11-26 06:08:43
问题 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

Indentation Error in Python [duplicate]

梦想的初衷 提交于 2019-11-26 06:02:38
问题 This question already has answers here : I'm getting an IndentationError. How do I fix it? (4 answers) Closed 2 months ago . I can\'t compile because of this part in my code: if command == \'HOWMANY\': opcodegroupr = \"A0\" opcoder = \"85\" elif command == \'IDENTIFY\': opcodegroupr = \"A0\" opcoder = \"81\" I have this error: Sorry: IndentationError: (\'unindent does not match any outer indentation level\', (\'wsn.py\', 1016, 30, \"\\t\\telif command == \'IDENTIFY\':\\n\")) But I don\'t see