Skip to content

Commit

Permalink
File Browsing: Define a :D command for easier invocation of Lusty
Browse files Browse the repository at this point in the history
  • Loading branch information
jdelkins committed Nov 29, 2011
1 parent af7d45b commit cef9259
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions vimrc
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ set backspace=indent,eol,start
set laststatus=2
set relativenumber
set undofile
set report=25

nnoremap / /\v
vnoremap / /\v
Expand Down Expand Up @@ -68,6 +69,7 @@ autocmd VimEnter * call <SID>dynamic_remaps()
function! s:dynamic_remaps()
if exists(":LustyFilesystemExplorerFromHere")
nnoremap <leader>d :LustyFilesystemExplorerFromHere<cr>
command -nargs=? -complete=dir D :call CallLusty('<args>')
elseif exists(":Perlbrws")
nnoremap <leader>d :Perlbrws<cr>
else
Expand All @@ -78,6 +80,15 @@ function! s:dynamic_remaps()
endif
endfunction

" Helper function to call LustyFilesystemExplorer with a directory-completed
" argument. A little tricky since Lusty (currently) has a little bug that
" doesn't properly escape backslashes. Note that an untested alternative may
" be to use the 'shellslash' option
function! CallLusty(dir)
let l:d = substitute(substitute(a:dir, '\\', '/', 'g'), '/$', '', '')
exe ":LustyFilesystemExplorer" l:d
endfunction

" Window navigation
nnoremap <C-h> <C-w>h
nnoremap <C-j> <C-w>j
Expand Down

0 comments on commit cef9259

Please sign in to comment.