aboutsummaryrefslogtreecommitdiff
path: root/autoload/files.kak
diff options
context:
space:
mode:
authorAkshay Nair <phenax5@gmail.com>2025-10-13 14:13:52 +0530
committerAkshay Nair <phenax5@gmail.com>2025-10-21 13:39:45 +0530
commit38dc33178ed1ec08277782dba40c4fa55c07287c (patch)
tree6b1b17dc67fe8a82182357ab080d74c1409055bc /autoload/files.kak
parent043f497d7475860f49815c9de35c0c76aa45a135 (diff)
downloadkakoune-config-38dc33178ed1ec08277782dba40c4fa55c07287c.tar.gz
kakoune-config-38dc33178ed1ec08277782dba40c4fa55c07287c.zip
Refactor some bits out
Diffstat (limited to '')
-rw-r--r--autoload/files.kak22
1 files changed, 22 insertions, 0 deletions
diff --git a/autoload/files.kak b/autoload/files.kak
new file mode 100644
index 0000000..3f5d7b1
--- /dev/null
+++ b/autoload/files.kak
@@ -0,0 +1,22 @@
+set-option global grepcmd "rg -S --vimgrep --hidden -g '!**/.git/**'"
+
+def find -docstring "find files" -menu -params 1 %{ edit -existing %arg{1} } \
+ -shell-script-candidates %{ fd -t f --hidden --color=never -E .git }
+
+def file-manager -params .. %{ connect terminal env "EDITOR=kcr edit" daffm -c @kak %arg{@} }
+
+declare-user-mode buffer
+map global user b ':enter-user-mode buffer<ret>' -docstring 'Buffer mode'
+map global buffer b ':buffer ' -docstring 'Switch buffer'
+map global buffer d ':delete-buffer<ret>' -docstring 'Delete buffer'
+map global buffer s ':write<ret>' -docstring 'Save'
+
+declare-user-mode file
+map global user f ':enter-user-mode file<ret>' -docstring 'File mode'
+map global file f ':find ' -docstring 'Find files'
+map global file g ':grep ' -docstring 'Grep'
+map global file n ':file-manager %val{buffile}<ret>' -docstring 'File manager'
+
+# 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>' }