Trying to escape tab in exe

2011-06-04 Thread Tim Johnson
If I type in the following ex command:
:e /home/tim/prj/cgi/baker/xmlimport/controllers/ 
and then press TAB, I get a wildmenu for the target
directory. Yay! 
But I can't get this same function to work programmatically.
I have the following two functions:
 
function! EdDir(dir)
execute 'e ' . a:dir . '/\Tab'
endfunction
 
function! EdControllers()
execute 'call EdDir(' . g:ControllerFolder . ')'
endfunction
 
 where g:ControllerFolder is '/home/tim/prj/cgi/baker/xmlimport/controllers'
If I execute 
: call EdControllers()cr
vim opens a new file 
/home/tim/prj/cgi/baker/xmlimport/controllers/Tab
grrr!
So how do I escape the Tab?
I've tried
:h execute, and don't find any help there.

thanks
using vim 7.2 Huge version with GTK2-GNOME GUI
-- 
Tim 
tim at johnsons-web dot com or akwebsoft dot com
http://www.akwebsoft.com

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


Re: Trying to escape tab in exe

2011-06-04 Thread Tony Mechelynck

On 05/06/11 00:30, Tim Johnson wrote:

If I type in the following ex command:
:e /home/tim/prj/cgi/baker/xmlimport/controllers/
and then press TAB, I get a wildmenu for the target
directory. Yay!
But I can't get this same function to work programmatically.
I have the following two functions:
 
function! EdDir(dir)
execute 'e ' . a:dir . '/\Tab'
endfunction
 
function! EdControllers()
execute 'call EdDir(' . g:ControllerFolder . ')'
endfunction
 
 where g:ControllerFolder is '/home/tim/prj/cgi/baker/xmlimport/controllers'
If I execute
: call EdControllers()cr
vim opens a new file
/home/tim/prj/cgi/baker/xmlimport/controllers/Tab
grrr!
So how do I escape the Tab?
I've tried
:h execute, and don't find any help there.

thanks
using vim 7.2 Huge version with GTK2-GNOME GUI


IIRC, the relevant setting is 'wildcharm' (q.v.).


HTH,
Tony.
--
hundred-and-one symptoms of being an internet addict:
103. When you find yourself in the Computer section of Barnes  Noble
 enjoying yourself.

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


Re: Trying to escape tab in exe

2011-06-04 Thread sc
On Saturday, June 04, 2011 19:00:39 Tony Mechelynck wrote:

 On 05/06/11 00:30, Tim Johnson wrote:
  If I type in the following ex command:
  :e /home/tim/prj/cgi/baker/xmlimport/controllers/
  
  and then press TAB, I get a wildmenu for the target
  directory. Yay!
  But I can't get this same function to work programmatically.
  I have the following two functions:
  
  ---
  - function! EdDir(dir)
  
  execute 'e ' . a:dir . '/\Tab'
  
  endfunction
  
  ---
  - function! EdControllers()
  
  execute 'call EdDir(' . g:ControllerFolder . ')'
  
  endfunction
  
  ---
  -  where g:ControllerFolder is
  '/home/tim/prj/cgi/baker/xmlimport/controllers' If I
  execute
  
  : call EdControllers()cr
  
  vim opens a new file
  /home/tim/prj/cgi/baker/xmlimport/controllers/Tab
  grrr!
  So how do I escape the Tab?
  I've tried
  
  :h execute, and don't find any help there.
  
  thanks
  using vim 7.2 Huge version with GTK2-GNOME GUI

 IIRC, the relevant setting is 'wildcharm' (q.v.).

another way to approach it would be to call glob() with an
asterisk in place of the Tab

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


Re: Trying to escape tab in exe

2011-06-04 Thread Tim Johnson
* Tony Mechelynck antoine.mechely...@gmail.com [110604 16:09]:
 vim opens a new file
 /home/tim/prj/cgi/baker/xmlimport/controllers/Tab
 grrr!
 So how do I escape the Tab?
 I've tried
 
 IIRC, the relevant setting is 'wildcharm' (q.v.).
 Thank you for the reply Tony. 
 I did the following:
 set wildcharm=Tab
  in the same file as the code I have included.
  sourced the file again, but I still have the
  problem. 
 My brain has still not grokked this problem. I've even tried (from
 the example in the helpfile):
 set wildcharm=C-Z
  with code changes to 
 execute 'e ' a:dir . '/\C-Z'
  or 
 execute 'e ' a:dir . '/C-Z'
 and blush I get a file name C-Z.
 Not what I want - obviously.
 thanks again
-- 
Tim 
tim at johnsons-web dot com or akwebsoft dot com
http://www.akwebsoft.com

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


Re: Trying to escape tab in exe

