xcode插件XAlign

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

Equal

Align by define group

Define

Align by property group

Property

Todo:

  •  Much easier to customize alignment patterns.

Install & Update

Via source

  1. Clone this repo

  2. Then build the XAlign target in the Xcode project and the plug-in will automatically be installed in~/Library/Application Support/Developer/Shared/Xcode/Plug-ins  (下载代码,并编译。会自动生成插件)

  3. Restart Xcode.

Via command-line

curl -fsSL http://qfi.sh/XAlign/build/install.sh | sh

Manually

  1. Download this package XAlign.tar.gz
  2. Unpack it, copy or move the XAlign.xcplugin to the following path:

    ~/Library/Application Support/Developer/Shared/Xcode/Plug-ins/
    

    Tips: To quickly go to Finder type Shift + Cmd + G. If there is no Plug-ins directory, you should make one.

  3. 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 :

  1. Get current Xcode UUID

    XCODEUUID=`defaults read /Applications/Xcode.app/Contents/Info DVTPlugInCompatibilityUUID`
  2. 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
  3. Restart your Xcode, and select Load Bundles on the alert

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值