rickytan / XPaste

A Xcode Source Extension to power up your text paste abilities

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

XPaste

This is a Xcode Source Extension to power up your text paste abilities.

Features

  • Paste as base64 string. You can also paste a image data as Base64 string, make sure it has been copied to your pasteboard.

    A short text.中文。
    
    NSString *text = @"QSBzaG9ydCB0ZXh0LuS4reaWh+OAgg==";

    base64-string

  • Paste as string literal

    <div class="card" style="width: 18rem;">
      <img class="card-img-top" src=".../100px180/" alt="Card image cap">
      <div class="card-body">
    <h5 class="card-title">Card title</h5>
    <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
    <a href="#" class="btn btn-primary">Go somewhere</a>
      </div>
    </div>
    NSString *htmlString = @"<div class=\"card\" style=\"width: 18rem;\">\n  <img class=\"card-img-top\" src=\".../100px180/\" alt=\"Card image cap\">\n  <div class=\"card-body\">\n    <h5 class=\"card-title\">Card title</h5>\n    <p class=\"card-text\">Some quick example text to build on the card title and make up the bulk of the card's content.</p>\n    <a href=\"#\" class=\"btn btn-primary\">Go somewhere</a>\n  </div>\n</div>";

    string-literal

  • Paste as Unicode string

    A short text.中文。😂🤣
    
    NSString *unicode = @"A short text.\u4e2d\u6587\u3002\U0001f602\U0001f923";

    unicode-string

  • Paste as Url encoded string

    http://www.host.com/一段中文路径?key=中文&name=中文#/path/中文
    
    NSString *urlString = @"http://www.host.com/%E4%B8%80%E6%AE%B5%E4%B8%AD%E6%96%87%E8%B7%AF%E5%BE%84?key=%E4%B8%AD%E6%96%87&name=%E4%B8%AD%E6%96%87#/path/%E4%B8%AD%E6%96%87";
  • Paste JSON String as Objective-C Dictionary/Array/String variable

    {
      "name": "John",
      "age": 30,
      "house": null,
      "cars": [ "Ford", "BMW", "Fiat" ]
    }
    id object = @{@"age": @30,
                  @"cars": @[@"Ford",
                             @"BMW",
                             @"Fiat"],
                  @"name": @"John",
                  @"house": [NSNull null]};
  • Sort imports, and group them to <> and ""

    #import <NELog/NELog.h>
    #import <NKCoreNetwork/NKCoreNetwork.h>
    #import "NKWebViewController.h"
    #import <NKIocProtocols/NKIocProtocols.h>
    #import "NKWebviewURLProtocol.h"
    #import "UIBarButtonItem+NKBarButton.h"
    #import <NEIocProtocols/NEIocProtocols.h>
    #import <NEIocProtocols/NEIocProtocols.h>
    #import <NELog/NELog.h>
    #import <NKCoreNetwork/NKCoreNetwork.h>
    #import <NKIocProtocols/NKIocProtocols.h>
    
    #import "NKWebViewController.h"
    #import "NKWebviewURLProtocol.h"
    #import "UIBarButtonItem+NKBarButton.h"

Install

  1. Clone this project, build by yourself with Xcode
  2. Or, you can download the binary here

Open the XPaste.app, you will see following interface, and click Enable XPaste, make sure XPaste Xcode Source Editor is checked.

image

Then relaunch your Xcode, it will be shown at Editor sub-menu.

image

Key bindings

Open Preference of Xcode, search xpaste in Key Bindings tab.

image

Steps to make it running

sudo spctl --master-disable
sudo xattr -rd com.apple.quarantine /Applications/XPaste.app
xcode-select --install
codesign --force --deep --sign - /Applications/XPaste.app

License

MIT License

Copyright (c) 2018 Ricky Tan

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

About

A Xcode Source Extension to power up your text paste abilities

License:MIT License


Languages

Language:Objective-C 98.3%Language:Ruby 1.2%Language:AppleScript 0.5%