2011-06-04 Thread Tim Johnson
* sc tooth...@swbell.net [110604 16:24]:
   using vim 7.2 Huge version with GTK2-GNOME GUI
 
  IIRC, the relevant setting is 'wildcharm' (q.v.).
 
 another way to approach it would be to call glob() with an
 asterisk in place of the Tab
 
 sc
 Thanks sc, but could you illustrate with an example:
 `glob' is new to me, so I am in meantime looking at
 help and doing some experimenting.
 cheers
-- 
Tim 
tim at johnsons-web dot com or akwebsoft dot com
http://www.akwebsoft.com

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


Re: Trying to escape tab in exe

2011-06-04 Thread Tony Mechelynck

On 05/06/11 02:26, Tim Johnson wrote:

* Tony Mechelynckantoine.mechely...@gmail.com  [110604 16:09]:

vim opens a new file
/home/tim/prj/cgi/baker/xmlimport/controllers/Tab
grrr!
So how do I escape the Tab?
I've tried


IIRC, the relevant setting is 'wildcharm' (q.v.).

  Thank you for the reply Tony.
  I did the following:
  set wildcharm=Tab
   in the same file as the code I have included.
   sourced the file again, but I still have the
   problem.
  My brain has still not grokked this problem. I've even tried (from
  the example in the helpfile):
  set wildcharm=C-Z
   with code changes to
  execute 'e ' a:dir . '/\C-Z'
   or
  execute 'e ' a:dir . '/C-Z'
  andblush  I get a file nameC-Z.
  Not what I want - obviously.
  thanks again


Ah, sorry, I missed that thing about escaping the tab.

See
:help expr-string
:help literal-string

Within single quotes, every character is taken literally, even a 
backslash, except that two single quotes mean one.


You should have used double quotes with backslash-escaping, like this 
(referring to your original post):


exec 'e' a:dir . /\t
or
execute 'e ' . a.dir . /\Tab


HTH,
Tony.
--
THE LESSER-KNOWN PROGRAMMING LANGUAGES #13: SLOBOL

SLOBOL is best known for the speed, or lack of it, of its compiler.
Although many compilers allow you to take a coffee break while they
compile, SLOBOL compilers allow you to travel to Bolivia to pick the
coffee.  Forty-three programmers are known to have died of boredom
sitting at their terminals while waiting for a SLOBOL program to
compile.  Weary SLOBOL programmers often turn to a related (but
infinitely faster) language, COCAINE.

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


Re: Trying to escape tab in exe

2011-06-04 Thread Tim Johnson
* Tony Mechelynck antoine.mechely...@gmail.com [110604 18:04]:
 
 Within single quotes, every character is taken literally, even a
 backslash, except that two single quotes mean one.
 Aha! 
 You should have used double quotes with backslash-escaping, like
 this (referring to your original post):
 
   exec 'e' a:dir . /\t
 or
   execute 'e ' . a.dir . /\Tab
 :) Now we are getting somewhere. With your example above,
 I get the directory itself in a vim buffer window. Which
 is useful, but preferable, I want to see the wildmenu for
 the directory.

 As if I were to manually in ex type:
 e /home/http/run/baker/xmlimport/modelsTab

 thanks
-- 
Tim 
tim at johnsons-web dot com or akwebsoft dot com
http://www.akwebsoft.com

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


Re: Trying to escape tab in exe

2011-06-04 Thread Ben Schmidt

exec 'e' a:dir . /\t
or
execute 'e ' . a.dir . /\Tab

  :) Now we are getting somewhere. With your example above,
  I get the directory itself in a vim buffer window. Which
  is useful, but preferable, I want to see the wildmenu for
  the directory.

  As if I were to manually in ex type:
  e /home/http/run/baker/xmlimport/modelsTab


Try the feedkeys() function:

:call feedkeys('e ' . a.dir . /\Tab)

If you check out the help for feedkeys() you will see documentation
about a second argument which you might like to include and experiment
with to get the results you want reliably.

I haven't tested it, so I may be completely wrong, but I think it might be what 
you want!


Ben.



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


Re: Trying to escape tab in exe

2011-06-04 Thread Tim Johnson
* Ben Schmidt mail_ben_schm...@yahoo.com.au [110604 19:05]:
 
 Try the feedkeys() function:
 
 :call feedkeys('e ' . a.dir . /\Tab)
 
 If you check out the help for feedkeys() you will see documentation
 about a second argument which you might like to include and experiment
 with to get the results you want reliably.
 
 I haven't tested it, so I may be completely wrong, but I think it
 might be what you want!
  Ben, I think you may be on to something here:
  executing
  call feedkeys('e ' . a:dir . /\Tab)
  puts
  /home/tim/prj/cgi/baker/xmlimport/models/^I
  into ex
  which is not what we want (it's interpeted as
  a search pattern), however `feedkeys' looks promising.

  It is late where I am at. I will pursue this further in the
  morning. 
  Thanks everybody.
-- 
Tim 
tim at johnsons-web dot com or akwebsoft dot com
http://www.akwebsoft.com

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