Tuesday, January 14, 2014

problems (and bugs) with netrw

I'm starting to learn netrw (the version shipped with the latest vim 7.4.142) but I already have a couple of problems and maybe a bug. Try to do this:


open any file
:Explore<cr>
press F1 for netrw help (will open in an horizontal split)
go back to netrw split
move over any file and press P
the file opens in the split where the help was displayed
:q the file
press F1 again
the help shows again but it is not formattet nor highlighted


there's also a problem with buffers losing all their rows (as if someone erased them all. a simple "u" brings them back, but the buffer remains marked as modified) but I haven't found yet a reliable way to reproduce it. it seems to happen at random...



and now for the problem: when i open netrw, i don't know how to go back to the file i was editing... I mean, I don't want to select a file and open it, I want to close netrw and go back to whatever i was editing before.

sometimes :b# is enough, but sometimes it doesn't work. e.g. after doing all the steps described before, :b# doesn't do anything, i remain on the netrw buffer. Is there another command? I couldn't find any in the help file.
C-^ seems to have no effects at all.

I tried to write a function to set a variable to current bufnr, then open netrw and map "q" to a command that switches back to the recorder bufnr, but for some reason there's something like a 2 second delay after i pressed "q" before the buffer is switched... here's my attempt:

let g:netrw_list_hide = '^\..*, .*\.sw[op]$'
let g:netrw_browse_split = 0
let g:netrw_liststyle = 3
let g:netrw_banner = 0

function! CloseNetrw()
exe g:netrw_close_cmd
endfunction

function! OpenNetrw()
let g:netrw_close_cmd = ":b" . bufnr('%')
Explore
endfunction

au FileType netrw nnoremap q :call CloseNetrw()<CR>
nnoremap <C-\> :call OpenNetrw()<CR>



another problem: let's say I do :e app/etc/local.xml and then open netrw. I move over ../ and press <cr> to go back up one level in the hierarchy. the cursor move on row 0. is it possibile to let it stay on the first line of the file listings? i.e. after the netrw header. If i disable the header with "let g:netrw_banner=0" there's one empty line on top of the buffer, so a movement is still needed. It also happens when i open a file with <cr>. if I open netrw again the cursor is no longer on the file i opened, but on the first line.

thanks in advance!

--
--
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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment