Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to paste predefined code snippet in PyCharm?

Tags:

pycharm

Is there way to define snippets in PyCharm, built-in or via plug-in? For example I want paste self. by hotkey. Now I'm doing it by 'se' + CTRL+ENTER, but want to find more efficient way for this frequent operation.

like image 308
Gill Bates Avatar asked Jan 02 '13 16:01

Gill Bates


2 Answers

What you are probably looking for is PyCharm's live templates - although for something as short as self. - they probably are no quicker than typing.

like image 56
Gareth Latty Avatar answered Oct 05 '22 10:10

Gareth Latty


You can use macros for this purpose. Edit | Macros | Start Macro Recording begins the recording, then Settings | Keymap allows you to assign keyboard shortcuts to macros.

like image 44
yole Avatar answered Oct 05 '22 09:10

yole