https://github.com/qfish/XAlign
XAlign(cmd+shift+x)
An amazing Xcode plugin to align regular code. It can align anything by using custom alignment patterns.
What's XAlign
Here are some example alignment patterns. Of course you can make your own. The pattern file is here:XAlign/patterns.plist, and the patterns are based on regular expression.
Tips:
- You may not like the alignment style below, try it yourself or tell me at the [Issues]. :)
- There is no need to align all codes at a time when they are complicated, try to align by group which the codes are more similar in.
- 对齐不需要一次全部对齐,可以分组多对几次,那些等号差的太远的就别让它参与对齐了。
- 默认对齐的风格不是你喜欢的,可以自定义,或者提个 Issues。
Align by equals sign
Align by define group
Align by property group
Todo:
- Much easier to customize alignment patterns.
Install & Update
Via source
-
Clone this repo
-
Then build the
XAligntarget in the Xcode project and the plug-in will automatically be installed in~/Library/Application Support/Developer/Shared/Xcode/Plug-ins (下载代码,并编译。会自动生成插件) -
Restart Xcode.
Via command-line
curl -fsSL http://qfi.sh/XAlign/build/install.sh | sh
Manually
- Download this package XAlign.tar.gz
-
Unpack it, copy or move the
XAlign.xcpluginto the following path:~/Library/Application Support/Developer/Shared/Xcode/Plug-ins/Tips: To quickly go to Finder type
Shift + Cmd + G. If there is noPlug-insdirectory, you should make one. -
Restart Xcode.
Uninstall
curl -fsSL http://qfi.sh/XAlign/build/uninstall.sh | sh
or Delete the following directory:
~/Library/Application Support/Developer/Shared/Xcode/Plug-ins/XAlign.xcplugin
Usage
In Xcode
Xcode -> Edit -> XAlign
Auto Align Shortcut (default)
Shift + Cmd + X
You can choose the shortcut in the Settings panel, Xcode -> Edit -> XAlign -> Setting.
Trouble-Shooting
New version Xcode ? Try this in your terminal :
-
Get current Xcode UUID
XCODEUUID=`defaults read /Applications/Xcode.app/Contents/Info DVTPlugInCompatibilityUUID` -
Write it into the Plug-ins's plist
for f in ~/Library/Application\ Support/Developer/Shared/Xcode/Plug-ins/*; do defaults write "$f/Contents/Info" DVTPlugInCompatibilityUUIDs -array-add $XCODEUUID; done
- Restart your Xcode, and select Load Bundles on the alert
XAlign是一款强大的Xcode插件,能够帮助开发者轻松地对齐各种类型的代码。通过使用自定义对齐模式,无论是按等号、定义组还是属性组对齐,XAlign都能提供灵活且高效的解决方案。用户可以根据自己的需求调整对齐样式,甚至提交Issues来获取更多支持。
9527

被折叠的 条评论
为什么被折叠?



