Skip to content

Commit

Permalink
0.4.0 (#3)
Browse files Browse the repository at this point in the history
* update README, update plugin build version range

* add notifier

* update plugin description

* [WIP] add a cmd

* added command a and A

* [WIP] add paste cmd

* [WIP] update README

* 0.4.0 added command p
  • Loading branch information
asmoker committed Feb 21, 2023
1 parent 4d00c4b commit 6fe955e
Show file tree
Hide file tree
Showing 6 changed files with 75 additions and 7 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Txtic - Changelog

**0.4.0 - 2023-02-21**

- Added command `p`/`paste`

**0.3.0 - 2023-02-15**

- Added command `a` and `A`
Expand Down
20 changes: 16 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,25 @@

# Txtic

Txtic is a plugin for [JetBrains IDEs](https://www.jetbrains.com/) dedicated to reduce repetitive work by using simple commands and the power of multiple cursors in JetBrains IDEs.
[![Version](https://img.shields.io/jetbrains/plugin/v/20961.svg)](https://plugins.jetbrains.com/plugin/20961)
[![Downloads](https://img.shields.io/jetbrains/plugin/d/20961.svg)](https://plugins.jetbrains.com/plugin/20961)
![](https://img.shields.io/github/issues-closed/asmoker/txtic)
![](https://img.shields.io/github/issues/asmoker/txtic)
![](https://img.shields.io/jetbrains/plugin/r/rating/20961)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

[Get from Marketplace](https://plugins.jetbrains.com/plugin/20961-txtic) or [Releases](https://github.com/asmoker/txtic/releases).
<a href="https://www.producthunt.com/posts/txtic?utm_source=badge-featured&utm_medium=badge&utm_souce=badge-txtic" target="_blank"><img src="https://api.producthunt.com/widgets/embed-image/v1/featured.svg?post_id=379809&theme=light" alt="txtic - Text magic command for code | Product Hunt" style="width: 250px; height: 54px;" width="250" height="54" /></a>

Txtic is a plugin for [JetBrains IDEs](https://www.jetbrains.com/) dedicated to reduce repetitive work by using simple
commands and the power of multiple cursors in JetBrains IDEs.

[Get from Marketplace](https://plugins.jetbrains.com/plugin/20961-txtic)
or [Releases](https://github.com/asmoker/txtic/releases).

**Default shortcut: `ctrl + alt + X`.**

[![Watch the video](https://i.ytimg.com/vi/_6i-GI5SZaY/hqdefault.jpg)](https://www.youtube.com/watch?v=_6i-GI5SZaY)


## Commands

- `r`/`range`: incremental numbers
Expand All @@ -24,10 +34,12 @@ Txtic is a plugin for [JetBrains IDEs](https://www.jetbrains.com/) dedicated to
- `da`/`del_all`: delete all specified str
- `rf`/`rep_first`: replace first specified str
- `ra`/`rep_all`: replace all specified str
- `p`/`paste`: paste the first line of text from the clipboard

## Wiki

If you would like to know more about how Txtic can help you out, check out our [wiki](https://github.com/asmoker/txtic/wiki).
If you would like to know more about how Txtic can help you out, check out
our [wiki](https://github.com/asmoker/txtic/wiki).

## Changelog

Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ plugins {
}

group = "top.threep.plugin"
version = "0.3.0"
version = "0.4.0"

repositories {
mavenCentral()
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/top/threep/plugin/txtic/cmd/CmdFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ private static Cmd getCmd(String cmd, String options) {
case "r":
case "range":
return new NumberRangeCmd(options);
case "p":
case "paste":
return new PasteCmd(options);
default:
return null;
}
Expand Down
43 changes: 43 additions & 0 deletions src/main/java/top/threep/plugin/txtic/cmd/PasteCmd.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package top.threep.plugin.txtic.cmd;

import com.jgoodies.common.base.Strings;

import java.awt.*;
import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.UnsupportedFlavorException;
import java.io.IOException;

public class PasteCmd implements Cmd {
private String separator = " ";
private int idx = 0;
private String[] contents;

public PasteCmd(String options) {
if (!Strings.isEmpty(options)) {
this.separator = options;
}
this.initContents();
}

private void initContents() {
try {
String data = (String) Toolkit.getDefaultToolkit().getSystemClipboard().getData(DataFlavor.stringFlavor);
if (Strings.isEmpty(data)) {
this.contents = new String[]{};
return;
}
this.contents = data.split(this.separator);
} catch (UnsupportedFlavorException | IOException ignored) {
}
}

@Override
public String run(String text) {
if (this.contents.length == 0 || (this.idx + 1) > this.contents.length) {
return text;
}
String result = text + contents[idx];
this.idx += 1;
return result;
}
}
10 changes: 8 additions & 2 deletions src/main/resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<!-- Public plugin name should be written in Title Case.
Guidelines: https://plugins.jetbrains.com/docs/marketplace/plugin-overview-page.html#plugin-name -->
<name>Txtic</name>
<version>0.3.0</version>
<version>0.4.0</version>

<!-- A displayed Vendor name or Organization ID displayed on the Plugins Page. -->
<vendor email="blog.smoker.cc@gmail.com" url="https://github.com/asmoker">asmoker</vendor>
Expand All @@ -32,16 +32,22 @@
<li>da/del_all: delete all specified str</li>
<li>rf/rep_first: replace first specified str</li>
<li>ra/rep_all: replace all specified str</li>
<li>p/paste: paste the first line of text from the clipboard</li>
</ul>
<h2>Wiki</h2>
If you would like to know more about how Txtic can help you out, check out our <a href="https://github.com/asmoker/txtic/wiki" target="_blank">wiki</a>.
]]></description>

<change-notes><![CDATA[
<strong>0.4.0 - 2023-02-21</strong>
<ul>
<li>Added command p/paste</li>
</ul>
<br/>
<strong>0.3.0 - 2023-02-15</strong>
<ul>
<li>Added command `a` and `A`</li>
<li>Added command a and A</li>
</ul>
<br/>
<strong>0.2.0 - 2023-02-09</strong>
Expand Down

0 comments on commit 6fe955e

Please sign in to comment.