sandy

text editor
git clone git://git.suckless.org/sandy
Log | Files | Refs | README | LICENSE

commit 2a4c24acaabb84104854563f0c7734755603db60
parent fab992d9be562bc73ad17c9854bbdbf4a02633ab
Author: Rafael Garcia <rafael.garcia.gallego@gmail.com>
Date:   Sun,  7 Aug 2011 18:26:00 +0200

Some useful keybindings are back, using META since they are minor and optional.
Diffstat:
config.def.h | 23+++++++++++++++--------
sandy.1 | 20+++++++++++++++-----
2 files changed, 30 insertions(+), 13 deletions(-)

diff --git a/config.def.h b/config.def.h @@ -27,11 +27,13 @@ static const char nlstr[1] = { 0 }; "else printf \"\033[0;0H\033[7m"prompt"\033[K\033[0m \" >&2; read arg; fi &&" \ "echo " cmd "\"$arg\" > ${SANDY_FIFO}", NULL } } -#define FIND PROMPT("Find:", "${SANDY_FIND}", "/") -#define FINDBW PROMPT("Find (back):", "${SANDY_FIND}", "?") -#define PIPE PROMPT("Pipe:", "${SANDY_PIPE}", "!") -#define SAVEAS PROMPT("Save as:", "${SANDY_FILE}", "w") -#define CMD_P PROMPT("Command:", "/\n?\nw\n!\nsyntax\noffset", "") +#define FIND PROMPT("Find:", "${SANDY_FIND}", "/") +#define FINDBW PROMPT("Find (back):", "${SANDY_FIND}", "?") +#define PIPE PROMPT("Pipe:", "${SANDY_PIPE}", "!") +#define SAVEAS PROMPT("Save as:", "${SANDY_FILE}", "w") +#define REPLACE PROMPT("Replace:", "", "!echo 2>/dev/null -n ") +#define SED PROMPT("Sed:", "", "!sed 2>/dev/null ") +#define CMD_P PROMPT("Command:", "/\n?\nw\n!\nsyntax\noffset", "") /* Args to f_pipe / f_pipero */ /* TODO: make sandy-sel to wrap xsel or standalone */ @@ -55,10 +57,11 @@ static const char nlstr[1] = { 0 }; static const Key curskeys[] = { /* Plain keys here, no CONTROL or META */ /* keyv.i, tests, func, arg */ { .keyv.i = KEY_BACKSPACE, { t_rw, 0, 0, 0 }, f_delete, { .m = m_prevchar } }, -{ .keyv.i = KEY_DC, { t_sel, t_rw, 0, 0 }, f_delete, { .m = m_tosel } }, +{ .keyv.i = KEY_DC, { t_sel, t_rw, 0, 0 }, f_pipe, TOCLIP }, { .keyv.i = KEY_DC, { t_rw, 0, 0, 0 }, f_delete, { .m = m_nextchar } }, { .keyv.i = KEY_IC, { t_sel, 0, 0, 0 }, f_pipero, TOCLIP }, -{ .keyv.i = KEY_SDC, { t_sel, t_rw, 0, 0 }, f_pipe, TOCLIP }, +{ .keyv.i = KEY_SDC, { t_sel, t_rw, 0, 0 }, f_delete, { .m = m_tosel } }, +{ .keyv.i = KEY_SDC, { t_rw, 0, 0, 0 }, f_delete, { .m = m_prevchar } }, { .keyv.i = KEY_SIC, { t_rw, 0, 0, 0 }, f_pipe, FROMCLIP }, { .keyv.i = KEY_HOME, { 0, 0, 0, 0 }, f_moveb, { .m = m_bol } }, { .keyv.i = KEY_END, { 0, 0, 0, 0 }, f_moveb, { .m = m_eol } }, @@ -93,6 +96,7 @@ static const Key stdkeys[] = { { .keyv.c = CONTROL('F'), { 0, 0, 0, 0 }, f_move, { .m = m_nextchar } }, { .keyv.c = META('f'), { 0, 0, 0, 0 }, f_move, { .m = m_nextword } }, { .keyv.c = CONTROL('G'), { t_sel, 0, 0, 0 }, f_select, { .m = m_stay } }, +{ .keyv.c = CONTROL('H'), { t_sel, t_rw, 0, 0 }, f_delete, { .m = m_tosel } }, { .keyv.c = CONTROL('H'), { t_rw, 0, 0, 0 }, f_delete, { .m = m_prevchar } }, { .keyv.c = CONTROL('I'), { t_rw, 0, 0, 0 }, f_insert, { .v = "\t" } }, { .keyv.c = CONTROL('J'), { t_rw, 0, 0, 0 }, f_insert, { .v = "\n" } }, @@ -126,10 +130,13 @@ static const Key stdkeys[] = { { .keyv.c = CONTROL('Y'), { t_rw, 0, 0, 0 }, f_pipe, FROMCLIP }, { .keyv.c = CONTROL('Z'), { 0 ,0, 0, 0 }, f_suspend, { 0 } }, { .keyv.c = CONTROL('['), { 0, 0, 0, 0 }, f_spawn, CMD_P }, -{ .keyv.c = CONTROL('\\'),{ 0, 0, 0, 0 }, f_spawn, PIPE }, +{ .keyv.c = CONTROL('\\'),{ t_rw, 0, 0, 0 }, f_spawn, PIPE }, +{ .keyv.c = META('\\'), { t_rw, 0, 0, 0 }, f_spawn, SED }, { .keyv.c = CONTROL(']'), { 0, 0, 0, 0 }, f_extsel, { .i = ExtDefault } }, { .keyv.c = CONTROL('^'), { t_redo,t_rw, 0, 0 }, f_undo, { .i = -1 } }, { .keyv.c = CONTROL('^'), { t_rw, 0, 0, 0 }, f_repeat, { 0 } }, +{ .keyv.c = META('6'), { t_rw, 0, 0, 0 }, f_pipelines, { .v = "tr -d '\n'" } }, +{ .keyv.c = META('5'), { t_sel, t_rw, 0, 0 }, f_spawn, REPLACE }, { .keyv.c = CONTROL('_'), { t_undo,t_rw, 0, 0 }, f_undo, { .i = 1 } }, { .keyv.c = CONTROL('?'), { t_rw, 0, 0, 0 }, f_delete, { .m = m_prevchar } }, { .keyv.c = META(','), { 0, 0, 0, 0 }, f_move, { .m = m_bof } }, diff --git a/sandy.1 b/sandy.1 @@ -127,12 +127,13 @@ Move to the opposite size of the selection, usually to modify it. .SS Deleting Unlike in most other text editors, inserting text while a selection is active does not delete its content. .TP -.BR Ctrl\-d " or " Delete " or " Shift\-Delete -Delete ithe current selection if any or the character under the cursor -otherwise. Ctrl\-d and Shift\-Delete put the selection in the clipboard while -Dlete just kills it. +.BR Ctrl\-d " or " Delete +Kill the current selection and put it in the clipboard. If there is no selection, delete next character. .TP -.BR Ctrl\-h " or " Backspace +.BR Ctrl\-h " or " Shift\-Delete +Delete the current selection if any. Otherwise delete previous character. +.TP +.BR Backspace Delete previous character. .TP .B Ctrl\-u @@ -159,6 +160,15 @@ These operations affect the selected text if any. .B Ctrl\-\e Prompt for a command to pipe text through. .TP +.B Meta\-\e +Prompt for a sed command to pipe text through. +.TP +.B Meta\-5 +Prompt for a literal string to replace the text. +.TP +.B Meta\-6 +Delete newline characters, joining lines. +.TP .B Meta\-c Capitalize selection. .TP