mirror of
https://github.com/LukeSmithxyz/st.git
synced 2025-04-03 02:11:09 +02:00
visual select using VIM
This commit is contained in:
parent
d2e4ab7e86
commit
357728d6b0
2 changed files with 21 additions and 0 deletions
11
config.h
11
config.h
|
@ -240,6 +240,16 @@ static char *openurlcmd[] = { "/bin/sh", "-c", "st-urlhandler -o", "externalpipe
|
|||
static char *copyurlcmd[] = { "/bin/sh", "-c", "st-urlhandler -c", "externalpipe", NULL };
|
||||
static char *copyoutput[] = { "/bin/sh", "-c", "st-copyout", "externalpipe", NULL };
|
||||
|
||||
const char * visualselectfmt =
|
||||
"win=`xdotool getactivewindow`;"
|
||||
"geom=%u\"x\"%u;"
|
||||
"tmp=`mktemp`;"
|
||||
"cat > $tmp;"
|
||||
"st -w $win -g $geom -e "
|
||||
"vim + +\"set nonumber norelativenumber laststatus=0 buftype=nowrite\" $tmp;"
|
||||
"rm $tmp"
|
||||
;
|
||||
extern void visualselect();
|
||||
|
||||
static Shortcut shortcuts[] = {
|
||||
/* mask keysym function argument */
|
||||
|
@ -268,6 +278,7 @@ static Shortcut shortcuts[] = {
|
|||
{ MODKEY, XK_l, externalpipe, {.v = openurlcmd } },
|
||||
{ MODKEY, XK_y, externalpipe, {.v = copyurlcmd } },
|
||||
{ MODKEY, XK_o, externalpipe, {.v = copyoutput } },
|
||||
{ Mod1Mask, XK_Escape, visualselect, {0} },
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
10
st.c
10
st.c
|
@ -1990,6 +1990,16 @@ externalpipe(const Arg *arg)
|
|||
signal(SIGPIPE, oldsigpipe);
|
||||
}
|
||||
|
||||
void
|
||||
visualselect (void)
|
||||
{
|
||||
extern const char * visualselectfmt;
|
||||
char visualselectcmd [200];
|
||||
snprintf (visualselectcmd, 200, visualselectfmt, (term.col + 2) % 10000, (term.row + 1) % 10000);
|
||||
|
||||
externalpipe (& (Arg) {.v = (char * []) { "/bin/sh", "-c", visualselectcmd, NULL }});
|
||||
}
|
||||
|
||||
void
|
||||
strdump(void)
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue