I have been changing "$OLD" to "~/new" in a lot of files lately, so I am now used to starting vim like this
$ vim file.txt
Enter
Lorem ipsum $OLD
Lorem .OLD ipsum
:%up (brings back %s:\$OLD:\~/new:gc
)Enter
:wqEnter
$
So I added a new autocommand in ~/.vimrc, like this
if has("autocmd")
au BufEnter %s:\$OLD:\~/new:gc
endif
and this
au BufEnter :%s:\$OLD:\~/new:gc
And next time I tried vim, it wasn't as impressed as I was hoping:
$ vim file.txt
Enter
--- Auto-Commands ---
Press ENTER or type command to continue
Enter
Lorem ipsum $OLD
Lorem .OLD ipsum
:qEnter
$
Why is vim just telling me about the commands, instead of running them?
autocmd FileType sh nnoremap <F3> :%s:\$OLD:\~/new:gc<cr>
works for me, but doesn't answer the question of what I did wrong the first time round