On 11/08/12 02:07, jiangfux wrote:
  I setup vim to auto update tags follow
http://vim.wikia.com/wiki/Autocmd_to_update_ctags_file
when i write to .c file, tags file not changed.
I add one line "echo _resp" like this:
function! UPDATE_TAGS()
     let _f_ = expand("%:p")
     let _cmd_ = '"ctags -a -f ./tags --c++-kinds=+p --fields=+iaS
--extra=+q " ' . '"' . _f_ . '"'
     let _resp = system(_cmd_)
     unlet _cmd_
     unlet _f_
     echo _resp
     unlet _resp
endfunction
autocmd BufWritePost *.cpp,*.h,*.c call UPDATE_TAGS()
Then write .c file, vim tell me
 >"main.c" 4L, 30C written
 >/bin/bash: ctags -a -f ./tags --c++-kinds=+p --fields=+iaS --extra=+q
: No such file or directory
I don't know which file ctags not found.

What you are passing to bash is

"ctags -a -f ./tags --c++-kinds=+p --fields=+iaS --extra=+q " "/full/path/to/some/file/"

The first set of single quotes mean that the program which bash tries to run is not just ctags but an executable file with the improbable name "ctags -a -f ./tags --c++-kinds=+p --fields=+iaS --extra=+q " (without the quotes, but with a space at the end), and of course that file is not found (IIUC, under Unix a filename may contain any character except a slash or maybe a null. Control characters 0x00 to 0x1F are strongly discouraged.)

Try removing the double quotes inside the first set of single quotes in your ":let _cmd_" statement.


Best regards,
Tony.
--
"I want to buy a husband who, every week when I sit down to watch `St.
Elsewhere', won't scream, `FORGET IT, BLANCHE ... IT'S TIME FOR "HEE
HAW"!!'"
                -- Berke Breathed, "Bloom County"

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

Reply via email to