> On Thursday 26 August 2010 16:46:34 Charles Campbell wrote:
>
>
>
> > jyk271 wrote:
> > > > From the command line I enter `vim`.
>
> > > I am greeted with the Vim version number etc.
> > > Then I type ` :e .` , which takes me to the file browser.
> > > I get the usual long list of files,I move the cursor, say to
> > > the fourth from the top , enter the file and edit it ,so far
> > > so good. NOW I use` ^O ` ie.` Ctrl O` to get back to the
> > > file browser,but instead of returning to the name of the
> > > file I just opened the cursor goes right to the bottom of
> > > the list.Otherwise I find Vim fantastic!
> > I've tried; you'll find netrw has keepj commands all over the
> > place. I've determined the first place that a jump table
> > change occurs; it was associated with a put command (which
> > already had a keepj associated with it). I've swapped in a
> > call setline() in its stead, accompanied by a keepj.
> > Unfortunately, the jump table still changes.
> > So I don't think I can change netrw to fix this.
> > Unfortunately, when I try doing the commands by hand, the
> > jump table doesn't change, so I can't submit a problem
> > report.
> > In the interim, use
> > :Rex
>
> ooo -- Rex -- i didn't know about that one
>
> here's an alternative i came up with -- it always seemed
> natural to me when opening netrw to do so with the cursor at
> the current buffer -- for this i came up with the following
> function:
>
> function! MyExplore(s)
> if a:s == "t"
> call MyExploret()
> return
> endif
> let save_locate = @/
> let @/ = '\<' . escape(expand("%:t"), ' .\')
> let g:netrw_sort_by = "name"
> let g:netrw_sort_direction = "normal"
> if &modified
> Sexplore .
> else
> Explore .
> endif
> normal gg
> try
> silent normal n
> normal zz
> catch
> endtry
> let @/ = save_locate
> endfunction
>
> nmap <silent> <S-F11> :call MyExplore('')<CR>
> imap <silent> <S-F11> <ESC>:call MyExplore('')<CR>
>
> i probably don't need the test for &modified any more since
> setting 'confirm' in my .vimrc, but it looks good in there, so
> i'm leaving it
>
> sc
Many thanks sc , I'm not familiar with functions in vim , so I'm still
scratching my head with this one . By the way, is this function for
an MS. version ? you see I'm on Linux .
Cheers,
jyk271
--
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