1

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

1 Answer 1

3

Maybe something like:

function LoadFile() 0r ~/.vim/skel/tmpl.%:e exe "normal /<CURSOR>\<Cr>" endf autocmd! BufNewFile * silent! call LoadFile() 
1

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.