aboutsummaryrefslogtreecommitdiff
path: root/autoload/files.kak
blob: 3f5d7b14f4c08bf90144e2bd17b4565ced607a4b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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>' }