Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
pererinha committed Jun 2, 2014
0 parents commit 32ccb94
Show file tree
Hide file tree
Showing 9 changed files with 69 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Default (Linux).sublime-keymap
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[
{ "keys": ["ctrl+shift+c"], "command": "remove_extra_right_spaces" }
]
3 changes: 3 additions & 0 deletions Default (OSX).sublime-keymap
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[
{ "keys": ["super+shift+c"], "command": "remove_extra_right_spaces" }
]
3 changes: 3 additions & 0 deletions Default (Windows).sublime-keymap
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[
{ "keys": ["ctrl+shift+c"], "command": "remove_extra_right_spaces" }
]
6 changes: 6 additions & 0 deletions Default.sublime-commands
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[
{
"caption": "Remove extra right spaces",
"command": "remove_extra_right_spaces"
}
]
29 changes: 29 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Remove Extra Right Spaces

This Sublime plugin removes extra right spaces from each line of your code.

I hope you you find this plugin helpful.

### Why?



### Installation

For manual installation, run the following script in the Sublime Text terminal ```(ctrl+`)``` which utilizes ```git clone```.

```python
import os; path=sublime.packages_path(); (os.makedirs(path) if not os.path.exists(path) else None); window.run_command('exec', {'cmd': ['git', 'clone', 'https://github.com/pererinha/RemoveExtraRightSpaces', 'RemoveExtraRightSpaces'], 'working_dir': path})
```

**It is currently working just for Sublime 3**

### Usage
* On Mac **Command + Shift + C**
* On Windows or Linux **Ctrl + Shift + C**

Or

**Ctrl + Shift + P** and search for *“Remove extra right spaces”*


3 changes: 3 additions & 0 deletions messages.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"install": "messages/install.txt"
}
2 changes: 2 additions & 0 deletions messages/1.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
This is a beta release.
- Not tested on Linux, Windows.
7 changes: 7 additions & 0 deletions messages/install.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Thanks for installing the Remove Extra Right Spaces plugin.

This plugin removes extra right spaces from each line of your code.

I hope you you find this plugin helpful.

Github page https://github.com/pererinha/RemoveExtraRightSpaces.
13 changes: 13 additions & 0 deletions remove_right_spaces.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import sublime, sublime_plugin

class RemoveExtraRightSpacesCommand(sublime_plugin.TextCommand):
def run(self, edit):
# I have no idea why the self.view is not returning the region correctly
view = self.view.window().active_view()
region = sublime.Region(0, min(view.size(), 2**14))
content = view.substr(region)
new_content = ''
for line in content.split( '\n' ):
new_content += line.rstrip() + '\n'
view.replace(edit, region, new_content)

0 comments on commit 32ccb94

Please sign in to comment.