mirror of
https://github.com/mawww/kakoune.git
synced 2024-11-24 07:53:41 +03:00
add client.kak providing 'new' command for opening a new client
Autodetect tmux, use tmux if we are in a tmux session, else fallback to urxvt.
This commit is contained in:
parent
feef062344
commit
5939eb219f
@ -454,3 +454,9 @@ Existing commands files are:
|
||||
* *rc/ctags.kak*: provides the +tag+ command to jump on a tag definition using
|
||||
exuberant ctags files, this script requires the *readtags* binary, available
|
||||
in the exuberant ctags package but not installed by default.
|
||||
* *rc/client.kak*: provides the +new+ command to launch a new client on the current
|
||||
session, if tmux is detected, launch the client in a new tmux split, else
|
||||
launch in a new terminal emulator.
|
||||
|
||||
Certain command files defines options, such as grepcmd (for :grep) or
|
||||
termcmd (for :new).
|
||||
|
@ -23,6 +23,6 @@ XDG_CONFIG_HOME ?= $(HOME)/.config
|
||||
|
||||
userconfig:
|
||||
mkdir -p $(XDG_CONFIG_HOME)/kak/autoload
|
||||
ln -rs rc/{asciidoc,cpp,diff,git,grep,kakrc,make}.kak $(XDG_CONFIG_HOME)/kak/autoload/
|
||||
ln -rs rc/{asciidoc,client,cpp,diff,git,grep,kakrc,make}.kak $(XDG_CONFIG_HOME)/kak/autoload/
|
||||
|
||||
.PHONY: tags userconfig
|
||||
|
13
src/rc/client.kak
Normal file
13
src/rc/client.kak
Normal file
@ -0,0 +1,13 @@
|
||||
setg termcmd %sh{
|
||||
if [[ -n "$TMUX" ]]; then
|
||||
echo "'tmux split-window -h'"
|
||||
else
|
||||
echo "'urxvt -e sh -c'"
|
||||
fi
|
||||
}
|
||||
|
||||
def new -shell-params %{ nop %sh{
|
||||
if (( $# != 0 )); then kakoune_params="-e '$@'"; fi
|
||||
${kak_opt_termcmd} "kak -c ${kak_socket#/tmp/kak-} ${kakoune_params}" < /dev/null >& /dev/null &
|
||||
disown
|
||||
}}
|
Loading…
Reference in New Issue
Block a user