Saturday, July 27, 2013

Vim Windows Autocommand Filename = 8.3

I try to identify a file by its name.

E.g. I have the following files:

2300039_2234552_779799_ABC.xml
2234439_2456644_123423_XYZ.xml
and the following autocommand:

autocmd BufRead,BufNewFile *.xml call CheckFileType()
For a test case I just save the current filename to a global variable.

function! CheckFileType()
let g:filename = expand("%:p:t")
endfunction
When the file has finished loading, I echo the filename:

echo g:filename
The result: 223443~1.XML

But for identification I need the complete filename!

When I reload the file afterward and echo the filename again, I get the long filename. wtf???

This behavior only appears, when loading the file from extern (e.g. "C:\Vim\vim73\gvim.exe" --remote-silent C:\2234439_2456644_123423_XYZ.xml). When loading from intern (:e) everything is as expected.

Any ideas?

Thanks in advance!

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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment