c++idecode-completionkdevelopcode-templates

Is there any sort of "Codelet Template" in KDevelop?


Everytime I need to input a piece of code such as "switch .. case" or "declaring a class", I desire a way I can rapidly achieve it by hitting a shortcut.

In many IDEs, we can do it by pressing some shortcut keys, and IDEs will paste a little piece of pre-defined code at the position of the focuse.

Is there any similar way in KDevelop? I'm not meaning the File/Project Templates here.

Thanks!


Solution

  • Yes, use the 'Snippets' plugin distributed with Kate.

    1. Install the Kate editor. Several of the plugins included can also be used in KDevelop; there's been some discussion of distributing those separately but it hasn't happened yet.

    2. In KDevelop, use the menu Window -> Add Tool View and select 'Snippets'.

    3. There will be a 'Snippets' toolview. Click on entries to paste them, or you can bind a shortcut. You can add new entries and categories.

    enter image description here