Re: :cd 'cdpath'

2014-06-04 Fir de Conversatie Nazri Ramliy
On Thu, May 29, 2014 at 5:52 PM, Dhruva Sagar dhruva.sa...@gmail.com wrote:
 But surely this should be supported natively, doesn't sound like it would 
 require huge change, would anyone be able to throw some light into why this 
 is the case ?

A made a toy patch about 4 years ago for this[1], based on the
completion code that I wrote for the :find command, and last year
someone asked the same question as you do now [2].

I tried out the patch just now (from [2]) and it does apply cleanly
and seems to complete the cd command based on cdpath. One problem that
I notice right away is that when cdpath is set to the default value
(,,) the suggestions for doing :cd tab include files as well - it
should only suggest directories. I'm sure there are more problems yet
to be found.

The patch is not fit for inclusion into vim because:

1. There's no tests (must work for at least unix, dos and windows environment)
2. Due to 1 above, bugs like the one I mentioned above are hiding in
some dark corners somewhere :)

If you want to help you can start by applying the patch and writing a
test for it, similar to the one that tests the :find command in
src/testdir/test73.in.

Nazri.

[1] http://article.gmane.org/gmane.editors.vim.devel/27730
[2] http://article.gmane.org/gmane.editors.vim.devel/40362

-- 
-- 
You received this message from the vim_dev 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_dev group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


:cd 'cdpath'

2014-05-29 Fir de Conversatie Dhruva Sagar
I recently discovered 'cdpath', and noticed VIM is doing a good job at it, 
except :cd doesn't autocomplete the valid paths from the 'cdpath'. I wrote this 
script as a hack to work around it :

function! s:CdComplete(ArgLead, CmdLine, CursorPos)
  let pattern = empty(a:ArgLead) ? '*/' : '*' . a:ArgLead . '*/'
  return map(globpath(cdpath, pattern, 1, 1), 'fnamemodify(v:val, :h:t)')
endfunction

command! -bar -nargs=1 -complete=customlist,s:CdComplete Cd cd args

But surely this should be supported natively, doesn't sound like it would 
require huge change, would anyone be able to throw some light into why this is 
the case ?

-- 
-- 
You received this message from the vim_dev 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_dev group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: :cd 'cdpath'

2014-05-29 Fir de Conversatie glts
On Thursday, May 29, 2014 11:52:29 AM UTC+2, Dhruva Sagar wrote:
 I recently discovered 'cdpath', and noticed VIM is doing a good job at it, 
 except :cd doesn't autocomplete the valid paths from the 'cdpath'. I wrote 
 this script as a hack to work around it :
 
 function! s:CdComplete(ArgLead, CmdLine, CursorPos)
   let pattern = empty(a:ArgLead) ? '*/' : '*' . a:ArgLead . '*/'
   return map(globpath(cdpath, pattern, 1, 1), 'fnamemodify(v:val, :h:t)')
 endfunction
 
 command! -bar -nargs=1 -complete=customlist,s:CdComplete Cd cd args
 
 But surely this should be supported natively, doesn't sound like it would 
 require huge change, would anyone be able to throw some light into why this 
 is the case ?

'cdpath' is modelled after the shell's CDPATH environment variable. In
fact, if you look at the documentation you can see that 'cdpath' is set
to the value of CDPATH.

The shell doesn't do completion for names that come from a CDPATH
location -- at least my Bash shell doesn't.


-- 
David

-- 
-- 
You received this message from the vim_dev 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_dev group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: :cd 'cdpath'

2014-05-29 Fir de Conversatie Dhruva Sagar
I am aware of the fact that it's set from $CDPATH and it is doing that 
correctly. At least in ZSH (which I use), it does complete directory names from 
the $CDPATH.

On Thursday, May 29, 2014 7:50:21 PM UTC+5:30, glts wrote:
 On Thursday, May 29, 2014 11:52:29 AM UTC+2, Dhruva Sagar wrote:
  I recently discovered 'cdpath', and noticed VIM is doing a good job at it, 
  except :cd doesn't autocomplete the valid paths from the 'cdpath'. I wrote 
  this script as a hack to work around it :
  
  function! s:CdComplete(ArgLead, CmdLine, CursorPos)
let pattern = empty(a:ArgLead) ? '*/' : '*' . a:ArgLead . '*/'
return map(globpath(cdpath, pattern, 1, 1), 'fnamemodify(v:val, :h:t)')
  endfunction
  
  command! -bar -nargs=1 -complete=customlist,s:CdComplete Cd cd args
  
  But surely this should be supported natively, doesn't sound like it would 
  require huge change, would anyone be able to throw some light into why this 
  is the case ?
 
 'cdpath' is modelled after the shell's CDPATH environment variable. In
 fact, if you look at the documentation you can see that 'cdpath' is set
 to the value of CDPATH.
 
 The shell doesn't do completion for names that come from a CDPATH
 location -- at least my Bash shell doesn't.
 
 
 -- 
 David

-- 
-- 
You received this message from the vim_dev 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_dev group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.