Smarty indent
is there any solution for changing ST3 indent patterns?
As far as i can judge it, those two files are responsible for how the indenting behaves.
They are located in the Default Package of ST3
Default/Indentation Rules.tmPreferences
Default/Indentation Rules - Comments.tmPreferences
But i cant find any solution to change them. Even if i go into the Default plugin and change the regex directly in the sublime Package, it doesent seem to change anything.
I tried to make a syntax specific file like this.
Packages/'Sytnax'/'Syntax'.tmPreferences
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>name</key>
<string>Globals</string>
<key>scope</key>
<string>text.html.smarty</string>
<key>settings</key>
<dict>
// rules go here
</dict>
</dict>
</plist>
Related
When I create a new file in my project in the file header, I find this:
//
// NameFile.swift
// NameProject
//
// Created by Name Surname on dd/mm/yy.
//
I would like to change it, but in the settings I don't find where to do it.
I would like to change it for all possible future projects.
I would like to achieve such a thing.
//
// NameFile.swift
// NameProject
//
//
Edit:
I would like to try to remove the comment, but I can't find solutions.
Say you want to modify (or get rid of) the XCode Header comment.
First open XCode, Use File > New File... (⌘N) and choose Property List from the file templates.
Name it file IDETemplateMacros.plist
On the navigator, select the file as right-click Open as source code. Xcode will show us the property file as text. Property files are really just XML files.
Copy paste the following content:
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>FILEHEADER</key>
<string>Created for ___PROJECTNAME___ in ___YEAR___
// Using Swift ___DEFAULTTOOLCHAINSWIFTVERSION___</string>
</dict>
</plist>
On the root dict we have added an entry with key FILEHEADER and a two-lines string as a value:
Created for ___PROJECTNAME___ in ___YEAR___
// Using Swift ___DEFAULTTOOLCHAINSWIFTVERSION___
Save the file IDETemplateMacros.plist on the folder:
~/Library/Developer/Xcode/UserData/
That's it, now when creating a new project called MyProject the header will be:
//Created for MyProject in 2022
// Using Swift 5.0
Note1. There is a list of macros on https://help.apple.com/xcode/mac/9.0/index.html?localePath=en.lproj#/dev7fe737ce0
Note 2. As an example you can write:
Created ___DATE___
// ___COPYRIGHT___
Note that there is a leading space but you do not include the // for the comment on the first line.
Note 3. For a more list of options see:
https://useyourloaf.com/blog/changing-xcode-header-comment/
From https://developer.apple.com/forums/thread/711305?answerId=722311022#722311022
Add ~/Library/Developer/Xcode/UserData/IDETemplateMacros.plist with an empty FILEHEADER entry to generate an empty comment.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>FILEHEADER</key>
<string></string>
</dict>
</plist>
Xcode help:
Customize text macros:
https://help.apple.com/xcode/mac/?localePath=en.lproj#/dev91a7a31fc
Text macros reference:
https://help.apple.com/xcode/mac/index.html?localePath=en.lproj#/dev7fe737ce0
If you really want to remove that empty comment line then you will need to start adding custom file templates. eg for a No Comment Swift File template create the following:
~/Library/Developer/Xcode/Templates/File Templates/MultiPlatform/Source/No Comment Swift File.xctemplate/___FILEBASENAME___.swift with import Foundation
followed by an empty line
~/Library/Developer/Xcode/Templates/File Templates/MultiPlatform/Source/No Comment Swift File.xctemplate/TemplateInfo.plist with something like
TemplateInfo.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>SupportsSwiftPackage</key>
<true/>
<key>Kind</key>
<string>Xcode.IDEFoundation.TextSubstitutionFileTemplateKind</string>
<key>Description</key>
<string>A no comment Swift file.</string>
<key>Summary</key>
<string>A no comment Swift file</string>
<key>SortOrder</key>
<string>1</string>
<key>Image</key>
<dict>
<key>FileTypeIcon</key>
<string>swift</string>
</dict>
<key>AllowedTypes</key>
<array>
<string>public.swift-source</string>
</array>
<key>Platforms</key>
<array/>
<key>DefaultCompletionName</key>
<string>File</string>
<key>MainTemplateFile</key>
<string>___FILEBASENAME___.swift</string>
</dict>
</plist>
The default empty Swift File template in the Xcode 14 beta is: /Applications/Xcode-beta.app/Contents/Developer/Library/Xcode/Templates/File Templates/MultiPlatform/Source/Swift File.xctemplate/ (do not edit this directly).
I've used a script in Xcode 8 / iOS 10 to generate an acknowledge section in the settings bundle.
The script producing an Acknowledgements.plist file that gives the error message
The data couldn’t be read because it isn’t in the correct format.
when I try to open it in Xcode. When I open Acknowledgements.plist file with textEdit it looks OK on first sight ...
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PreferenceSpecifiers</key>
<array>
<key>Type</key>
<string>PSGroupSpecifier</string>
<key>FooterText</key>
<string>knobcontrol</string>
<key>Type</key>
<string>PSGroupSpecifier</string>
<key>FooterText</key>
<string>knobcontrol2</string>
</array>
<key>StringsTable</key>
<string>Acknowledgements</string>
</dict>
</plist>
I've tried some of the comments according to the script but could not find what is wrong with the plist - can anybody have a look at the file? I don't have enough reputation to post comments to the script posting.
You are using <key>...</key> value pairs within an <array>.
Make it a <dict> instead:
...
<plist version="1.0">
<dict>
<key>PreferenceSpecifiers</key>
<dict> <- dict, not array
...
</dict> <- dict, not array
<key>StringsTable</key>
<string>Acknowledgements</string>
</dict>
</plist>
This question already has answers here:
How to read plist information (bundle id) from a shell script
(5 answers)
Closed 6 years ago.
I'm trying to find on a Mac computer if the current user has iCloud Documents enabled. I found the plist where this is located (MobileMeAccounts.plist), but I could use some help with creating a script that can identify if it is enabled or not.
I am specifically looking for the following code to be true:
<key>Enabled</key>
<true/>
Here is the plist. If you scroll down you'll see the "MOBILE_DOCUMENTS" with it being enabled:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Accounts</key>
<array>
<dict>
<key>AccountAlternateDSID</key>
<string>99999999</string>
<key>AccountDSID</key>
<string>999999</string>
<key>AccountDescription</key>
<string>iCloud</string>
<key>AccountID</key>
<string>*****#gmail.com</string>
<key>AccountUUID</key>
<string>9999999</string>
<key>DisplayName</key>
<string>User Name</string>
<key>LoggedIn</key>
<true/>
<key>Services</key>
<array>
<dict>
<key>Name</key>
<string>CLOUDDESKTOP</string>
<key>ServiceID</key>
<string>com.apple.Dataclass.CloudDesktop</string>
<key>status</key>
<string>active</string>
</dict>
<dict>
<key>Name</key>
<string>FAMILY</string>
<key>ServiceID</key>
<string>com.apple.Dataclass.Family</string>
<key>showManageFamily</key>
<true/>
</dict>
<dict>
<key>Enabled</key>
<true/>
<key>Name</key>
<string>MOBILE_DOCUMENTS</string>
<key>ServiceID</key>
<string>com.apple.Dataclass.Ubiquity</string>
<key>apsEnv</key>
<string>production</string>
<key>authMechanism</key>
<string>token</string>
<key>url</key>
<string>https://p48-ubiquity.icloud.com:443</string>
<key>wsUrl</key>
<string>https://p48-ubiquityws.icloud.com:443</string>
</dict>
Python includes a module for parsing plists. Probably you'll want some better error checking, but to demonstrate:
$ cat parseplist.py
import plistlib
pl = plistlib.readPlist("the_plist.xml")
print pl['Accounts'][0]['Services'][2]['Enabled']
$ python parseplist.py
True
I'm working on my first PopClip extension using AppleScript. I'm getting the following error when trying to install the Extension:
**
Cannot Install Extension
The path /Users/myuserdirectoryname/Desktop/ReminderNote.popclipext does no contain a valid PopClip extension.
Reason: No such file: (null)
**
I have narrowed down the problem to my AppleScript info in the Config.plist. Or so I think. When I remove the following from the Config.plist file, the extension loads fine. When I add these two lines, the error returns.
<key>AppleScript File</key>
<string>ReminderNote.applescript</string>
My ReminderNote.popclipext package includes 3 files:
Config.plist,
ReminderNote.applescript,
ReminderNote.png
Here is the full Config.plist, in case that will help.
thanks for any tips or guidance -- jay
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Version</key>
<integer>1</integer>
<key>Extension Name</key>
<string>ReminderNote</string>
<key>Extension Identifier</key>
<string>com.jel.ReminderNote</string>
<key>Extension Description</key>
<string>Create linked Reminder to Evernote using the selected text.</string>
<key>Extension Image File</key>
<string>ReminderNote.png</string>
<key>Actions</key>
<array>
<dict>
<key>Title</key>
<string>Reminder Note</string>
<key>AppleScript File</key>
<string>ReminderNote.applescript</string>
<key>Image File</key>
<string>ReminderNote.png</string>
<key>Long Running</key>
<true/>
</dict>
</array>
</dict>
</plist>
I think this could be some kind of filesystem caching bug within PopClip. Try quitting PopClip and restarting it
Here is a link to a screenshot of the warnings:
I would like to be able to use the "cmd+/" shortcut to quickly comment out sections of code. Whenever I do, I get a bunch of space/tab mixing errors. I am required to use tabs for coding standards, but it seems Sublime 3 forces spaces for the comments. I also enjoy the error checking for space/tab mixing through non-commented code, so I would like to leave that intact if possible.
Is there a way to modify Sublime's settings to change the commenting shorcuts functionality or is there a way to modify SublimeLinter-jshint's settings to ignore these warnings?
Thanks in advance.
The easiest way to do this is to remove the space from after the //. Open your Packages folder via Preferences -> Browse Packages... and create a folder called JavaScript. I assume you're on OS X, so the full path to the folder is ~/Library/Application Support/Sublime Text 3/Packages. Next, create a new file in Sublime with the following contents:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>name</key>
<string>Comments</string>
<key>scope</key>
<string>source.js, source.json</string>
<key>settings</key>
<dict>
<key>shellVariables</key>
<array>
<dict>
<key>name</key>
<string>TM_COMMENT_START</string>
<key>value</key>
<string>//</string>
</dict>
<dict>
<key>name</key>
<string>TM_COMMENT_START_2</string>
<key>value</key>
<string>/*</string>
</dict>
<dict>
<key>name</key>
<string>TM_COMMENT_END_2</string>
<key>value</key>
<string>*/</string>
</dict>
</array>
</dict>
<key>uuid</key>
<string>A67A8BD9-A951-406F-9175-018DD4B52FD1</string>
</dict>
</plist>
and save it in the Packages/JavaScript folder as Comments.tmPreferences. You'll notice that the TM_COMMENT_START value is //, whereas in the original it's //. Restart Sublime, and now when you're editing JavaScript or JSON files and hit Command ⌘/ your code will be commented out without the addition of a space.