Skip to content

Commit

Permalink
Merge pull request #324 from smostertdev/lineoperations
Browse files Browse the repository at this point in the history
Add new "Lineoperations" plugin
  • Loading branch information
frlan committed Jan 17, 2016
2 parents 1477a80 + 115fdb2 commit 7c1d98d
Show file tree
Hide file tree
Showing 15 changed files with 1,118 additions and 1 deletion.
7 changes: 6 additions & 1 deletion MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ M: Colomban Wendling <[email protected]>
W:
S: Maintained


debugger
P: Alexander Petukhov <[email protected]>
M: Alexander Petukhov <[email protected]>
Expand Down Expand Up @@ -168,6 +167,12 @@ M: Colomban Wendling <[email protected]>
W: http://plugins.geany.org/git-changebar.html
S: Maintained

lineoperations
P: Sylvan Mostert <[email protected]>
M: Sylvan Mostert <[email protected]>
W:
S: Maintained

markdown
P: Matthew Brush <[email protected]>
M: Matthew Brush <[email protected]>
Expand Down
4 changes: 4 additions & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,10 @@ if ENABLE_GITCHANGEBAR
SUBDIRS += git-changebar
endif

if ENABLE_LINEOPERATIONS
SUBDIRS += lineoperations
endif

if ENABLE_MARKDOWN
SUBDIRS += markdown
endif
Expand Down
9 changes: 9 additions & 0 deletions build/lineoperations.m4
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
AC_DEFUN([GP_CHECK_LINEOPERATIONS],
[
GP_ARG_DISABLE([LineOperations], [auto])
GP_COMMIT_PLUGIN_STATUS([LineOperations])
AC_CONFIG_FILES([
lineoperations/Makefile
lineoperations/src/Makefile
])
])
1 change: 1 addition & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ GP_CHECK_GEANYVC
GP_CHECK_GEANYPG
GP_CHECK_GENIUSPASTE
GP_CHECK_GITCHANGEBAR
GP_CHECK_LINEOPERATIONS
GP_CHECK_MARKDOWN
GP_CHECK_MULTITERM
GP_CHECK_OVERVIEW
Expand Down
1 change: 1 addition & 0 deletions lineoperations/AUTHORS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Sylvan Mostert <[email protected]>
340 changes: 340 additions & 0 deletions lineoperations/COPYING

Large diffs are not rendered by default.

Empty file added lineoperations/ChangeLog
Empty file.
4 changes: 4 additions & 0 deletions lineoperations/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
include $(top_srcdir)/build/vars.auxfiles.mk

SUBDIRS = src
plugin = lineoperations
Empty file added lineoperations/NEWS
Empty file.
222 changes: 222 additions & 0 deletions lineoperations/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,222 @@
===============
Line Operations
===============

.. contents::

About
=====

Line Operations is an assortment of simple line functions that can be
applied to an open file.

Features
========

* Remove Duplicate Lines, sorted
* Remove Duplicate Lines, ordered
* Remove Unique Lines
* Remove Empty Lines
* Remove Whitespace Lines
* Sort Lines Ascending
* Sort Lines Descending

Usage
=====

After the plugins has been installed successfully, load the plugin via
Geany's plugin manager and a new menu item in the Tools menu will
appear. Click on each menu item to apply the operation on whole file.
See descriptions below to see operations for each menu item.

Notes
-----

* Line Operations will **not** make changes to a file until you save
the file.


Operation Details
=================

Remove Duplicate Lines
----------------------

The first occurrence of each duplicate line will remain in the file.
The **Sorted** option will sort the file and remove duplicate lines
[fast on large files]. The **Ordered** option will keep the same order
of lines [slow on large files].

Example: Suppose a file has the following lines. (#comments added for
clarity)

::

Line 2
Line 1
Line 2 #removed
Line 3
Line 1 #removed
Line 2 #removed

The **Remove Duplicate Lines, sorted** will change the file into this:

::

Line 1
Line 2
Line 3

The **Remove Duplicate Lines, ordered** will change the file into
this:

::

Line 2
Line 1
Line 3



Remove Unique Lines
-------------------

Removes all lines that appear only once.

Example: Suppose a file has the following lines. (#comments added for
clarity)

::

Line 2
Line 1
Line 2
Line 3 #removed
Line 1
Line 2

The **Remove Unique Lines** will change the file into this:

::

Line 2
Line 1
Line 2
Line 1
Line 2

Remove Empty Lines
------------------

Removes all lines that only contain a newline character, and no other
characters.

Example: Suppose a file has the following lines. (#comments, and
\\n newline characters added for clarity)

::

Line 2\n
Line 1\n
\n #removed
\n #NOT removed (contains spaces)
Line 1\n
Line 2\n

The **Remove Empty Lines** will change the file into this:

::

Line 2\n
Line 1\n
\n
Line 1\n
Line 2\n


Remove Whitespace Lines
-----------------------

Removes all lines that have only whitespace characters.


Example: Suppose a file has the following lines. (#comments, and \\n
newline characters added for clarity)

::

Line 2\n
Line 1\n
\n #removed
\n #removed (contains only whitespace chars)
\t \n #removed (contains only whitespace chars)
Line 1\n #NOT removed (contains non whitespace chars)
Line 2\n

The **Remove Whitespace Lines** will change the file into this:

::

Line 2\n
Line 1\n
Line 1\n
Line 2\n

Sort Lines
----------

Sorts lines ascending or descending based on ASCII values
(lexicographic sort).


Example: Suppose a file has the following lines.

::

line 1
line 2
line
line 3
line

The **Sort Lines Ascending** will change the file into this:

::

line
line
line 1
line 2
line 3


The **Sort Lines Descending** will change the file into this:

::

line 3
line 2
line 1
line
line


License
=======

The Line Operations plugin is distributed under the terms of the GNU
General Public License as published by the Free Software Foundation;
either version 2 of the License, or (at your option) any later version.
A copy of this license can be found in the file COPYING included with
the source code of this program.

Ideas, questions, patches and bug reports
=========================================

Please direct all questions, bug reports and patches to the plugin
author using the email address listed below or to the Geany mailing
list to get some help from other Geany users, or report them at
https://github.com/geany/geany-plugins/issues.



12 changes: 12 additions & 0 deletions lineoperations/src/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
include $(top_srcdir)/build/vars.build.mk

geanyplugins_LTLIBRARIES = lineoperations.la

lineoperations_la_SOURCES = \
linefunctions.h \
linefunctions.c \
lineoperations.c

lineoperations_la_LIBADD = $(COMMONLIBS)

include $(top_srcdir)/build/cppcheck.mk
Loading

0 comments on commit 7c1d98d

Please sign in to comment.