Move file search to leader mapping (#36)

This commit is contained in:
m1ngsama 2026-05-13 13:50:27 +08:00 committed by GitHub
parent e1c2ea3888
commit d03f7129d8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 7 additions and 4 deletions

View file

@ -109,7 +109,7 @@ jk exit insert mode ,? cheat sheet
### Files ### Files
`Ctrl+p` find | `,b` buffers | `,rg` grep | `,rG` grep word | `,fh` recent | `,fl` lines | `,e` browser | `,E` browser (file dir) | `,,` last file `,ff` find | `,b` buffers | `,rg` grep | `,rG` grep word | `,fh` recent | `,fl` lines | `,e` browser | `,E` browser (file dir) | `,,` last file
### Code ### Code

View file

@ -47,7 +47,7 @@ function! s:SmartFiles() abort
endfunction endfunction
if exists('g:plugs["fzf.vim"]') if exists('g:plugs["fzf.vim"]')
nnoremap <C-p> :call <SID>SmartFiles()<CR> nnoremap <leader>ff :call <SID>SmartFiles()<CR>
nnoremap <leader>b :Buffers<CR> nnoremap <leader>b :Buffers<CR>
nnoremap <leader>rg :Rg<CR> nnoremap <leader>rg :Rg<CR>
nnoremap <leader>rG :RgWord<CR> nnoremap <leader>rG :RgWord<CR>

View file

@ -326,7 +326,7 @@ function! s:CheatSheet() abort
\ ' ─────────────────────────────', \ ' ─────────────────────────────',
\ '', \ '',
\ ' ── files ──────────────────', \ ' ── files ──────────────────',
\ ' Ctrl+p find file', \ ' ,ff files',
\ ' ,b buffers', \ ' ,b buffers',
\ ' ,rg grep project', \ ' ,rg grep project',
\ ' ,rG grep word', \ ' ,rG grep word',

View file

@ -203,6 +203,8 @@ check_vim() {
XDG_CONFIG_HOME="$EMPTY_XDG" vim -u .vimrc -i NONE -es -N \ XDG_CONFIG_HOME="$EMPTY_XDG" vim -u .vimrc -i NONE -es -N \
-c 'if maparg("0", "n") !=# "" || maparg("0", "v") !=# "" || maparg("Y", "n") !=# "" || maparg("Q", "n") !=# "" || maparg("<Space>", "n") !=# "" | cquit | endif' \ -c 'if maparg("0", "n") !=# "" || maparg("0", "v") !=# "" || maparg("Y", "n") !=# "" || maparg("Q", "n") !=# "" || maparg("<Space>", "n") !=# "" | cquit | endif' \
-c 'if maparg("<C-p>", "n") !=# "" | cquit | endif' \
-c 'if maparg(",ff", "n") !~# "SmartFiles" | cquit | endif' \
-c 'qa!' 2>&1 -c 'qa!' 2>&1
XDG_CONFIG_HOME="$EMPTY_XDG" vim -u .vimrc -i NONE -es -N \ XDG_CONFIG_HOME="$EMPTY_XDG" vim -u .vimrc -i NONE -es -N \
@ -260,10 +262,11 @@ check_vim() {
-c 'redir END' \ -c 'redir END' \
-c 'qa!' 2>&1 -c 'qa!' 2>&1
grep -Fq ':ChopsticksStatus check LSP setup' "$TMP_ROOT/cheat-default.txt" grep -Fq ':ChopsticksStatus check LSP setup' "$TMP_ROOT/cheat-default.txt"
grep -Fq ',ff files' "$TMP_ROOT/cheat-default.txt"
grep -Fq ',dd definition' "$TMP_ROOT/cheat-default.txt" grep -Fq ',dd definition' "$TMP_ROOT/cheat-default.txt"
grep -Fq ',dk hover docs' "$TMP_ROOT/cheat-default.txt" grep -Fq ',dk hover docs' "$TMP_ROOT/cheat-default.txt"
grep -Fq ',dp ,dn LSP diagnostics' "$TMP_ROOT/cheat-default.txt" grep -Fq ',dp ,dn LSP diagnostics' "$TMP_ROOT/cheat-default.txt"
if grep -Eq 'gd definition|K hover docs|\\[g \\]g LSP diagnostics' "$TMP_ROOT/cheat-default.txt"; then if grep -Eq 'Ctrl\\+p find file|gd definition|K hover docs|\\[g \\]g LSP diagnostics' "$TMP_ROOT/cheat-default.txt"; then
cat "$TMP_ROOT/cheat-default.txt" cat "$TMP_ROOT/cheat-default.txt"
exit 1 exit 1
fi fi