aboutsummaryrefslogtreecommitdiff
path: root/autoload
diff options
context:
space:
mode:
authorAkshay Nair <phenax5@gmail.com>2026-06-12 20:33:09 +0530
committerAkshay Nair <phenax5@gmail.com>2026-06-12 20:33:09 +0530
commit1ccf3d5c1d2ee7ff8ec97488c0b15b8316fb29f9 (patch)
tree9a358f7611205b1e5f0f90757c06b60f5859eab3 /autoload
parentcd744290334f28d1b03e952cac9df6cdc164a0cf (diff)
downloadkakoune-config-1ccf3d5c1d2ee7ff8ec97488c0b15b8316fb29f9.tar.gz
kakoune-config-1ccf3d5c1d2ee7ff8ec97488c0b15b8316fb29f9.zip
Clipboard actions + grep selection
Diffstat (limited to 'autoload')
-rw-r--r--autoload/files.kak10
-rw-r--r--autoload/grep.kak3
-rw-r--r--autoload/system.kak17
3 files changed, 24 insertions, 6 deletions
diff --git a/autoload/files.kak b/autoload/files.kak
index ce380ba..121460d 100644
--- a/autoload/files.kak
+++ b/autoload/files.kak
@@ -6,8 +6,13 @@ def file-manager -params .. %{
terminal-singleton files env "DAFFM_PATH_RELATIVE_TO=%val{client_env_PWD}" daffm -c @kak %arg{@}
}
-def findfzf %{
- terminal-singleton fzf sh -c 'kcr edit $(fd -t f --hidden --color=never -E .git | fzf --prompt='':find '' --multi --min-height=100 --preview=''bat --color=always {}'')'
+def findfzf -params .. %{
+ terminal-singleton fzf sh -c 'kcr edit $(fd -t f --hidden --color=never -E .git | fzf --prompt='':find '' --multi --min-height=100 --preview=''bat --color=always {}'' $@)' findfzf-cmd %arg{@}
+}
+
+def findfzf-filtered -params 1 %{
+ terminal-singleton fzf sh -c \
+ 'kcr edit $(fd -t f --hidden --color=never -E .git | grep -E ''''$1'''' | fzf --prompt='':find# '' --multi --min-height=100 --preview=''bat --color=always {}'')' findfzf-cmd %arg{1}
}
declare-user-mode file
@@ -15,6 +20,7 @@ map global user f ': enter-user-mode file<ret>' -docstring 'File mode'
map global file F ': find ' -docstring 'Find files'
map global file n ': file-manager %val{buffile}<ret>' -docstring 'File manager'
map global file f ': findfzf<ret>' -docstring 'Fzf'
+map global file <c-f> ': findfzf -q %val{selection}<ret>' -docstring 'Fzf selection'
declare-user-mode buffer
map global user b ': enter-user-mode-with-count buffer<ret>' -docstring 'Buffer mode'
diff --git a/autoload/grep.kak b/autoload/grep.kak
index c0d1010..4caee4e 100644
--- a/autoload/grep.kak
+++ b/autoload/grep.kak
@@ -1,6 +1,7 @@
set-option global grepcmd "rg -S --vimgrep --hidden -g '!**/.git/**'"
-map global file g ":grep ''<left>" -docstring 'Grep'
+map global file g ':grep ''''<left>' -docstring 'Grep'
+map global file * ': grep --case-sensitive %val{selection}<ret>' -docstring 'Grep selection'
define-command grep-write %{
execute-keys '%' # Consider selecting manually
diff --git a/autoload/system.kak b/autoload/system.kak
index 6ad122a..bb11f4f 100644
--- a/autoload/system.kak
+++ b/autoload/system.kak
@@ -7,17 +7,28 @@ map global user Z ': wq<ret>' -docstring 'Save and quit'
map global normal <c-j> 15j -docstring '15 down'
map global normal <c-k> 15k -docstring '15 up'
+# Clipboard stuff
map global user y "<a-|> xclip -selection clipboard<ret>" -docstring "yank the selection into the clipboard"
+map global user p "<a-!> xclip -selection clipboard -o<ret>" -docstring "paste from clipboard after selection"
+map global user P "! xclip -selection clipboard -o<ret>" -docstring "paste from clipboard before selection"
+# System mode
declare-user-mode system
map global user q ': enter-user-mode system<ret>' -docstring 'System mode'
map global system o ':info %opt{}<left>' -docstring 'Print opt'
map global system v ':info %val{}<left>' -docstring 'Print value'
map global system d ': buffer *debug*<ret>' -docstring 'Switch to debug buffer'
map global system f ':set buffer filetype ' -docstring 'Set filetype'
+# Path
+map global system p ': info %sh{realpath -s --relative-to="$PWD" "$kak_buffile"}<ret>' -docstring 'Print relative file path'
+map global system P ': info %sh{realpath -s "$kak_buffile"}<ret>' -docstring 'Print absolute file path'
+map global system y ': info %sh{realpath -s --relative-to="$PWD" "$kak_buffile" | xclip -selection clipboard}<ret>' -docstring 'Copy relative file path'
+map global system Y ': info %sh{realpath -s "$kak_buffile" | xclip -selection clipboard}<ret>' -docstring 'Copy absolute file path'
+
+# Make cmd
map global system M ':set global makecmd ""<left>' -docstring 'Set global compile command'
map global system m ': make<ret>' -docstring 'Compile'
-map global system p ': info %sh{ realpath -s --relative-to="$PWD" "$kak_buffile" }<ret>' -docstring 'Print relative file path'
-map global system P ': info %val{buffile}<ret>' -docstring 'Print absolute file path'
-map global system ! ':info %sh{}<left>' -docstring 'Run command'
+# Run oneshot shell command
+map global system ! ':info %sh{}<left>' -docstring 'Run command with %sh'
+# New term
map global system t ': terminal %sh{ echo "$SHELL" }<ret>' -docstring 'Open new term'