Introduction
Introduction Statistics Contact Development Disclaimer Help
Updated rc handling. - sam - An updated version of the sam text editor.
git clone git://vernunftzentrum.de/sam.git
Log
Files
Refs
LICENSE
---
commit 5251c5d5b88a42a48abf2166f923e3bc87cf85eb
parent 13e3d1905435de5371115508342439626e179efa
Author: Rob King <[email protected]>
Date: Fri, 9 Sep 2016 15:54:31 -0500
Updated rc handling.
Diffstat:
doc/samrc | 32 +++++++++++++++++++------------
samterm/samrc.c | 24 ++++++++++++------------
2 files changed, 32 insertions(+), 24 deletions(-)
---
diff --git a/doc/samrc b/doc/samrc
@@ -1,42 +1,50 @@
-# This is a sample samrc file that sets up samterm the
-# way I like it. This offers a good starting point for
-# your own customized version.
+# This is samrc as I usually use it.
-# Control-A and Control-E jump to beginning/end of line
+# Control-A/E jumps to beginning/end of line
bind C a command bol
bind C e command eol
-# Control-H/L/J/K move left/right/down/up
+# Control-H/L/J/K moves left/right/down/up
bind C h command charleft
bind C l command charright
bind C j command linedown
bind C k command lineup
-# Control-Space highlights recently-typed text
+# Control-Space highlights recent text
bind C space command escape
-# Escape jumps between command file and working file
+# Escape jumps between command file and current file
bind n Escape command jump
-# Control-U deletes to beginning of line
+# Control-U deletes to beginning of lien
bind C u command delbol
# Control-W/BackSpace deletes previous word
bind C w command delword
bind C BackSpace command delword
-# Control-X/C/V does cut/snarf/paste
+# Control-X/C/V/Q does cut/snarf/paste/exchange
bind C x command cut
bind C c command snarf
bind C v command paste
-
-# Control-Q exchanges snarf buffers with windowing system
bind C q command exchange
-# Up/Down/Left/Right/PageUp/PageDown work as expected
+# Arrow keys and Page Up/Down work as expected
bind n Up command lineup
bind n Down command linedown
bind n Left command charleft
bind n Right command charright
bind n Prior command scrollup
bind n Next command scrolldown
+
+# I like 13pt Inconsolata
+font Inconsolata:size=13
+
+# Use black for text and borders, and an angry fruit salad for backgrounds
+foreground black
+border black
+background white:seashell:lightgreen:oldlace:lightcyan:gainsboro:lightyellow:m…
+
+# Expand tabs and have tabstops every four columns
+tabs 4
+expandtabs
diff --git a/samterm/samrc.c b/samterm/samrc.c
@@ -9,6 +9,9 @@
#include <u.h>
#include <libg.h>
+extern int expandtabs;
+extern int tabwidth;
+
typedef struct Namemapping Namemapping;
struct Namemapping{
const char *name;
@@ -64,15 +67,7 @@ static Namemapping buttonmapping[] ={
static Namemapping modmapping[] ={
{"n", 0},
{"c", ControlMask},
- {"a", Mod1Mask},
- {"m", Mod1Mask},
- {"s", Mod2Mask},
- {"h", Mod3Mask},
- {"1", Mod1Mask},
- {"2", Mod2Mask},
- {"3", Mod3Mask},
- {"4", Mod4Mask},
- {"5", Mod5Mask},
+ {"s", ShiftMask},
{NULL, 0}
};
@@ -223,8 +218,9 @@ loadrcfile(FILE *f)
char cname[1024] = {0};
char tname[1024] = {0};
char c = 0;
- unsigned short i = 0;
+ unsigned short s = 0;
int rc = 0;
+ int i = 0;
ln++;
if (r == 0 || l[0] == '\n' || l[0] == 0 || sscanf(l, " %[#]", &c) == 1)
@@ -232,9 +228,9 @@ loadrcfile(FILE *f)
if (sscanf(l, " chord %5[Nn12345] %5[Nn12345] %99s %99s", s1, s2, cnam…
rc = installchord(statetomask(s1, buttonmapping), statetomask(s2, …
- else if (sscanf(l, " bind %5[ncamshNCAMSH12345] %99s raw %hx", s1, s2,…
+ else if (sscanf(l, " bind %5[ncamshNCAMSH12345] %99s raw 0x%hx", s1, s…
rc = installbinding(statetomask(s1, modmapping), XStringToKeysym(s…
- else if (sscanf(l, " bind %5[ncamshNCAMSH12345] %99s composed %hx", s1…
+ else if (sscanf(l, " bind %5[ncamshNCAMSH12345] %99s composed 0x%hx", …
rc = installbinding(statetomask(s1, modmapping), XStringToKeysym(s…
else if (sscanf(l, " bind %5[ncamshNCAMSH12345] %99s raw %c", s1, s2, …
rc = installbinding(statetomask(s1, modmapping), XStringToKeysym(s…
@@ -250,6 +246,10 @@ loadrcfile(FILE *f)
strncpy(borderspec, cname, sizeof(borderspec) - 1);
else if (sscanf(l, " font %1023s", cname) == 1)
strncpy(fontspec, cname, sizeof(fontspec) - 1);
+ else if (sscanf(l, " tabs %hu", &s) == 1 && s < 12 && s > 0)
+ tabwidth = s;
+ else if (sscanf(l, " expandtabs%n", &i) == 0 && i)
+ expandtabs = 1;
else
fprintf(stderr, "invalid rc line %zd\n", ln);
You are viewing proxied material from vernunftzentrum.de. 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.