From 435ca1ee73cc07d0172730a5f47402e2774f2a08 Mon Sep 17 00:00:00 2001 From: pluginfan Date: Sat, 2 Apr 2016 21:01:21 +0300 Subject: [PATCH] Initial release --- Move Caret To Word End/README | 12 ------------ Move Caret To Word End/README.md | 17 +++++++++++++++++ PrettyPrint JSON/NEWS | 3 +++ PrettyPrint JSON/README.md | 13 +++++++++++++ PrettyPrint JSON/TODO | 1 + PrettyPrint JSON/plugin.groovy | 39 +++++++++++++++++++++++++++++++++++++++ README | 6 ------ README.md | 6 ++++++ 8 files changed, 79 insertions(+), 18 deletions(-) delete mode 100644 Move Caret To Word End/README create mode 100644 Move Caret To Word End/README.md create mode 100644 PrettyPrint JSON/NEWS create mode 100644 PrettyPrint JSON/README.md create mode 100644 PrettyPrint JSON/TODO create mode 100644 PrettyPrint JSON/plugin.groovy delete mode 100644 README create mode 100644 README.md diff --git a/Move Caret To Word End/README b/Move Caret To Word End/README deleted file mode 100644 index 84e4ad2..0000000 --- a/Move Caret To Word End/README +++ /dev/null @@ -1,12 +0,0 @@ -Move Caret to Word End -~~~~~~~~~~~~~~~~~~~~~~ - -Moves all carets to the closes word end. - -Action: -* Move Caret to Next Word End -* Move Caret to Previous Word End - -Shortcut: -* Ctrl+NumPad 6 -- Move Caret to Next Word End -* Ctrl+NumPad 4 -- Move Caret to Previous Word End diff --git a/Move Caret To Word End/README.md b/Move Caret To Word End/README.md new file mode 100644 index 0000000..eb549bd --- /dev/null +++ b/Move Caret To Word End/README.md @@ -0,0 +1,17 @@ +# Move Caret to Word End + +Moves all carets to the closes word end. + +Action: + +* `Move Caret to Next Word End` +* `Move Caret to Previous Word End` + +Shortcut: + +* Ctrl+NumPad 6 -- Move Caret to Next Word End +* Ctrl+NumPad 4 -- Move Caret to Previous Word End + +When moving word-by-word, the IDE's builtin algorithm stops on word starts. Often you can reach the word end only by +moving one word further then moving a couple of characters back. But this may not be an option when using multiple +carets and there are different amounts of separators between the words. diff --git a/PrettyPrint JSON/NEWS b/PrettyPrint JSON/NEWS new file mode 100644 index 0000000..fe3e01d --- /dev/null +++ b/PrettyPrint JSON/NEWS @@ -0,0 +1,3 @@ +Version 0.0 -- April 2016 +~~~~~~~~~~~~~~~~~~~~~~~~~ +Initial release. diff --git a/PrettyPrint JSON/README.md b/PrettyPrint JSON/README.md new file mode 100644 index 0000000..5dc1ebb --- /dev/null +++ b/PrettyPrint JSON/README.md @@ -0,0 +1,13 @@ +# PrettyPrint JSON + +Formats the current selection as prettified JSON. + +Action: + +* `PrettyPrint JSON` + +Shortcut: + +* Alt+P -- PrettyPrint JSON + +Not really related to the source code, more a helper to debug AJAX communication. diff --git a/PrettyPrint JSON/TODO b/PrettyPrint JSON/TODO new file mode 100644 index 0000000..257dec3 --- /dev/null +++ b/PrettyPrint JSON/TODO @@ -0,0 +1 @@ +* Transform it into generic prettyprinter by handling XML, YAML and maybe Groovy. diff --git a/PrettyPrint JSON/plugin.groovy b/PrettyPrint JSON/plugin.groovy new file mode 100644 index 0000000..478918c --- /dev/null +++ b/PrettyPrint JSON/plugin.groovy @@ -0,0 +1,39 @@ +// plugin PrettyPrint JSON +// version 0.0 +// release April 2016 +// author Plugin Fan +// license GPL v 3.0 + +// Formats the current selection as prettified JSON : +// - Alt-P - PrettyPrint JSON +// +// Not really related to the source code, more a helper to debug AJAX communication. + + +import com.intellij.openapi.actionSystem.AnActionEvent +import com.intellij.notification.NotificationType + +import groovy.json.* + +import static liveplugin.PluginUtil.* + +registerAction('PrettyPrint JSON', 'alt P') { AnActionEvent event -> + runDocumentWriteAction(event.project) { + currentEditorIn(event.project).with { + if (! selectionModel.hasSelection()) + return + + def text = selectionModel.getSelectedText().trim() + if (! text) + return + + try { + text = JsonOutput.prettyPrint(text) + } catch (JsonException e) { + return show(e.message, '', NotificationType.ERROR) + } + + document.replaceString(selectionModel.getSelectionStart(), selectionModel.getSelectionEnd(), text) + } + } +} diff --git a/README b/README deleted file mode 100644 index 2cadccc..0000000 --- a/README +++ /dev/null @@ -1,6 +0,0 @@ -IntelliJ IDEA LivePlugin Plugin collection -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Plugins written in Groovy script for IntelliJ IDEA based IDE's that can be enhanced through LivePlugin plugin connector. - -* Move Caret to Word End -- Moves all carets to the closes word end. diff --git a/README.md b/README.md new file mode 100644 index 0000000..f8296c8 --- /dev/null +++ b/README.md @@ -0,0 +1,6 @@ +# IntelliJ IDEA LivePlugin Plugin collection + +Plugins written in [Groovy](http://groovy-lang.org/) script for [IntelliJ IDEA](http://jetbrains.com/idea/) based IDE's that can be enhanced through [LivePlugin](https://github.com/dkandalov/live-plugin) plugin connector. + +* [Move Caret to Word End](https://osdn.jp/projects/ii-lp-script/scm/git/ii-lp-script/tree/master/Move%20Caret%20To%20Word%20End/) -- Moves all carets to the closes word end. +* [PrettyPrint JSON](https://osdn.jp/projects/ii-lp-script/scm/git/ii-lp-script/tree/master/PrettyPrint%20JSON/) -- Formats the current selection as prettified JSON. -- 2.11.0