File and Code Templates - how to set cursor at specific position


is there any way to set cursor at specific point at File and Code Templates (like it's done in Live templates using $END$ variable)? Now cursor is set after the generated method.

 Enabling Live templates doesn't help 


Hi there,

Try ${CARET}. Not sure at all if it will work in entries from "Code" tab -- it only seem to be available on "Files" and "Includes" tabs.

The main possible reason (as per my understanding) is that templates used here can be used in automatic code generation (e.g. you may choose to generate few methods at once; in such case "caret placed here" placeholder does not really makes much sense)



Thanks for the reply, though caret is not working.


But according to this issue it has to be working ($END$ using live templates in File and Code Templates ).

Could it be possible that this feature become broken on some new releases? Cause the last comments are dated by year 2015


Please try that Live Template in templates in first 2 tabs.

As I have said -- that may simply never worked (and may not even has been planed to work) in templates in "Code" tab.


Also: -- the only "not working $END$" mentioning I have found so far


Thanks, I'll vote for that issue.


Is there any update on this? It's still not working...


$END$ is working for me in PyCharm 2019.3.4 (Professional Edition).


any updates?



Elil, #[[$END$]]# is supposed to work in File Templates when the Enable Live Templates checkbox is checked, but it only works reliably on empty lines.
Does it not do the trick for you?


Eugene, you are right! Checkbox should be checked! Thanks a lot!!


Please sign in to leave a comment.