Saturday, July 30, 2011

Re: netrw dir listing position

On Saturday, July 30, 2011 01:38:45 Gary Johnson wrote:

> On 2011-07-29, Sigma wrote:
> > On Jul 29, 7:10 pm, sc wrote:
> > > On Friday, July 29, 2011 11:19:34 Steve Sullivan wrote:
> > > (i've since stopped using netrw, but the
> > >
> > > principle applies)
> >
> > There's a replacement for netrw? Great!What? How?
> > When I build vim 7.3 from source, netrw is built in.
> > It's not even an option. When I type :e .
> > up comes netrw. I'd be glad for a better replacement!

> NERD_tree

> http://vim.sourceforge.net/scripts/script.php?script_id=1658

> A lot of people seem to think it's a lot better than netrw. I
> tried it for a while but personally didn't like it as well as
> netrw, so I went back to using netrw. For me, netrw "just
> works" without having to think about it. YMMV.

for me simpler is better -- plugins like netrw try to do too
much, are far too complicated and carry baggage i don't want
or need

you can prevent its loading with

let g:loaded_netrw = 1

in your .vimrc

as i said, my browsing key du jour is shift-F11 i define as

nmap <silent> <S-F11> :call MyExplore('')<CR>
function! MyExplore(s)
if a:s == "t"
call MyExploreT()
return
endif
call CdCurBuf()
let wh = ' ' . escape(expand("%:t"), '.\') . '$'
call Maikallfiles()
call search(wh)
normal zz
endfunction

and

function! Maikallfiles()
let l:tst_name = expand("%")
if l:tst_name != ".allfiles"
call EditTry(".allfiles")
endif
call Hideme()
silent %d
0r!pwd
normal o
silent r!ls -algG --group-directories-first
silent g/^total/d
normal gg
endfunction

" make allfiles, sorted on time
function! MaikallfilesT()
let l:tst_name = expand("%")
if l:tst_name != ".allfiles"
if &modified
split .allfiles
else
edit .allfiles
endif
endif
call Hideme()
silent %d
0r!pwd
normal o
silent execute 'r!ls -algGt'
silent g/^total/d
normal gg
endfunction

with

function! EditTry(what)
if &modified
execute "split " a:what
else
execute "edit " a:what
endif
endfunction

and

function! Hideme()
setlocal noswapfile
setlocal buftype=nofile
setlocal bufhidden=hide
endfunction

then when i see a module i want to edit i navigate to it and
use F4:

map <F4> :call OpenWhat()<CR>
function! OpenWhat()
let testme = expand("<cfile>")
if isdirectory(testme)
call CdMaik()
else
execute 'e ' . testme
endif
endfunction

YMMV -- for me this is the best combination of "just works"
and light baggage -- i don't need to edit files over ftp or
any of the other fancy things netrw does, and i've seen netrw
do things like change formatoptions in other buffers (now
fixed) that frankly scared me

i used to have a web site where i posted my whole .vimrc, but
several months after at&t decided to stop supporting usenet
they then decided to stop providing web hosting

i guess i'm lucky they still support email

sc

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments:

Post a Comment