summaryrefslogtreecommitdiff
path: root/rc
diff options
context:
space:
mode:
Diffstat (limited to 'rc')
-rwxr-xr-xrc/connect/modules/dmenu/commands/:dmenu-grep18
-rw-r--r--rc/connect/modules/dmenu/dmenu.kak6
-rwxr-xr-xrc/connect/modules/rofi/commands/:rofi-grep18
-rw-r--r--rc/connect/modules/rofi/rofi.kak6
-rwxr-xr-xrc/connect/modules/wofi/commands/:wofi-grep18
-rw-r--r--rc/connect/modules/wofi/wofi.kak6
6 files changed, 72 insertions, 0 deletions
diff --git a/rc/connect/modules/dmenu/commands/:dmenu-grep b/rc/connect/modules/dmenu/commands/:dmenu-grep
new file mode 100755
index 0000000..cb02ed4
--- /dev/null
+++ b/rc/connect/modules/dmenu/commands/:dmenu-grep
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+# dmenu
+# https://tools.suckless.org/dmenu/
+
+# Dependencies:
+# – ripgrep (https://github.com/BurntSushi/ripgrep)
+
+rg --line-number --with-filename '.+' "$@" |
+dmenu -l 20 -i -p 'Open files (search by content)' |
+
+while read line; do
+ # Output format: <file>:<line>:<text>
+ file=${line%%:*}
+ line_number=${line#*:}; line_number=${line_number%%:*}
+
+ :edit "$file" "+$line_number"
+done
diff --git a/rc/connect/modules/dmenu/dmenu.kak b/rc/connect/modules/dmenu/dmenu.kak
index 17fdd8c..c5dd5e0 100644
--- a/rc/connect/modules/dmenu/dmenu.kak
+++ b/rc/connect/modules/dmenu/dmenu.kak
@@ -3,6 +3,7 @@
# Dependencies:
# – fd (https://github.com/sharkdp/fd)
+# – ripgrep (https://github.com/BurntSushi/ripgrep)
provide-module connect-dmenu %{
# Modules
@@ -22,6 +23,11 @@ provide-module connect-dmenu %{
$ :dmenu-buffers %arg{@}
}
+ # Grep
+ define-command dmenu-grep -params .. -file-completion -docstring 'Open files (search by content) with dmenu' %{
+ $ :dmenu-grep %arg{@}
+ }
+
# Aliases
alias global dmenu dmenu-files
}
diff --git a/rc/connect/modules/rofi/commands/:rofi-grep b/rc/connect/modules/rofi/commands/:rofi-grep
new file mode 100755
index 0000000..f0215a2
--- /dev/null
+++ b/rc/connect/modules/rofi/commands/:rofi-grep
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+# Rofi
+# https://github.com/davatorium/rofi
+
+# Dependencies:
+# – ripgrep (https://github.com/BurntSushi/ripgrep)
+
+rg --line-number --with-filename '.+' "$@" |
+rofi -dmenu -i -p 'Open files (search by content)' |
+
+while read line; do
+ # Output format: <file>:<line>:<text>
+ file=${line%%:*}
+ line_number=${line#*:}; line_number=${line_number%%:*}
+
+ :edit "$file" "+$line_number"
+done
diff --git a/rc/connect/modules/rofi/rofi.kak b/rc/connect/modules/rofi/rofi.kak
index d53a5c8..d1af9c8 100644
--- a/rc/connect/modules/rofi/rofi.kak
+++ b/rc/connect/modules/rofi/rofi.kak
@@ -3,6 +3,7 @@
# Dependencies:
# – fd (https://github.com/sharkdp/fd)
+# – ripgrep (https://github.com/BurntSushi/ripgrep)
provide-module connect-rofi %{
# Modules
@@ -22,6 +23,11 @@ provide-module connect-rofi %{
$ :rofi-buffers %arg{@}
}
+ # Grep
+ define-command rofi-grep -params .. -file-completion -docstring 'Open files (search by content) with Rofi' %{
+ $ :rofi-grep %arg{@}
+ }
+
# Aliases
alias global rofi rofi-files
}
diff --git a/rc/connect/modules/wofi/commands/:wofi-grep b/rc/connect/modules/wofi/commands/:wofi-grep
new file mode 100755
index 0000000..a8c80fe
--- /dev/null
+++ b/rc/connect/modules/wofi/commands/:wofi-grep
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+# Wofi
+# https://hg.sr.ht/~scoopta/wofi
+
+# Dependencies:
+# – ripgrep (https://github.com/BurntSushi/ripgrep)
+
+rg --line-number --with-filename '.+' "$@" |
+wofi --dmenu --prompt 'Open files (search by content)' |
+
+while read line; do
+ # Output format: <file>:<line>:<text>
+ file=${line%%:*}
+ line_number=${line#*:}; line_number=${line_number%%:*}
+
+ :edit "$file" "+$line_number"
+done
diff --git a/rc/connect/modules/wofi/wofi.kak b/rc/connect/modules/wofi/wofi.kak
index f774b50..082419e 100644
--- a/rc/connect/modules/wofi/wofi.kak
+++ b/rc/connect/modules/wofi/wofi.kak
@@ -3,6 +3,7 @@
# Dependencies:
# – fd (https://github.com/sharkdp/fd)
+# – ripgrep (https://github.com/BurntSushi/ripgrep)
provide-module connect-wofi %{
# Modules
@@ -22,6 +23,11 @@ provide-module connect-wofi %{
$ :wofi-buffers %arg{@}
}
+ # Grep
+ define-command wofi-grep -params .. -file-completion -docstring 'Open files (search by content) with Wofi' %{
+ $ :wofi-grep %arg{@}
+ }
+
# Aliases
alias global wofi wofi-files
}