From 06bd66b4a8d3bf94ecb82f22e05056ae79ccf81b Mon Sep 17 00:00:00 2001 From: "Michael D. Lowis" Date: Tue, 31 Jan 2017 19:08:17 -0500 Subject: [PATCH] added functions to rc file for adding and removing line numbers as well as trimming trailing whitespace --- Makefile | 3 ++- TODO.md | 1 - editrc | 6 ++++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index a5aef78..9f2f0a5 100644 --- a/Makefile +++ b/Makefile @@ -57,4 +57,5 @@ libedit.a: $(LIBEDIT_OBJS) unittests: $(TEST_OBJS) libedit.a --include *.d lib/*.d tests/*.d \ No newline at end of file +-include *.d lib/*.d tests/*.d + diff --git a/TODO.md b/TODO.md index d3ee034..7a20daa 100644 --- a/TODO.md +++ b/TODO.md @@ -23,7 +23,6 @@ The Rest: * shortcut to repeat previous operation * implement command diffing logic to optimize the undo/redo log - The Future: * Run commands in the background and don't block the main thread. diff --git a/editrc b/editrc index a984698..4d76221 100644 --- a/editrc +++ b/editrc @@ -27,3 +27,9 @@ ucmt(){ sed -e 's/^#//'; } # Expand tabs to spaces etabs(){ sed -e 's/\t/ /g'; } +# Add a line number to each line of the file +lnnum(){ sed -e = | sed -e 'N;s/\n/\t/'; } +nolnnum(){ sed -e 's/^[0-9]\+\t//'; } + +# Trim trailing whitspace +trim(){ sed -e 's/[\t ]\+$//'; } -- 2.52.0