Monday, December 3, 2012

Re: how to execute ranger from gvim

On 2012-12-03, Gary Johnson wrote:
> On 2012-12-03, ping wrote:
> >
> > On 12/03/2012 01:44 PM, Gary Johnson wrote:
>
> > > " RangerChooser()
> > > "
> > > " Ranger version 1.4.2 or later is required to run this function. That's when
> > > " the --choosefile option was added.
> > >
> > > fun! RangerChooser(...)
> > > let tmpfile = tempname() " Get the name of a temporary
> > > " file.
> > > if a:0 > 0 && a:1 != "" " If the user has supplied an
> > > " argument,
> > > let dir = a:1 " set dir to that argument,
> > > elseif expand("%") " otherwise if the current
> > > " buffer has a name,
> > > let dir = "." " set dir to the current
> > > " working directory.
> > > else " Otherwise,
> > > let dir = expand("%:p:h") " set dir to the directory
> > > " containing the current
> > > " buffer.
>
> Setting dir that way doesn't make sense to me. Either I wasn't
> thinking straight when I wrote it or I'm not thinking straight now.

I think I must have intended that to be the following, which is the
same as above but with the last two dependent clauses interchanged.

if a:0 > 0 && a:1 != "" " If the user has supplied an
" argument,
let dir = a:1 " set dir to that argument,
elseif expand("%") " otherwise if the current
" buffer has a name,
let dir = expand("%:p:h") " set dir to the directory
" containing the current
" buffer.
else " Otherwise,
let dir = "." " set dir to the current
" working directory.

Regards,
Gary

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