Блог пользователя Taha1506

Автор Taha1506, история, 3 года назад, По-английски

Does anyone know how can I make a certain part of code always appear in Clion.And also how can I save a file as a template so that it appears without rewriting it?I searched the net but didn't see anything.

I got the solution to create templates Thanks to the comments.Now the only problem remaing is the following how can I make a part of code always appear when oppening a new file.More precisly I wan't this part always appear:

inclue <bits/stdc++.h>

using namespace std; int main(){ ios::sync_with_stido(false): cin.tie(nullptr);

return 0;

}

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

»
3 года назад, # |
  Проголосовать: нравится +3 Проголосовать: не нравится

Well, there exists something called Live Templates (another name for Snippets)

  • »
    »
    3 года назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    Thanks a lot what if I want a part of code always appear without mention(include or return part?)

»
3 года назад, # |
  Проголосовать: нравится +3 Проголосовать: не нравится

Go to settings or preferences (in Mac), then under the Editor section , you have Live Templates, select C/C++ and then click on '+'. Add your snippet with your abbreviation and a brief description (if u want). And you are done . Just use your abbreviation and CLion gives you the whole snippet.

»
3 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Auto comment: topic has been updated by Taha1506 (previous revision, new revision, compare).