Skip to content

Commit

Permalink
open windows in popups instead of splits
Browse files Browse the repository at this point in the history
  • Loading branch information
BrianHicks committed Jul 23, 2021
1 parent 0b9a57a commit a9966aa
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions pkgs/kak-open/rc/kak-open.kak
@@ -1,15 +1,15 @@
declare-option str similar_sort_path "similar-sort"

define-command -docstring 'open files named similarly to the current buffer' open-similar %{
tmux-terminal-horizontal sh -c %{
tmux-terminal-impl 'display-popup -E' sh -c %{
set -euo pipefail
FILE="$(git ls-files --others --cached --exclude-standard | $1 $2 | grep -Ev "^$2\$" | fzf --tiebreak index)"
printf "evaluate-commands -client %s edit %s\n" "$3" "$FILE" | indiekak -p $4
} -- %opt{similar_sort_path} %val{bufname} %val{client} %val{session}
}

define-command -docstring 'open buffers named similarly to the current buffer' open-similar-buffer %{
tmux-terminal-horizontal sh -c %{
tmux-terminal-impl 'display-popup -E' sh -c %{
set -euo pipefail
OPTIONS=""
for OPTION in "${@:5}"; do
Expand Down
16 changes: 8 additions & 8 deletions pkgs/kak-tree-grepper/rc/kak-tree-grepper.kak
Expand Up @@ -2,7 +2,7 @@ declare-option str tree_grepper_path "tree-grepper"
declare-option str tree_grepper_fzf_path "fzf"

define-command -override -docstring "jump somewhere in an Elm file's definition outline" -params 0..1 outline-jump-elm %{
tmux-terminal-horizontal sh -c %{
tmux-terminal-impl 'display-popup -E' sh -c %{
set -euo pipefail

# what tools do we have available?
Expand All @@ -20,13 +20,13 @@ define-command -override -docstring "jump somewhere in an Elm file's definition
# do the magic!
QUERY="(function_declaration_left (lower_case_identifier)@function) (type_declaration (type) (upper_case_identifier)@type) (type_alias_declaration (type) (alias) (upper_case_identifier)@alias) (union_variant (upper_case_identifier)@constructor) (field_type (lower_case_identifier)@field) (lower_pattern)@pattern (exposed_type)@exposed_type (exposed_value)@exposed_value (as_clause (as) (upper_case_identifier)@module_alias) (port_annotation (port) (lower_case_identifier)@port)"

EDIT_LOCATION="$("$TREE_GREPPER" --language elm "$QUERY" "$FILE" | fzf --with-nth 4,5 --nth 2,1 --delimiter=: --query "$FZF_QUERY" --select-1 --preview 'bat --color=always -pp --highlight-line {2} --line-range "$(echo "x = $(echo {2}) - 7; if (x < 0) { 0 } else { x }" | bc):$(($(echo {2}) + 7))" {1}' --preview-window=down | cut -d : -f 1-3 | tr : ' ')"
EDIT_LOCATION="$("$TREE_GREPPER" --language elm "$QUERY" "$FILE" | fzf --with-nth 4,5 --nth 2,1 --delimiter=: --query "$FZF_QUERY" --select-1 --preview 'bat --color=always -pp --highlight-line {2} --line-range "$(echo "x = $(echo {2}) - 7; if (x < 0) { 0 } else { x }" | bc):$(($(echo {2}) + 7))" {1}' | cut -d : -f 1-3 | tr : ' ')"
printf "evaluate-commands -client %s edit %s\n" "$CLIENT" "$EDIT_LOCATION" | indiekak -p "$SESSION"
} -- %opt{tree_grepper_path} %opt{tree_grepper_fzf_path} %val{bufname} %arg{1} %val{client} %val{session}
}

define-command -override -docstring "jump somewhere in a Ruby file's definition outline" -params 0..1 outline-jump-ruby %{
tmux-terminal-horizontal sh -c %{
tmux-terminal-impl 'display-popup -E' sh -c %{
set -euo pipefail

# what tools do we have available?
Expand All @@ -44,13 +44,13 @@ define-command -override -docstring "jump somewhere in a Ruby file's definition
# do the magic!
QUERY="(module name: (_) @module) (class name: (_) @class) (method name: (_) @method) (singleton_method name: (_) @method) (assignment left: (_) @assignment) (operator_assignment left: (_) @assignment)"

EDIT_LOCATION="$("$TREE_GREPPER" --language ruby "$QUERY" "$FILE" | fzf --with-nth 4,5 --nth 2,1 --delimiter=: --query "$FZF_QUERY" --select-1 --preview 'bat --color=always -pp --highlight-line {2} --line-range "$(echo "x = $(echo {2}) - 7; if (x < 0) { 0 } else { x }" | bc):$(($(echo {2}) + 7))" {1}' --preview-window=down | cut -d : -f 1-3 | tr : ' ')"
EDIT_LOCATION="$("$TREE_GREPPER" --language ruby "$QUERY" "$FILE" | fzf --with-nth 4,5 --nth 2,1 --delimiter=: --query "$FZF_QUERY" --select-1 --preview 'bat --color=always -pp --highlight-line {2} --line-range "$(echo "x = $(echo {2}) - 7; if (x < 0) { 0 } else { x }" | bc):$(($(echo {2}) + 7))" {1}' | cut -d : -f 1-3 | tr : ' ')"
printf "evaluate-commands -client %s edit %s\n" "$CLIENT" "$EDIT_LOCATION" | indiekak -p "$SESSION"
} -- %opt{tree_grepper_path} %opt{tree_grepper_fzf_path} %val{bufname} %arg{1} %val{client} %val{session}
}

define-command -override -docstring "jump somewhere in an Haskell file's definition outline" -params 0..1 outline-jump-haskell %{
tmux-terminal-horizontal sh -c %{
tmux-terminal-impl 'display-popup -E' sh -c %{
set -euo pipefail

# what tools do we have available?
Expand All @@ -70,13 +70,13 @@ define-command -override -docstring "jump somewhere in an Haskell file's definit
# import-hidings, so we just show the entire import statements.
QUERY="(import)@import (signature)@signature (function name: (_)@function) (pat_name (_)@name) (adt (type)@data) (data_constructor)@constructor (newtype (type)@newtype) (newtype_constructor)@constructor (instance_head)@instance"

EDIT_LOCATION="$("$TREE_GREPPER" --language haskell "$QUERY" "$FILE" | fzf --with-nth 4.. --nth 2,1 --delimiter=: --query "$FZF_QUERY" --select-1 --preview 'bat --color=always -pp --highlight-line {2} --line-range "$(echo "x = $(echo {2}) - 7; if (x < 0) { 0 } else { x }" | bc):$(($(echo {2}) + 7))" {1}' --preview-window=down | cut -d : -f 1-3 | tr : ' ')"
EDIT_LOCATION="$("$TREE_GREPPER" --language haskell "$QUERY" "$FILE" | fzf --with-nth 4.. --nth 2,1 --delimiter=: --query "$FZF_QUERY" --select-1 --preview 'bat --color=always -pp --highlight-line {2} --line-range "$(echo "x = $(echo {2}) - 7; if (x < 0) { 0 } else { x }" | bc):$(($(echo {2}) + 7))" {1}' | cut -d : -f 1-3 | tr : ' ')"
printf "evaluate-commands -client %s edit %s\n" "$CLIENT" "$EDIT_LOCATION" | indiekak -p "$SESSION"
} -- %opt{tree_grepper_path} %opt{tree_grepper_fzf_path} %val{bufname} %arg{1} %val{client} %val{session}
}

define-command -override -docstring "jump somewhere in an Rust file's definition outline" -params 0..1 outline-jump-rust %{
tmux-terminal-horizontal sh -c %{
tmux-terminal-impl 'display-popup -E' sh -c %{
set -euo pipefail

# what tools do we have available?
Expand All @@ -94,7 +94,7 @@ define-command -override -docstring "jump somewhere in an Rust file's definition
# do the magic!
QUERY="(use_declaration)@use (function_item _ (_) @function) (struct_item (type_identifier) @struct) (field_declaration)@field (parameter) (let_declaration)@let (enum_item (type_identifier)@enum) (enum_variant)"

EDIT_LOCATION="$("$TREE_GREPPER" --language rust "$QUERY" "$FILE" | fzf --with-nth 4,5 --nth 2,1 --delimiter=: --query "$FZF_QUERY" --select-1 --preview 'bat --color=always -pp --highlight-line {2} --line-range "$(echo "x = $(echo {2}) - 7; if (x < 0) { 0 } else { x }" | bc):$(($(echo {2}) + 7))" {1}' --preview-window=down | cut -d : -f 1-3 | tr : ' ')"
EDIT_LOCATION="$("$TREE_GREPPER" --language rust "$QUERY" "$FILE" | fzf --with-nth 4,5 --nth 2,1 --delimiter=: --query "$FZF_QUERY" --select-1 --preview 'bat --color=always -pp --highlight-line {2} --line-range "$(echo "x = $(echo {2}) - 7; if (x < 0) { 0 } else { x }" | bc):$(($(echo {2}) + 7))" {1}' | cut -d : -f 1-3 | tr : ' ')"
printf "evaluate-commands -client %s edit %s\n" "$CLIENT" "$EDIT_LOCATION" | indiekak -p "$SESSION"
} -- %opt{tree_grepper_path} %opt{tree_grepper_fzf_path} %val{bufname} %arg{1} %val{client} %val{session}
}

0 comments on commit a9966aa

Please sign in to comment.