It would be great, if CotEditor could feature this indent/outdent behavior like other major editors. I have searched in CotEditor for a similar setting but found nothing so I guess it isn't available yet. In TextWrangler for comparison one has to check explicitly the option "Allow Tab key to indent text blocks" (Options->Keyboard-section). With selection one or more lines and pressing shift-tab CotEditor should outdent the selected lines (missing, Coteditor does nothing, not so bad, but also not so useful) With selection one or more lines and pressing tab CotEditor should indent the selected lines (missing, CotEditor deletes the line and replaces them with a tab character, very bad) Without selection on pressing shift-tab the whole line should outdent by a tab (missing) I often break lines with a selection in order to delete the string and break the line at the same time. Ability to Search and Replace in a Project Auto-Indent for Common Actions. Is your feature request related to a problem Please describe. Without selection on pressing tab it indents text after the curser (fine, works in CotEditor, too) CotEditor - Open Source Plain-Text Editor for OS X. What I really miss at the moment is a indent/outdent behavior of other code editors. I like the approach of CotEditor very much. # Again root-level, because we are in a new event, so no indentation.Thanks for this amazing and promising Editor. # Three indentations because of the event, the condition and the section (looping). # Three indentations because of the event and the two conditions. # Two indentations because of the event and the condition. Look at the examples below and see if you understand why indentation is needed. The most important thing is to not use two different types of indentation.Each indentation then requires four spaces at default. Another possibility is to indent using spaces.Each indentation that is required needs one tab. The best practice is to indent using tabs.Also, remind that all events, conditions, sections, command, functions and all other root-level declarations need a colon behind them!.After any other root-level declaration (root-level is the code without any indentation, like events).įunction myFunc(): # A function is declared at root-level.While player is online: # Something that requires a colon is a section and therefore needs indentation. If attacker is a player: # Condition, so the next line should be indentated once.Įlse if type of current inventory of player is anvil inventory: # Also a condition.Įlse: # Believe it or not, this is a condition as well. On script load: #This is an event, so the next line should be indentated once. # Here I indentated with two tabs, because this is a section after a condition, that already was indentated. # Here I indentated with one tab, to clarify this is the section after the event. That's why indentation is really important and you should always take care of it. Most programming language don't care about indentation, their parser can handle it correctly without, but Skript can't, because of its rich, English-like syntax. If I create a document in CotEditor it is fine in CE, loads and displays fine in VIM and BBEdit and correctly shows spaces for indents in xxd. If I open in CotEditor the spaces are all proportionally spaced and alignment is incorrect. Indentation is placing text in code further to the right, to allow the parser to know this is a different section of the code. I can open files from created in either app in the other and it formats with alignment. So basically, if you experienced the error "Error: Indentation error at line X, expected X tabs/spaces, but found X tabs/spaces" or something similar, and you don't know how to fix it, read this tutorial. You probably did not know what they meant and you just wanted your error to be resolved, but this is actually a rather small, but really important aspect of coding in general, so that's why this tutorial was created. If you are redirected to this tutorial by a member of one of the Skript communities, that will probably mean that your indentation was wrong.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |