mirror of
https://github.com/mawww/kakoune.git
synced 2024-12-18 08:51:46 +03:00
Factor the 'new' commands out of their respective windowing systems
This commit is contained in:
parent
3e4f3ed9d2
commit
02fa967476
16
rc/base/new-client.kak
Normal file
16
rc/base/new-client.kak
Normal file
@ -0,0 +1,16 @@
|
||||
define-command new -params .. -command-completion -docstring '
|
||||
new [<commands>]: create a new kakoune client
|
||||
The ''terminal'' alias is being used to determine the user''s preferred terminal emulator
|
||||
The optional arguments are passed as commands to the new client' \
|
||||
%{
|
||||
try %{
|
||||
terminal %sh{
|
||||
# double-up single-quotes
|
||||
escaped=$(printf %s "$*" | sed -e "s|'|''|g")
|
||||
printf "kak -c '%s' -e '%s'" "$kak_session" "$escaped"
|
||||
}
|
||||
} catch %{
|
||||
fail "The 'terminal' alias must be defined to use this command"
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,6 @@ hook -group GNUscreen global KakBegin .* %sh{
|
||||
[ -z "${STY}" ] && exit
|
||||
echo "
|
||||
alias global focus screen-focus
|
||||
alias global new screen-new-vertical
|
||||
alias global terminal screen-terminal-vertical
|
||||
"
|
||||
}
|
||||
@ -42,27 +41,6 @@ The shell program passed as argument will be executed in the new terminal' \
|
||||
}
|
||||
}
|
||||
|
||||
define-command screen-new-vertical -params .. -command-completion -docstring '
|
||||
screen-new-vertical [<commands>]: create a new kakoune client as a screen pane
|
||||
The current pane is split into two, left and right
|
||||
The optional arguments are passed as commands to the new client' \
|
||||
%{
|
||||
screen-terminal-vertical "kak -c '%val{session}' -e '%arg{@}'"
|
||||
}
|
||||
define-command screen-new-horizontal -params .. -command-completion -docstring '
|
||||
screen-new-horizontal [<commands>]: create a new kakoune client as a screen pane
|
||||
The current pane is split into two, top and bottom
|
||||
The optional arguments are passed as commands to the new client' \
|
||||
%{
|
||||
screen-terminal-horizontal "kak -c '%val{session}' -e '%arg{@}'"
|
||||
}
|
||||
define-command screen-new-window -params .. -command-completion -docstring '
|
||||
screen-new-window [<commands>]: create a new kakoune client as a screen window
|
||||
The optional arguments are passed as commands to the new client' \
|
||||
%{
|
||||
screen-terminal-window "kak -c '%val{session}' -e '%arg{@}'"
|
||||
}
|
||||
|
||||
define-command screen-focus -params ..1 -client-completion -docstring '
|
||||
screen-focus [<client>]: focus the given client
|
||||
If no client is passed then the current one is used' \
|
||||
|
@ -6,7 +6,6 @@ hook global KakBegin .* %sh{
|
||||
if [ -n "$TMUX" ]; then
|
||||
echo "
|
||||
alias global focus tmux-focus
|
||||
alias global new tmux-new-horizontal
|
||||
alias global terminal tmux-terminal-horizontal
|
||||
"
|
||||
fi
|
||||
@ -45,27 +44,6 @@ The shell program passed as argument will be executed in the new terminal' \
|
||||
tmux-terminal-impl 'new-window' %arg{1}
|
||||
}
|
||||
|
||||
define-command tmux-new-vertical -params .. -command-completion -docstring '
|
||||
tmux-new-vertical [<commands>]: create a new kakoune client as a tmux pane
|
||||
The current pane is split into two, top and bottom
|
||||
The optional arguments are passed as commands to the new client' \
|
||||
%{
|
||||
tmux-terminal-vertical "kak -c '%val{session}' -e '%arg{@}'"
|
||||
}
|
||||
define-command tmux-new-horizontal -params .. -command-completion -docstring '
|
||||
tmux-new-horizontal [<commands>]: create a new kakoune client as a tmux pane
|
||||
The current pane is split into two, left and right
|
||||
The optional arguments are passed as commands to the new client' \
|
||||
%{
|
||||
tmux-terminal-horizontal "kak -c '%val{session}' -e '%arg{@}'"
|
||||
}
|
||||
define-command tmux-new-window -params .. -command-completion -docstring '
|
||||
tmux-new-window [<commands>]: create a new kakoune client as a tmux window
|
||||
The optional arguments are passed as commands to the new client' \
|
||||
%{
|
||||
tmux-terminal-window "kak -c '%val{session}' -e '%arg{@}'"
|
||||
}
|
||||
|
||||
define-command tmux-focus -params ..1 -client-completion -docstring '
|
||||
tmux-focus [<client>]: focus the given client
|
||||
If no client is passed then the current one is used' \
|
||||
|
@ -35,13 +35,6 @@ The shell program passed as argument will be executed in the new terminal' \
|
||||
}
|
||||
}
|
||||
|
||||
define-command x11-new -params .. -command-completion -docstring '
|
||||
x11-new [<commands>]: create a new kakoune client as an x11 window
|
||||
The optional arguments are passed as commands to the new client' \
|
||||
%{
|
||||
x11-terminal "kak -c '%val{session}' -e '%arg{@}'"
|
||||
}
|
||||
|
||||
define-command x11-focus -params ..1 -client-completion -docstring '
|
||||
x11-focus [<kakoune_client>]: focus a given client''s window
|
||||
If no client is passed, then the current client is used' \
|
||||
@ -56,5 +49,4 @@ If no client is passed, then the current client is used' \
|
||||
}
|
||||
|
||||
alias global focus x11-focus
|
||||
alias global new x11-new
|
||||
alias global terminal x11-terminal
|
||||
|
@ -6,7 +6,6 @@
|
||||
hook global KakBegin .* %sh{
|
||||
if [ "$TERM_PROGRAM" = "iTerm.app" ] && [ -z "$TMUX" ]; then
|
||||
echo "
|
||||
alias global new iterm-new-vertical
|
||||
alias global focus iterm-focus
|
||||
"
|
||||
fi
|
||||
@ -72,33 +71,6 @@ The shell program passed as argument will be executed in the new terminal'\
|
||||
}
|
||||
}
|
||||
|
||||
define-command iterm-new-vertical -params .. -command-completion -docstring '
|
||||
iterm-new-vertical <program>: create a new kakoune client as an iterm pane
|
||||
The current pane is split into two, top and bottom
|
||||
The optional arguments are passed as commands to the new client' \
|
||||
%{
|
||||
iterm-terminal-vertical "kak -c '%val{session}' -e '%arg{@}'"
|
||||
}
|
||||
define-command iterm-new-horizontal -params .. -command-completion -docstring '
|
||||
iterm-new-horizontal <program>: create a new kakoune client as an iterm pane
|
||||
The current pane is split into two, left and right
|
||||
The optional arguments are passed as commands to the new client' \
|
||||
%{
|
||||
iterm-terminal-horizontal "kak -c '%val{session}' -e '%arg{@}'"
|
||||
}
|
||||
define-command iterm-new-tab -params .. -command-completion -docstring '
|
||||
iterm-new-tab <program>: create a new kakoune client as an iterm tab
|
||||
The optional arguments are passed as commands to the new client' \
|
||||
%{
|
||||
iterm-terminal-tab "kak -c '%val{session}' -e '%arg{@}'"
|
||||
}
|
||||
define-command iterm-new-window -params .. -command-completion -docstring '
|
||||
iterm-new-window <program>: create a new kakoune client as an iterm window
|
||||
The optional arguments are passed as commands to the new client' \
|
||||
%{
|
||||
iterm-terminal-window "kak -c '%val{session}' -e '%arg{@}'"
|
||||
}
|
||||
|
||||
define-command iterm-focus -params ..1 -client-completion -docstring '
|
||||
iterm-focus [<client>]: focus the given client
|
||||
If no client is passed then the current one is used' \
|
||||
|
@ -3,8 +3,6 @@ declare-option -docstring %{window type that kitty creates on new and repl calls
|
||||
hook -group kitty-hooks global KakBegin .* %sh{
|
||||
if [ "$TERM" = "xterm-kitty" ] && [ -z "$TMUX" ]; then
|
||||
echo "
|
||||
alias global new kitty-new
|
||||
alias global new-tab kitty-new-tab
|
||||
alias global terminal kitty-terminal
|
||||
alias global terminal-tab kitty-terminal-tab
|
||||
alias global focus kitty-focus
|
||||
@ -23,13 +21,6 @@ The shell program passed as argument will be executed in the new terminal' \
|
||||
}
|
||||
}
|
||||
|
||||
define-command kitty-new -params .. -command-completion -docstring '
|
||||
kitty-new [<commands>]: create a new kakoune client as a kitty window
|
||||
The optional arguments are passed as commands to the new client' \
|
||||
%{
|
||||
kitty-terminal "kak -c %val{session} -e '%arg{@}'"
|
||||
}
|
||||
|
||||
define-command kitty-terminal-tab -params 1 -shell-completion -docstring '
|
||||
kitty-terminal-tab <program>: create a new terminal as kitty tab
|
||||
The shell program passed as argument will be executed in the new terminal' \
|
||||
@ -39,13 +30,6 @@ The shell program passed as argument will be executed in the new terminal' \
|
||||
}
|
||||
}
|
||||
|
||||
define-command kitty-new-tab -params .. -command-completion -docstring '
|
||||
kitty-new-tab <program> [<arguments>]: create a new terminal as kitty tab
|
||||
The optional arguments are passed as commands to the new client' \
|
||||
%{
|
||||
kitty-terminal-tab "kak -c %val{session} -e '%arg{@}'"
|
||||
}
|
||||
|
||||
define-command kitty-focus -params ..1 -client-completion -docstring '
|
||||
kitty-focus [<client>]: focus the given client
|
||||
If no client is passed then the current one is used' \
|
||||
|
Loading…
Reference in New Issue
Block a user