aboutsummaryrefslogtreecommitdiff
path: root/autoload/grep.kak
diff options
context:
space:
mode:
authorAkshay Nair <phenax5@gmail.com>2025-10-13 15:25:24 +0530
committerAkshay Nair <phenax5@gmail.com>2025-10-21 13:39:45 +0530
commit351d55648ea26335b713140bfc0c4f69e2d70489 (patch)
treeb43cc6559aec53278a032ebb99657ac537b8fcba /autoload/grep.kak
parent38dc33178ed1ec08277782dba40c4fa55c07287c (diff)
downloadkakoune-config-351d55648ea26335b713140bfc0c4f69e2d70489.tar.gz
kakoune-config-351d55648ea26335b713140bfc0c4f69e2d70489.zip
Add grep-write command
Diffstat (limited to 'autoload/grep.kak')
-rw-r--r--autoload/grep.kak14
1 files changed, 14 insertions, 0 deletions
diff --git a/autoload/grep.kak b/autoload/grep.kak
new file mode 100644
index 0000000..cef77ee
--- /dev/null
+++ b/autoload/grep.kak
@@ -0,0 +1,14 @@
+set-option global grepcmd "rg -S --vimgrep --hidden -g '!**/.git/**'"
+
+map global file g ':grep ' -docstring 'Grep'
+
+define-command grep-write %{
+ execute-keys '%' # Consider selecting manually
+ evaluate-commands %sh{
+ echo "$kak_selections" | "$kak_config/scripts/apply_vimgrep_updates.js" | xargs -i echo "info '{}'"
+ }
+}
+
+# TODO: Proper mappings for next/prev on results
+hook global -always BufOpenFifo '\*grep\*' %{ map global normal <minus> ': grep-next-match<ret>' }
+hook global -always BufOpenFifo '\*make\*' %{ map global normal <minus> ': make-next-error<ret>' }