Permalink
Browse files

Mix close tag on slash, tag indent and tag remove

  • Loading branch information...
1 parent 093ed95 commit 0d61d093dcfb8e6cae27ef477fdb65cb9bbe0a18 @titoBouzout committed Nov 7, 2011
View
@@ -1,4 +1,4 @@
-*.pyc
-*.cache
+*.pyc
+*.cache
*.sublime-project
package-metadata.json
@@ -0,0 +1,3 @@
+[
+ {"keys": ["/"], "command": "tag_close_tag_on_slash"}
+]
@@ -0,0 +1,3 @@
+[
+ {"keys": ["/"], "command": "tag_close_tag_on_slash"}
+]
@@ -0,0 +1,3 @@
+[
+ {"keys": ["/"], "command": "tag_close_tag_on_slash"}
+]
View
@@ -0,0 +1,38 @@
+[
+ {
+ "caption": "Preferences",
+ "mnemonic": "n",
+ "id": "preferences",
+ "children":
+ [
+ {
+ "caption": "Package Settings",
+ "mnemonic": "P",
+ "id": "package-settings",
+ "children":
+ [
+ {
+ "caption": "Tag",
+ "children":
+ [
+ {
+ "command": "open_file", "args":
+ {
+ "file": "${packages}/Tag/Tag Package.sublime-settings"
+ },
+ "caption": "Settings – Default"
+ },
+ {
+ "command": "open_file", "args":
+ {
+ "file": "${packages}/User/Tag Package.sublime-settings"
+ },
+ "caption": "Settings – User"
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ }
+]
View
19 README
@@ -1,19 +0,0 @@
-This is a command for Sublime Text 2 that is meant to be bound to the slash
-("/") key in order to semi auto close open HTML tags (in part inspired by the
-discussion at http://www.sublimetext.com/forum/viewtopic.php?f=5&t=1358).
-Requires build 2111 or later of Sublime Text 2.
-
-
-INSTALLATION
-============
-1. Put the file close_tag_on_slash.py into the User folder in your Sublime
- Text 2 Packages folder
- (~/Library/Application Support/Sublime Text 2/Packages/User on Mac OS X)
-
-2. Select Sublime Text 2 > Preferences > Key Bindings - User from the main menu
-
-3. Add the following to the keymap file (inside the square brackets) and then
- save it:
- { "keys": ["/"], "command": "close_tag_on_slash" }
-
-4. Done! :)
@@ -0,0 +1,10 @@
+[
+ {
+ "caption": "Indent Tags on Selection",
+ "command": "tag_indent"
+ },
+ {
+ "caption": "Indent Tags on Document",
+ "command": "tag_indent_document"
+ }
+]
@@ -0,0 +1,13 @@
+[
+ {"caption":"-"},
+ {
+ "command": "tag_indent",
+ "id":"tag-indent-selection",
+ "caption":"Indent Tags on Selection"
+ },
+ {
+ "command": "tag_indent_document",
+ "id":"tag-indent-document",
+ "caption":"Indent Tags on Document"
+ }
+]
@@ -0,0 +1,3 @@
+[
+ { "keys": ["ctrl+shift+h"], "command": "tag_indent" }
+]
@@ -0,0 +1,3 @@
+[
+ { "keys": ["ctrl+shift+h"], "command": "tag_indent" }
+]
@@ -0,0 +1,3 @@
+[
+ { "keys": ["ctrl+shift+h"], "command": "tag_indent" }
+]
@@ -0,0 +1,30 @@
+[
+ {
+ "caption": "Edit",
+ "mnemonic": "E",
+ "id": "edit",
+ "children":
+ [
+
+ {
+ "caption": "Tag",
+ "id": "tag",
+ "children":
+ [
+ {"caption":"-"},
+ {
+ "command": "tag_indent",
+ "id":"tag-indent-selection",
+ "caption":"Indent Tags on Selection"
+ },
+ {
+ "command": "tag_indent_document",
+ "id":"tag-indent-document",
+ "caption":"Indent Tags on Document"
+ },
+ {"caption":"-"}
+ ]
+ }
+ ]
+ }
+]
@@ -0,0 +1,14 @@
+{
+ /* TAG INDENT SETTINGS */
+
+ // example: <div class="clear"></div>
+ "empty_tags_close_on_same_line" : true,
+
+ // example: <div>this contains less than 80 characters</div>
+ "tags_with_little_content_on_same_line" : true,
+ "little_content_means_this_number_of_characters" : 60,
+
+ "preserve_additional_new_lines" : true
+
+ /* END TAG INDENT SETTINGS */
+}
@@ -0,0 +1,18 @@
+[
+ {
+ "caption": "Remove Picked Tags in Selection",
+ "command": "tag_remove_picked_in_selection"
+ },
+ {
+ "caption": "Remove Picked Tags in Document",
+ "command": "tag_remove_picked_in_document"
+ },
+ {
+ "caption": "Remove All Tags in Selection",
+ "command": "tag_remove_all_in_selection"
+ },
+ {
+ "caption": "Remove All Tags in Document",
+ "command": "tag_remove_all_in_document"
+ }
+]
@@ -0,0 +1,40 @@
+[
+ {
+ "caption": "Edit",
+ "mnemonic": "E",
+ "id": "edit",
+ "children":
+ [
+
+ {
+ "caption": "Tag",
+ "id": "tag",
+ "children":
+ [
+ {"caption":"-"},
+ {
+ "command": "tag_remove_picked_in_selection",
+ "id":"tag-remove-picked-in-selection",
+ "caption":"Remove Picked Tags in Selection"
+ },
+ {
+ "command": "tag_remove_picked_in_document",
+ "id":"tag-remove-picked-in-document",
+ "caption":"Remove Picked Tags in Document"
+ },
+ {
+ "command": "tag_remove_all_in_selection",
+ "id":"tag-remove-all-in-selection",
+ "caption":"Remove All Tags in Selection"
+ },
+ {
+ "command": "tag_remove_all_in_document",
+ "id":"tag-remove-all-in-document",
+ "caption":"Remove All Tags in Document"
+ },
+ {"caption":"-"}
+ ]
+ }
+ ]
+ }
+]
View
@@ -1 +0,0 @@
-{"url": "https://github.com/titoBouzout/Close-Tag-On-Slash-for-Sublime-Text", "version": "2011.10.08.19.13.58", "description": "A command for closing the nearest open HTML tag when pressing the \"/\" key in Sublime Text 2"}
View
@@ -0,0 +1,62 @@
+Description
+------------------
+
+"Tag" plugin is a collection of packages about tags, mixed together in an effort to provide a single package with utilities to work with tags.
+
+Currently provides: "Close tag on slash", "Tag indent" and "Tag Remove"
+
+Improvements and more features about tags are welcome on this package. Please submit these.
+
+Source / Installation
+------------------
+
+Convenient way to install this plugin is to use "Package Control" via http://wbond.net/sublime_packages/package_control
+
+Upgrade
+------------------
+
+If you already installed "Close tag on slash" or "Tag indent", please remove these packages first and the associated settings. "Close tag on slash" already provides keymap for "/", then if you already installed that keymap you may want to remove it.
+
+Close tag on slash
+------------------
+
+A command that is meant to be bound to the slash ("/") key in order to semi auto close open HTML tags (in part inspired by the discussion at http://www.sublimetext.com/forum/viewtopic.php?f=5&t=1358).
+Requires build 2111 or later of Sublime Text 2.
+
+*Usage*
+
+Runs automatically when inserting an Slash "/" into an HTML document.
+
+Tag Indent
+------------------
+
+Apply and/or add beauty indentation to HTML/XML/RDF/XUL tags found on selection(s).
+
+*Aims*
+
+Aims to add and/or apply correct indentation to little portions of HTML or XML, not to complete documents.
+
+*Usage*
+
+There is context menuitems called "Indent Tags on Selection", "Indent Tags on Document"
+
+There is also Main menuitems: Edit -> Tag -> "Indent Tags on Selection", "Indent Tags on Document"
+
+There is also commands "Indent Tags on Selection", "Indent Tags on Document"
+
+*Information*
+
+It takes the starting "indentation level" from the first line of each selection and sums tabs as needed.
+
+On empty tags, and on tags with less than 60 characters, it writes the tag in one line.
+
+Short-cut is "ctrl+shift+h"
+
+Tag Remove
+------------------
+
+Provides the ability to remove all tags or some selected tags in a document or in selection(s).
+
+*Usage*
+
+The main menu "Edit" -> "Tag" provide access to the commands
View
@@ -1,6 +1,6 @@
import sublime, sublime_plugin
-class CloseTagOnSlashCommand(sublime_plugin.TextCommand):
+class TagCloseTagOnSlashCommand(sublime_plugin.TextCommand):
def run(self, edit):
closeTags = False;
for region in self.view.sel():
@@ -15,4 +15,6 @@ def run(self, edit):
else:
self.view.replace(edit, sublime.Region(region.begin(), region.end()), '/');
if closeTags:
- self.view.run_command('close_tag');
+ self.view.run_command('close_tag');
+
+
Oops, something went wrong.

0 comments on commit 0d61d09

Please sign in to comment.