Skip to content

Commit

Permalink
Merge pull request #212 from richrd/dev
Browse files Browse the repository at this point in the history
v0.1.64
  • Loading branch information
richrd authored Dec 25, 2017
2 parents c6c4de2 + 12b812c commit 0955881
Show file tree
Hide file tree
Showing 45 changed files with 605 additions and 193 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
Change Log
==========

## [v0.1.64](https://github.com/richrd/suplemon/tree/v0.1.64) (2017-12-17) compared to previous master branch.
[Full Changelog](https://github.com/richrd/suplemon/compare/v0.1.63...v0.1.64)

**Implemented enhancements:**

- Add bulk_delete and sort_lines commands.
- Lots of code style fixes and improvements. Credit @Gnewbee
- Add xclip support for system clipboard. Credit @LChris314
- Added command docs to readme and help.


## [v0.1.63](https://github.com/richrd/suplemon/tree/v0.1.63) (2017-10-05) compared to previous master branch.
[Full Changelog](https://github.com/richrd/suplemon/compare/v0.1.62...v0.1.63)
Expand Down
155 changes: 123 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ http://github.com/richrd/suplemon
* Find, Find next and Find all (Ctrl + F, Ctrl + D, Ctrl + A)
* Custom keyboard shortcuts (and easy-to-use defaults)
* Mouse support
* Restores cursor positions in when reopenning files
* Restores cursor and scroll positions when reopenning files
* Extensions (easy to write your own)
* Lots more...

Expand Down Expand Up @@ -81,7 +81,7 @@ No dependencies outside the Python Standard Library required.
* Flake8
> For showing linting for Python files.
* xsel
* xsel or xclip
> For system clipboard support on X Window (Linux).
* pbcopy / pbpaste
Expand All @@ -97,13 +97,6 @@ It is as easy as nano, and has much of the power of Sublime Text. It also suppor
to allow all kinds of customizations. To get more help hit ```Ctrl + H``` in the editor.
Suplemon is licensed under the MIT license.

## Goals
1. [X] Create a command line text editor with built in multi cursor support. It's awesome!
2. [X] Usability should be even better and easier than nano. It's on par with desktop editors.
3. [X] Multi cursor should be comparable to Sublime Text.
4. [X] Develop Suplemon with Suplemon!!! I've used Suplemon for a long time as my main
editor (replacing ST and nano) for all developement, Git commits and everything else.

## Configuration

### Main Config
Expand Down Expand Up @@ -215,6 +208,127 @@ To view the default keymap file run ```keymap default```
* Scroll Wheel Up / Down
> Scroll up & down.
## Commands

Suplemon has various add-ons that implement extra features.
The commands can be run with <kbd>Ctrl</kbd> + <kbd>E</kbd> and the prompt has autocomplete to make running them faster.
The available commands and their descriptions are:

* autocomplete

A simple autocompletion module.

This adds autocomplete support for the tab key. It uses a word
list scanned from all open files for completions. By default it suggests
the shortest possible match. If there are no matches, the tab action is
run normally.

* autodocstring

Simple module for adding docstring placeholders.

This module is intended to generate docstrings for Python functions.
It adds placeholders for descriptions, arguments and return data.
Function arguments are crudely parsed from the function definition
and return statements are scanned from the function body.

* bulk_delete

Bulk delete lines and characters.
Asks what direction to delete in by default.

Add 'up' to delete lines above highest cursor.
Add 'down' to delete lines below lowest cursor.
Add 'left' to delete characters to the left of all cursors.
Add 'right' to delete characters to the right of all cursors.

* comment

Toggle line commenting based on current file syntax.

* config

Shortcut for openning the config files.

* diff

View a diff of the current file compared to it's on disk version.

* eval

Evaluate a python expression and show the result in the status bar.

If no expression is provided the current line(s) are evaluated and
replaced with the evaluation result.

* keymap

Shortcut to openning the keymap config file.

* linter

Linter for suplemon.

* lower

Transform current lines to lower case.

* lstrip

Trim whitespace from beginning of current lines.

* paste

Toggle paste mode (helpful when pasting over SSH if auto indent is enabled)

* reload

Reload all add-on modules.

* replace_all

Replace all occurrences in all files of given text with given replacement.

* reverse

Reverse text on current line(s).

* rstrip

Trim whitespace from the end of lines.

* save

Save the current file.

* save_all

Save all currently open files. Asks for confirmation.

* sort_lines

Sort current lines.

Sorts alphabetically by default.
Add 'length' to sort by length.
Add 'reverse' to reverse the sorting.

* strip

Trim whitespace from start and end of lines.

* tabstospaces

Convert tab characters to spaces in the entire file.

* toggle_whitespace

Toggle visually showing whitespace.

* upper

Transform current lines to upper case.


## Support

Expand All @@ -238,29 +352,6 @@ PRs are very welcome and appreciated.
When making PRs make sure to set the target branch to `dev`. I only push to master when releasing new versions.


## Todo
* [ ] Design proper API for plugins/extensions/macros
* [ ] Documentation for v 1.0.0

## Wishlist (Stuff that would be nice, but not planning to do yet. *Maybe* for 2.0.0)
* [ ] Core
* [ ] Setting for enabling/disabling undo for cursor changes
* [ ] Selections
* [ ] List of recent files
* [X] Optionally Remember cursor positions in files (and restore when opened again)
* [ ] Read only viewer
* ~~And disable editing~~ Don't disable editing. Instead enable save as.
* [ ] Extensions:
* [ ] Peer to peer colaborative editing. Could be implemented as an extension.
* [ ] Auto backup. Activate on n changes or every n seconds
* [ ] File selector, kind of like what nano has
* [ ] This should be implemented as an extension
* [ ] Could be triggered with a key binding (and/or override open file)
* [ ] Need to refactor App class to support views instead of just files
* [ ] A view could be an editor or an extension ui
* [ ] Extensions should be able to control both status bars and key legend


## Rationale
For many the command line is a different environment for text editing.
Most coders are familiar with GUI text editors and for many vi and emacs
Expand Down
3 changes: 1 addition & 2 deletions suplemon/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import json
import logging

from . import helpers
from . import suplemon_module


Expand Down Expand Up @@ -161,7 +160,7 @@ def remove_config_comments(self, data):
cleaned = []
for line in lines:
line = line.strip()
if helpers.starts(line, "//") or helpers.starts(line, "#"):
if line.startswith(("//", "#")):
continue
cleaned.append(line)
return "\n".join(cleaned)
Expand Down
9 changes: 3 additions & 6 deletions suplemon/editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -484,13 +484,12 @@ def copy(self):
copy_buffer = []
# Get all lines with cursors on them
line_nums = self.get_lines_with_cursors()
i = 0
while i < len(line_nums):

for i in range(len(line_nums)):
# Get the line
line = self.lines[line_nums[i]]
# Put it in our temporary buffer
copy_buffer.append(line.get_data())
i += 1
self.set_buffer(copy_buffer)
self.store_action_state("copy")

Expand All @@ -502,8 +501,7 @@ def cut(self):
line_nums = self.get_lines_with_cursors()
# Sort from last to first (invert order)
line_nums = line_nums[::-1]
i = 0
while i < len(line_nums): # Iterate from last to first
for i in range(len(line_nums)): # Iterate from last to first
# Make sure we don't completely remove the last line
if len(self.lines) == 1:
cut_buffer.append(self.lines[0])
Expand All @@ -517,7 +515,6 @@ def cut(self):
cut_buffer.append(line)
# Move all cursors below the current line up
self.move_y_cursors(line_no, -1)
i += 1
self.move_cursors() # Make sure cursors are in valid places
# Reverse the buffer to get correct order and store it
self.set_buffer(cut_buffer[::-1])
Expand Down
116 changes: 116 additions & 0 deletions suplemon/help.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,4 +133,120 @@
and then typing the command name. Commands are extensions and are stored in
the modules folder in the Suplemon installation.
* autocomplete
A simple autocompletion module.
This adds autocomplete support for the tab key. It uses a word
list scanned from all open files for completions. By default it suggests
the shortest possible match. If there are no matches, the tab action is
run normally.
* autodocstring
Simple module for adding docstring placeholders.
This module is intended to generate docstrings for Python functions.
It adds placeholders for descriptions, arguments and return data.
Function arguments are crudely parsed from the function definition
and return statements are scanned from the function body.
* bulk_delete
Bulk delete lines and characters.
Asks what direction to delete in by default.
Add 'up' to delete lines above highest cursor.
Add 'down' to delete lines below lowest cursor.
Add 'left' to delete characters to the left of all cursors.
Add 'right' to delete characters to the right of all cursors.
* comment
Toggle line commenting based on current file syntax.
* config
Shortcut for openning the config files.
* diff
View a diff of the current file compared to it's on disk version.
* eval
Evaluate a python expression and show the result in the status bar.
If no expression is provided the current line(s) are evaluated and
replaced with the evaluation result.
* keymap
Shortcut to openning the keymap config file.
* linter
Linter for suplemon.
* lower
Transform current lines to lower case.
* lstrip
Trim whitespace from beginning of current lines.
* paste
Toggle paste mode (helpful when pasting over SSH if auto indent is enabled)
* reload
Reload all add-on modules.
* replace_all
Replace all occurrences in all files of given text with given replacement.
* reverse
Reverse text on current line(s).
* rstrip
Trim whitespace from the end of lines.
* save
Save the current file.
* save_all
Save all currently open files. Asks for confirmation.
* sort_lines
Sort current lines.
Sorts alphabetically by default.
Add 'length' to sort by length.
Add 'reverse' to reverse the sorting.
* strip
Trim whitespace from start and end of lines.
* tabstospaces
Convert tab characters to spaces in the entire file.
* toggle_whitespace
Toggle visually showing whitespace.
* upper
Transform current lines to upper case.
"""
Loading

0 comments on commit 0955881

Please sign in to comment.