Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm using a file template directory for newly created files,

autocmd! BufNewFile * silent! 0r ~/.vim/skel/tmpl.%:e

Now I want to add another function, that move the cursor to somewhere (defined in each ~/.vim/skel/tmpl.%), i.e the first location of text <CURSOR>, is that possible?

In summary, when a new file is created, use the template, and jump to <CURSOR>.

share|improve this question
up vote 3 down vote accepted

Maybe something like:

function LoadFile()
  0r ~/.vim/skel/tmpl.%:e
  exe "normal /<CURSOR>\<Cr>"

autocmd! BufNewFile * silent! call LoadFile()
share|improve this answer
Hi Stephane, perhaps you can take a look at this question as well unix.stackexchange.com/questions/69296/… – warl0ck Mar 27 '13 at 8:27

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.