Introduction
Introduction Statistics Contact Development Disclaimer Help
config.def.h - sob - simple output bar
git clone git://git.codemadness.org/sob
Log
Files
Refs
README
LICENSE
---
config.def.h (3177B)
---
1 /* <green color> "> " <reset>, like mksh you can use '\x01' to stop coun…
2 * the characters for the prompt length. */
3 static const char *prompt = "\x01\x1b[32m\x01> \x01\x1b[0m";
4 static const char *completenickcmd[] = { "/bin/sh", "-c", "$HOME/.sob/sc…
5 static const char *historycmd[] = { "/bin/sh", "-c", "$HOME/.sob/sc…
6 static const char *yankcmd[] = { "/bin/sh", "-c", "/bin/xsel -i …
7 static const char *resizecmd[] = { "/bin/sh", "-c", "$HOME/.sob/sc…
8
9 static void
10 line_yank(void)
11 {
12 line_pipeto((char**)yankcmd, NULL);
13 }
14
15 static void
16 history_menu(void)
17 {
18 line_pipeto((char**)historycmd, cb_pipe_insert);
19 }
20
21 static void
22 complete_nick(void)
23 {
24 line_wordpipeto((char**)completenickcmd, cb_pipe_replaceword);
25 }
26
27 #define CONTROL(ch) ((ch)^0x40)
28 #define ALT(ch) '\x1b',ch,'\0'
29
30 #define KEY_HOME "\x1b\x5b\x31\x7e"
31 #define KEY_END "\x1b\x5b\x34\x7e"
32 #define KEY_CTRL_LEFT "\x1b\x5b\x31\x3b\x35\x44"
33 #define KEY_CTRL_RIGHT "\x1b\x5b\x31\x3b\x35\x43"
34 /* Del */
35 #define KEY_DC "\x1b\x5b\x33\x7e"
36 /* SS3 DECCKM keys */
37 #define KEY_UP "\x1b\x4f\x41"
38 #define KEY_DOWN "\x1b\x4f\x42"
39 #define KEY_RIGHT "\x1b\x4f\x43"
40 #define KEY_LEFT "\x1b\x4f\x44"
41 /* CSI keys */
42 #define KEY_CSI_UP "\x1b\x5b\x41"
43 #define KEY_CSI_DOWN "\x1b\x5b\x42"
44 #define KEY_CSI_RIGHT "\x1b\x5b\x43"
45 #define KEY_CSI_LEFT "\x1b\x5b\x44"
46
47 static struct keybind {
48 unsigned char key[16];
49 void (*func)(void);
50 } keybinds[] = {
51 { { CONTROL('A') }, line_cursor_begin },
52 { { CONTROL('E') }, line_cursor_end },
53 { { KEY_HOME }, line_cursor_begin },
54 { { KEY_END }, line_cursor_end },
55 { { CONTROL('B') }, line_cursor_prev },
56 { { KEY_LEFT }, line_cursor_prev },
57 { { KEY_CSI_LEFT }, line_cursor_prev },
58 { { CONTROL('F') }, line_cursor_next },
59 { { KEY_RIGHT }, line_cursor_next },
60 { { KEY_CSI_RIGHT }, line_cursor_next },
61 { { ALT('b') }, line_cursor_wordprev },
62 { { ALT('f') }, line_cursor_wordnext },
63 { { KEY_CTRL_LEFT }, line_cursor_wordprev },
64 { { KEY_CTRL_RIGHT }, line_cursor_wordnext },
65 { { CONTROL('W') }, line_delwordprev },
66 { { CONTROL('H') }, line_delcharprev },
67 { { 127 }, line_delcharprev },
68 { { '\b' }, line_delcharprev },
69 { { CONTROL('U') }, line_clear },
70 { { CONTROL('K') }, line_deltoend },
71 { { KEY_DC }, line_delcharnext },
72 { { CONTROL('H') }, line_delcharprev },
73 { { CONTROL('M') }, line_newline },
74 { { CONTROL('J') }, line_newline },
75 { { '\r' }, line_newline },
76 { { '\n' }, line_newline },
77 { { CONTROL('Y') }, line_yank },
78 { { CONTROL('D') }, line_exit },
79 { { CONTROL('E') }, line_deltoend },
80 { { KEY_UP }, history_menu },
81 { { KEY_CSI_UP }, history_menu },
82 { { KEY_DOWN }, history_menu },
83 { { KEY_CSI_DOWN }, history_menu },
84 { { CONTROL('P') }, history_menu },
85 { { CONTROL('N') }, history_menu },
86 { { '\t' }, complete_nick },
87 };
You are viewing proxied material from codemadness.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.