|
Hi all !
I am new to vim. I met a annoying problem when dealing with spaces in file path. I add this in my vimrc file to ctag a file quickly: map <C-F12> :!ctags -o "%:p:h/tags" --c++-kinds=+p --fields=+iaS --extra=+q "%" I don't want to save tags in my $HOME, so I let it be in the directory of the source file. It works well when there's no space in the file path, but it when meet path like "/media/hdc8/Stack Queue/stack.cc", it breaks down: sort: open failed: Queue/tags: No such file or directory ctags: cannot sort tag file : No such file or directory Anyone get a good idea? Thanks in advance~! --~--~---------~--~----~------------~-------~--~----~ You received this message from the "vim_use" maillist. For more information, visit http://www.vim.org/maillist.php -~----------~----~----~----~------~----~------~--~--- |
|
From: "ccbrighty .", Fri, April 11, 2008 1:26 am > > I met a annoying problem when dealing with spaces in file path. > [...] > when meet path like > "/media/hdc8/Stack Queue/stack.cc", it breaks down: > > sort: open failed: Queue/tags: No such file or directory > ctags: cannot sort tag file : No such file or directory Looks like you just need to escape the spaces: "/media/hdc8/Stack\ Queue/stack.cc" -- Steve Hall [ digitect dancingpaper com ] --~--~---------~--~----~------------~-------~--~----~ You received this message from the "vim_use" maillist. For more information, visit http://www.vim.org/maillist.php -~----------~----~----~----~------~----~------~--~--- |
|
Well, this is not what I mean.
I mean when open file /media/hdc8/Stack Queue/stack.cc(One space between "Stack" and "Queue") and press ctrl + F12, it breaks down and says: sort: open failed: Queue/tags: No such file or directory ctags: cannot sort tag file : No such file or directory but if I change the directory name from "Stack Queue" into "StackQueue", the path /media/hdc8/StackQueue/stack.cc now contains no space, and it works correctly. I do not type the path by myself, but use "%:p:h/tags". So it is impossible to add a "\".( And if I have to add "\" every time, I'd rather not use it. ) regards, On Fri, Apr 11, 2008 at 7:49 PM, Steve Hall <[hidden email]> wrote:
--~--~---------~--~----~------------~-------~--~----~ You received this message from the "vim_use" maillist. For more information, visit http://www.vim.org/maillist.php -~----------~----~----~----~------~----~------~--~--- |
|
In reply to this post by ccbrighty .
Hi, ccbrighty . wrote: > > I am new to vim. I met a annoying problem when dealing with spaces in > file path. > > I add this in my vimrc file to ctag a file quickly: > map <C-F12> :!ctags -o "%:p:h/tags" --c++-kinds=+p --fields=+iaS > --extra=+q "%" > I don't want to save tags in my $HOME, so I let it be in the directory > of the source > file. It works well when there's no space in the file path, but it when > meet path like > "/media/hdc8/Stack Queue/stack.cc", it breaks down: > > sort: open failed: Queue/tags: No such file or directory > ctags: cannot sort tag file : No such file or directory > > Anyone get a good idea? Thanks in advance~! this might be a problem of ctags calling an external sort. What does ctags --help say? The first lines of the windows version I use are Exuberant Ctags 5.6, Copyright (C) 1996-2004 Darren Hiebert Compiled: Jun 9 2006, 08:58:47 Addresses: <[hidden email]>, http://ctags.sourceforge.net Optional compiled features: +win32, +regex, +internal-sort If you don't have "+internal-sort" ctags probably does not quote the file name correctly when it calls the external sort. Regards, Jürgen -- Sometimes I think the surest sign that intelligent life exists elsewhere in the universe is that none of it has tried to contact us. (Calvin) --~--~---------~--~----~------------~-------~--~----~ You received this message from the "vim_use" maillist. For more information, visit http://www.vim.org/maillist.php -~----------~----~----~----~------~----~------~--~--- |
|
On 4/11/08, Jürgen Krämer <[hidden email]> wrote: > > > Hi, > > > ccbrighty . wrote: > > > > I am new to vim. I met a annoying problem when dealing with spaces in > > file path. > > > > I add this in my vimrc file to ctag a file quickly: > > map <C-F12> :!ctags -o "%:p:h/tags" --c++-kinds=+p --fields=+iaS > > --extra=+q "%" > > I don't want to save tags in my $HOME, so I let it be in the directory > > of the source > > file. It works well when there's no space in the file path, but it when > > meet path like > > "/media/hdc8/Stack Queue/stack.cc", it breaks down: > > > > sort: open failed: Queue/tags: No such file or directory > > ctags: cannot sort tag file : No such file or directory > > > > Anyone get a good idea? Thanks in advance~! > > > this might be a problem of ctags calling an external sort. What does > > ctags --help > > say? The first lines of the windows version I use are > > Exuberant Ctags 5.6, Copyright (C) 1996-2004 Darren Hiebert > Compiled: Jun 9 2006, 08:58:47 > Addresses: <[hidden email]>, http://ctags.sourceforge.net > Optional compiled features: +win32, +regex, +internal-sort > > If you don't have "+internal-sort" ctags probably does not quote the > file name correctly when it calls the external sort. > > Regards, > Jürgen > > See :help escape() for a solution to your problem. You may need to make use of the expression register in your mapping to use it, like this: <C-R>=escape(expand("%:p:h"), ' ')<CR> --~--~---------~--~----~------------~-------~--~----~ You received this message from the "vim_use" maillist. For more information, visit http://www.vim.org/maillist.php -~----------~----~----~----~------~----~------~--~--- |
|
In reply to this post by ... ...-3
On 11/04/08 14:35, ... ... wrote: > Well, this is not what I mean. > I mean when open file /media/hdc8/Stack Queue/stack.cc(One space between > "Stack" and "Queue") > and press ctrl + F12, it breaks down and says: > > sort: open failed: Queue/tags: No such file or directory > ctags: cannot sort tag file : No such file or directory > > but if I change the directory name from "Stack Queue" into "StackQueue", > the path /media/hdc8/StackQueue/stack.cc > now contains no space, and it works correctly. > > I do not type the path by myself, but use "%:p:h/tags". So it is > impossible to add a "\".( And if I have to add "\" every time, > I'd rather not use it. ) > > regards, If you are on Windows, you can use the 8.3 version of that path (with the :8 filename-modifier, as in %:p:8:h), which contains no spaces. That would replace "Stack Queue" by something like STACKQ~1 which your system will recognise as another name for the same directory. And BTW, please use plaintext. Black text on dark green background is hard to read, and adds nothing. In plaintext, you can use the following shorthand to represent *bold*, /italics/ and _underlined text_. Best regards, Tony. -- ARTHUR: Listen, old crone! Unless you tell us where we can buy a shrubbery, my friend and I will ... we will say "Ni!" CRONE: Do your worst! "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD --~--~---------~--~----~------------~-------~--~----~ You received this message from the "vim_use" maillist. For more information, visit http://www.vim.org/maillist.php -~----------~----~----~----~------~----~------~--~--- |
|
1. I replaced the original one with this:
map <C-F12> :!ctags -o <C-R>=escape(expand("%:p:h"), ' \')<CR>/tags --c++-kinds=+p --fields=+iaS --extra=+q "%" but it failed, too: :!ctags -o /media/hdc8/a\ b/tags --c++-kinds=+p --fields=+iaS --extra=+q "/media/hdc8/a b/stacks.cpp" sort: open failed: b/tags: No such file or directory ctags: cannot sort tag file : No such file or directory 2. My O/S is Ubuntu, and ctags --help says: Optional compiled features: +wildcards, +regex , no +internal-sort So I wanted to recompile ctags and add the option. But I checked the "INSTALL" in "ctags-5.7.tar.gz", I couldn't find any instructions on how to turn it on, all I found are: --disable-etags --disable-extended-format --disable-external-sort --enable-custom-config=FILE --enable-macro-patterns --enable-maintainer-mode --enable-tmpdir=DIR Did I miss something? Best regards, Zhang Shuhan On Sat, Apr 12, 2008 at 1:11 PM, Tony Mechelynck <[hidden email]> wrote:
--~--~---------~--~----~------------~-------~--~----~ You received this message from the "vim_use" maillist. For more information, visit http://www.vim.org/maillist.php -~----------~----~----~----~------~----~------~--~--- |
|
On 12/04/08 18:18, ... ... wrote: > 1. I replaced the original one with this: > map <C-F12> :!ctags -o <C-R>=escape(expand("%:p:h"), ' \')<CR>/tags > --c++-kinds=+p --fields=+iaS --extra=+q "%" > but it failed, too: > :!ctags -o /media/hdc8/a\ b/tags --c++-kinds=+p --fields=+iaS --extra=+q > "/media/hdc8/a b/stacks.cpp" > sort: open failed: b/tags: No such file or directory > ctags: cannot sort tag file : No such file or directory [...] When you execute the ! command with a backslash-escaped space, the backslash is removed. The shell (bash or similar) doesn't see it: so you need more backslashes, maybe /a\\ b/ or /a\\\ b/, I'm not sure. Similarly further on, I think the quotes are not necessary but a "proper" number of backslashes are. Best regards, Tony. -- What makes the universe so hard to comprehend is that there's nothing to compare it with. --~--~---------~--~----~------------~-------~--~----~ You received this message from the "vim_use" maillist. For more information, visit http://www.vim.org/maillist.php -~----------~----~----~----~------~----~------~--~--- |
|
I tried to use:
set autochdir and then: map <C-F12> :!ctags -o ./tags --c++-kinds=+p --fields=+iaS --extra=+q "%" It works "perfectly", but unfortunately, some important plugins break down, like Vimball. I have no idea on how to add more backslashes. For the moment, I remove all the spaces in my directory name. The spaces are really annoying... ... On Sun, Apr 13, 2008 at 12:44 AM, Tony Mechelynck <[hidden email]> wrote:
--~--~---------~--~----~------------~-------~--~----~ You received this message from the "vim_use" maillist. For more information, visit http://www.vim.org/maillist.php -~----------~----~----~----~------~----~------~--~--- |
|
In reply to this post by ... ...-3
... ... wrote:
1. I replaced the original one with this:Rather than expand("%:p:h") you just want expand("%:p") I'm not sure if I told you to use the :h or not, but I was wrong if I did. See :help expand() for details. The % is for the current file name, the :p is to expand it to the full path, the :h would remove the file name, leaving just the directory the file is in. --~--~---------~--~----~------------~-------~--~----~ You received this message from the "vim_use" maillist. For more information, visit http://www.vim.org/maillist.php -~----------~----~----~----~------~----~------~--~--- |
|
I've seen :help expand(), but I'm sorry I became more confused about the meaning of:
Rather than expand("%:p:h") you just want expand("%:p") --- Benjamin I guess it is: map <C-F12> :!ctags -o <C-R>=escape(expand("%:p"), ' \')<CR>/tags --c++-kinds=+p --fields=+iaS --extra=+q "%" It is obviously wrong, it results to : !ctags -o /media/hdc8/a\ b/stacks.cpp/tags --c++-kinds=+p --fields=+iaS --extra=+q "/media/hdc8/a b/stacks.cpp" ctags: cannot open tag file : Not a directory or maybe this: map <C-F12> :!ctags -o <C-R>=escape(expand("%:p:h"), ' \')<CR>/tags --c++-kinds=+p --fields=+iaS --extra=+q <C-R>=escape(expand("%:p"), ' \')<CR> it results to : :!ctags -o /media/hdc8/a\ b/tags --c++-kinds=+p --fields=+iaS --extra=+q /media/hdc8/a\ b/stacks.cpp sort: open failed: b/tags: No such file or directory ctags: cannot sort tag file : No such file or directory What I want is to ctag a file like "/media/hdc8/a b/stacks.cpp"(with a space in a path) and save tag file as"/media/hdc8/a b/tags" Best regards, Zhang Shuhan On Sun, Apr 13, 2008 at 8:08 AM, Benjamin Fritz <[hidden email]> wrote:
--~--~---------~--~----~------------~-------~--~----~ You received this message from the "vim_use" maillist. For more information, visit http://www.vim.org/maillist.php -~----------~----~----~----~------~----~------~--~--- |
|
On 4/12/08, ... ... <[hidden email]> wrote: > I've seen :help expand(), but I'm sorry I became more confused about the > meaning of: > Rather than expand("%:p:h") you just want expand("%:p") --- Benjamin > > I guess it is: > map <C-F12> :!ctags -o <C-R>=escape(expand("%:p"), ' \')<CR>/tags > --c++-kinds=+p --fields=+iaS --extra=+q "%" > It is obviously wrong, it results to : > !ctags -o /media/hdc8/a\ b/stacks.cpp/tags --c++-kinds=+p --fields=+iaS > --extra=+q "/media/hdc8/a b/stacks.cpp" > ctags: cannot open tag file : Not a directory > > or maybe this: > map <C-F12> :!ctags -o <C-R>=escape(expand("%:p:h"), ' \')<CR>/tags > --c++-kinds=+p --fields=+iaS --extra=+q <C-R>=escape(expand("%:p"), ' > \')<CR> > it results to : > :!ctags -o /media/hdc8/a\ b/tags --c++-kinds=+p --fields=+iaS --extra=+q > /media/hdc8/a\ b/stacks.cpp > sort: open failed: b/tags: No such file or directory > ctags: cannot sort tag file : No such file or directory > > > What I want is to ctag a file like "/media/hdc8/a b/stacks.cpp"(with a space > in a path) > and save tag file as"/media/hdc8/a b/tags" > > > Best regards, > Zhang Shuhan > > > > > On Sun, Apr 13, 2008 at 8:08 AM, Benjamin Fritz <[hidden email]> > wrote: > > > > > > > > > > ... ... wrote: > > 1. I replaced the original one with this: > > map <C-F12> :!ctags -o <C-R>=escape(expand("%:p:h"), ' \')<CR>/tags > --c++-kinds=+p --fields=+iaS --extra=+q "%" > > but it failed, too: > > :!ctags -o /media/hdc8/a\ b/tags --c++-kinds=+p --fields=+iaS --extra=+q > "/media/hdc8/a b/stacks.cpp" > > sort: open failed: b/tags: No such file or directory > > ctags: cannot sort tag file : No such file or directory > > > > 2. My O/S is Ubuntu, and ctags --help says: > > Optional compiled features: +wildcards, +regex , no +internal-sort > > So I wanted to recompile ctags and add the option. But I checked the > "INSTALL" in "ctags-5.7.tar.gz", I couldn't find any instructions on how to > turn it on, all I found are: > > --disable-etags > > --disable-extended-format > > --disable-external-sort > > --enable-custom-config=FILE > > --enable-macro-patterns > > --enable-maintainer-mode > > --enable-tmpdir=DIR > > Did I miss something? > > > > > > Best regards, > > Zhang Shuhan > > > > > > > > > > On Sat, Apr 12, 2008 at 1:11 PM, Tony Mechelynck > <[hidden email]> wrote: > > > > > > > > > > > On 11/04/08 14:35, ... ... wrote: > > > > Well, this is not what I mean. > > > > I mean when open file /media/hdc8/Stack Queue/stack.cc(One space > between > > > > "Stack" and "Queue") > > > > and press ctrl + F12, it breaks down and says: > > > > > > > > sort: open failed: Queue/tags: No such file or directory > > > > ctags: cannot sort tag file : No such file or directory > > > > > > > > but if I change the directory name from "Stack Queue" into > "StackQueue", > > > > the path /media/hdc8/StackQueue/stack.cc > > > > now contains no space, and it works correctly. > > > > > > > > I do not type the path by myself, but use "%:p:h/tags". So it is > > > > impossible to add a "\".( And if I have to add "\" every time, > > > > I'd rather not use it. ) > > > > > > > > regards, > > > > > > If you are on Windows, you can use the 8.3 version of that path (with > > > the :8 filename-modifier, as in %:p:8:h), which contains no spaces. That > > > would replace "Stack Queue" by something like STACKQ~1 which your system > > > will recognise as another name for the same directory. > > > > > > And BTW, please use plaintext. Black text on dark green background is > > > hard to read, and adds nothing. In plaintext, you can use the following > > > shorthand to represent *bold*, /italics/ and _underlined text_. > > > > > > Best regards, > > > Tony. > > > -- > > > ARTHUR: Listen, old crone! Unless you tell us where we can buy a > shrubbery, > > > my friend and I will ... we will say "Ni!" > > > CRONE: Do your worst! > > > "Monty Python and the Holy Grail" PYTHON (MONTY) > > > PICTURES LTD > > > > > > > > > > > > > > > > > > > Rather than expand("%:p:h") you just want expand("%:p") > > > > I'm not sure if I told you to use the :h or not, but I was wrong if I did. > > > > See :help expand() for details. The % is for the current file name, the :p > is to expand it to the full path, the :h would remove the file name, leaving > just the directory the file is in. > > > > > > > > > > You're right...sorry. I need to read more carefully methinks. Not sure what's going on there. --~--~---------~--~----~------------~-------~--~----~ You received this message from the "vim_use" maillist. For more information, visit http://www.vim.org/maillist.php -~----------~----~----~----~------~----~------~--~--- |
|
In reply to this post by ... ...-3
Hi, ... ... wrote: > > 2. My O/S is Ubuntu, and ctags --help says: > Optional compiled features: +wildcards, +regex , no +internal-sort > So I wanted to recompile ctags and add the option. But I checked the > "INSTALL" in "ctags-5.7.tar.gz", I couldn't find any instructions on how > to turn it on, all I found are: > --disable-etags > --disable-extended-format > --disable-external-sort ^^^^^^^^^^^^^^^^^^^^^^^ > --enable-custom-config=FILE > --enable-macro-patterns > --enable-maintainer-mode > --enable-tmpdir=DIR > Did I miss something? disabling external sort should enable internal sort. Regards, Jürgen -- Sometimes I think the surest sign that intelligent life exists elsewhere in the universe is that none of it has tried to contact us. (Calvin) --~--~---------~--~----~------------~-------~--~----~ You received this message from the "vim_use" maillist. For more information, visit http://www.vim.org/maillist.php -~----------~----~----~----~------~----~------~--~--- |
|
In reply to this post by Jürgen Krämer-4
>> sort: open failed: Queue/tags: No such file or directory >> ctags: cannot sort tag file : No such file or directory >> >> Anyone get a good idea? Thanks in advance~! > > this might be a problem of ctags calling an external sort. What does > > ctags --help > > say? The first lines of the windows version I use are > > Exuberant Ctags 5.6, Copyright (C) 1996-2004 Darren Hiebert > Compiled: Jun 9 2006, 08:58:47 > Addresses: <[hidden email]>, http://ctags.sourceforge.net > Optional compiled features: +win32, +regex, +internal-sort > > If you don't have "+internal-sort" ctags probably does not quote the > file name correctly when it calls the external sort. Yes. It is quite obvious that it is an external 'sort' command that is failing to find the nonexistent file, which means it is a ctags bug in how it is calling 'sort', or interpreting its arguments. I expect you will get the same error if you run the command from the commandline, rather than Vim. Further help may be found on a ctags mailing list, I expect. They may even fix the ctags bug if you ask nicely. :-) Ben. --~--~---------~--~----~------------~-------~--~----~ You received this message from the "vim_use" maillist. For more information, visit http://www.vim.org/maillist.php -~----------~----~----~----~------~----~------~--~--- |
|
I recompile ctag with option --disable-external-sort and everything is ok !
Thank you Jürgen, and thanks to everyone! Best regards, Zhang Shuhan --~--~---------~--~----~------------~-------~--~----~ You received this message from the "vim_use" maillist. For more information, visit http://www.vim.org/maillist.php -~----------~----~----~----~------~----~------~--~--- |
| Powered by Nabble | Edit this page |
