Skip to content

Commit

Permalink
filebeagle mappings
Browse files Browse the repository at this point in the history
To disable prevent Sneak from chagne 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.)
  • Loading branch information
justinmk committed Oct 28, 2014
1 parent eb325e5 commit dfe3749
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
8 changes: 5 additions & 3 deletions doc/sneak.txt
Original file line number Diff line number Diff line change
Expand Up @@ -354,10 +354,12 @@ g:sneak#use_ic_scs = 0

g:sneak#map_netrw = 1

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

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

g:sneak#streak = 0

Expand Down
9 changes: 5 additions & 4 deletions plugin/sneak.vim
Original file line number Diff line number Diff line change
Expand Up @@ -369,16 +369,17 @@ xmap <Plug>VSneakPrevious <Plug>SneakPrevious
if g:sneak#opt.map_netrw && -1 != stridx(maparg("s", "n"), "Sneak")
func! s:map_netrw_key(key)
if -1 != stridx(maparg(a:key,"n"), "_Net")
exec 'nnoremap <buffer> <silent> <leader>'.a:key.' '.maparg(a:key,'n')
"unmap netrw's buffer-local mapping to allow Sneak's global mapping.
let expanded_map = maparg(a:key,'n')
if expanded_map =~# '_Net\|FileBeagle'
exec 'nnoremap <buffer> <silent> <leader>'.a:key.' '.expanded_map
"unmap the default buffer-local mapping to allow Sneak's global mapping.
silent! exe 'nunmap <buffer> '.a:key
endif
endf

augroup SneakPluginNetrw
autocmd!
autocmd FileType netrw autocmd SneakPluginNetrw CursorMoved <buffer>
autocmd FileType netrw,filebeagle autocmd SneakPluginNetrw CursorMoved <buffer>
\ call <sid>map_netrw_key('s') | call <sid>map_netrw_key('S') | autocmd! SneakPluginNetrw * <buffer>
augroup END
endif
Expand Down

0 comments on commit dfe3749

Please sign in to comment.