From 5c7aa8927536c1e7269a291cf6610932d664eb62 Mon Sep 17 00:00:00 2001 From: jjzmajic Date: Mon, 25 May 2020 16:27:54 +0800 Subject: [PATCH 1/2] Add dvtm terminal command. --- dvtm.kak | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/dvtm.kak b/dvtm.kak index 2327614..0db604c 100644 --- a/dvtm.kak +++ b/dvtm.kak @@ -10,15 +10,26 @@ hook global KakBegin .* %{ evaluate-commands %sh{ if [ -n "${DVTM}" ]; then echo " - alias global new dvtm-new-window + alias global terminal dvtm-terminal alias global focus dvtm-focus + alias global new dvtm-new " fi } } +define-command -params 1.. -shell-completion -docstring "Create a new terminal +and launch any arguments as a command in it." \ + dvtm-terminal %{ nop %sh{ + if [ -p "${DVTM_CMD_FIFO}" ]; then + printf %s\\n "create \"$@\"" > "${DVTM_CMD_FIFO}" + else + printf %s\\n 'echo -color Error No command socket available' + fi +} } + define-command -params .. -command-completion -docstring "Create a new window" \ - dvtm-new-window %{ evaluate-commands %sh{ + dvtm-new %{ evaluate-commands %sh{ params="" if [ $# -gt 0 ]; then ## `dvtm` requires those simple quotes to be escaped even within double quotes From e32ce14ebc2c232ce63f96b0ee2beded30ea0059 Mon Sep 17 00:00:00 2001 From: jjzmajic Date: Mon, 25 May 2020 16:29:01 +0800 Subject: [PATCH 2/2] Remove unsupported color option. --- dvtm.kak | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dvtm.kak b/dvtm.kak index 0db604c..78c62c8 100644 --- a/dvtm.kak +++ b/dvtm.kak @@ -24,7 +24,7 @@ and launch any arguments as a command in it." \ if [ -p "${DVTM_CMD_FIFO}" ]; then printf %s\\n "create \"$@\"" > "${DVTM_CMD_FIFO}" else - printf %s\\n 'echo -color Error No command socket available' + printf %s\\n 'echo Error No command socket available' fi } } @@ -40,7 +40,7 @@ define-command -params .. -command-completion -docstring "Create a new window" \ if [ -p "${DVTM_CMD_FIFO}" ]; then printf %s\\n "create \"kak -c ${kak_session} ${params}\"" > "${DVTM_CMD_FIFO}" else - printf %s\\n 'echo -color Error No command socket available' + printf %s\\n 'echo Error No command socket available' fi } } @@ -52,7 +52,7 @@ If no client is passed, then the current client is used} \ elif [ -p "${DVTM_CMD_FIFO}" ]; then printf %s\\n "focus ${kak_client_env_DVTM_WINDOW_ID}" > "${DVTM_CMD_FIFO}" else - printf %s\\n "echo -color Error No command socket available" + printf %s\\n "echo Error No command socket available" fi } } @@ -68,6 +68,6 @@ The tags arguments is a list of one or more tags to assign to the given client} printf %s\\n "echo -color Error %{ ${output} }" fi else - printf %s\\n "echo -color Error No command socket available" + printf %s\\n "echo Error No command socket available" fi } }