Skip to content

Commit 3581e5b

Browse files
committed
filebeagle mappings
To prevent Sneak from changing filebeagle defaults: let g:sneak#map_netrw = 0 (For backwards compatibility, we're currently using the `g:sneak#map_netrw` setting. This will be migrated later.)
1 parent eb325e5 commit 3581e5b

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

doc/sneak.txt

+5-3
Original file line numberDiff line numberDiff line change
@@ -354,10 +354,12 @@ g:sneak#use_ic_scs = 0
354354

355355
g:sneak#map_netrw = 1
356356

357-
0 : Don't do any special handling of |netrw| buffers.
357+
0 : Don't do any special handling of "file manager" buffers (such as
358+
|netrw| or filebeagle).
358359

359-
1 : Set up Sneak mappings (s and S) in |netrw| buffers (|:Ex|, |:Vex|), and
360-
move netrw's default s and S mappings to <leader>s and <leader>S.
360+
1 : Set up Sneak mappings (s and S) in "file manager" buffers (|:Ex|,
361+
|:Vex|, filebeagle) and replace the default buffer-local s and
362+
S mappings with <leader>s and <leader>S.
361363

362364
g:sneak#streak = 0
363365

plugin/sneak.vim

+5-4
Original file line numberDiff line numberDiff line change
@@ -369,16 +369,17 @@ xmap <Plug>VSneakPrevious <Plug>SneakPrevious
369369
370370
if g:sneak#opt.map_netrw && -1 != stridx(maparg("s", "n"), "Sneak")
371371
func! s:map_netrw_key(key)
372-
if -1 != stridx(maparg(a:key,"n"), "_Net")
373-
exec 'nnoremap <buffer> <silent> <leader>'.a:key.' '.maparg(a:key,'n')
374-
"unmap netrw's buffer-local mapping to allow Sneak's global mapping.
372+
let expanded_map = maparg(a:key,'n')
373+
if expanded_map =~# '_Net\|FileBeagle'
374+
exec 'nnoremap <buffer> <silent> <leader>'.a:key.' '.expanded_map
375+
"unmap the default buffer-local mapping to allow Sneak's global mapping.
375376
silent! exe 'nunmap <buffer> '.a:key
376377
endif
377378
endf
378379

379380
augroup SneakPluginNetrw
380381
autocmd!
381-
autocmd FileType netrw autocmd SneakPluginNetrw CursorMoved <buffer>
382+
autocmd FileType netrw,filebeagle autocmd SneakPluginNetrw CursorMoved <buffer>
382383
\ call <sid>map_netrw_key('s') | call <sid>map_netrw_key('S') | autocmd! SneakPluginNetrw * <buffer>
383384
augroup END
384385
endif

0 commit comments

Comments
 (0)