I've got a BufReadPost autocmd in my .vimrc which will automatically reload a file in DOS or Unix fileformat using e ++ff=dos or e + +ff=unix if it is in mixed line-ending format, depending on whether there are more lines with or without a trailing ^M.
It works well, but I sometimes want to force it to load one way or the other, with an explicit :e ++ff=unix for example. So, I'm trying to modify my autocmd to only act if I did not explicitly specify the fileformat on the command-line. I've tried using @:, but that does not seem to get updated until after my autocmd fires. I've tried using getcmdline(), but that is invalid (and returns an empty string) because the command-line is not currently being edited when the autocmd fires. My only other though is to set up a cnoremap <expr> mapping which maps <CR> to a function which stores off the getcmdline() result to a variable, then returns "\<CR>", so that it doesn't actually do anything but allows access to the currently executing command. I suspect this will work, but is there a better way? -- 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
