Difference between revisions of "Gedit-Text-Editor/C3/Snippets-in-gedit/English-timed"
From Script | Spoken-Tutorial
Jyotisolanki (Talk | contribs) |
|||
(6 intermediate revisions by 3 users not shown) | |||
Line 5: | Line 5: | ||
|- | |- | ||
| 00:01 | | 00:01 | ||
− | |Welcome to the '''Spoken Tutorial''' on '''Snippets | + | |Welcome to the '''Spoken Tutorial''' on '''Snippets in gedit Text editor'''. |
|- | |- | ||
| 00:08 | | 00:08 | ||
− | |In this tutorial, we will learn how to | + | |In this tutorial, we will learn how to:* use '''default Snippets''' |
|- | |- | ||
Line 21: | Line 21: | ||
|- | |- | ||
| 00:17 | | 00:17 | ||
− | |'''Highlight matching brackets''' and '''Document Statistics''' | + | |'''Highlight matching brackets''' and * '''Document Statistics'''. |
|- | |- | ||
| 00:22 | | 00:22 | ||
− | |To record this tutorial, I am using: '''Ubuntu Linux''' 14.04 operating system '''gedit Text editor''' 3.10 | + | |To record this tutorial, I am using: |
+ | '''Ubuntu Linux''' 14.04 operating system | ||
+ | '''gedit Text editor''' 3.10 | ||
|- | |- | ||
| 00:33 | | 00:33 | ||
− | |To follow this tutorial, you should have working knowledge of any operating system. | + | |To follow this tutorial, you should have working knowledge of any '''operating system'''. |
|- | |- | ||
| 00:39 | | 00:39 | ||
− | |What are snippests ? | + | |What are '''snippests'''? |
|- | |- | ||
Line 61: | Line 63: | ||
|- | |- | ||
| 01:12 | | 01:12 | ||
− | |From the Main | + | |From the Main menu, click '''Edit''' and '''Preferences'''. |
|- | |- | ||
Line 89: | Line 91: | ||
|- | |- | ||
| 01:49 | | 01:49 | ||
− | |Now type the word '''If''' and press the '''Tab''' key. | + | |Now, type the word '''If''' and press the '''Tab''' key. |
|- | |- | ||
Line 109: | Line 111: | ||
|- | |- | ||
| 02:12 | | 02:12 | ||
− | |We can see the open curly braces | + | |We can see the open curly braces and end braces are inserted automatically. |
|- | |- | ||
Line 137: | Line 139: | ||
|- | |- | ||
| 02:54 | | 02:54 | ||
− | |The '''Manage Snippets''' dialog box appears. | + | |The '''Manage Snippets''' dialog-box appears. |
− | + | ||
|- | |- | ||
Line 179: | Line 180: | ||
| 03:48 | | 03:48 | ||
|You can see the syntax for this on the top right panel. | |You can see the syntax for this on the top right panel. | ||
− | |||
|- | |- | ||
| 03:53 | | 03:53 | ||
− | |Note the | + | |Note the '''Tab trigger''' as '''elif'''. |
|- | |- | ||
Line 219: | Line 219: | ||
|- | |- | ||
| 04:38 | | 04:38 | ||
− | |In the '''Manage Snippets''' dialog box that appears, select '''C'''. | + | |In the '''Manage Snippets''' dialog-box that appears, select '''C'''. |
|- | |- | ||
Line 251: | Line 251: | ||
|- | |- | ||
| 05:18 | | 05:18 | ||
− | |Save the file as '''helloworld.c''' . | + | |'''Save''' the file as '''helloworld.c''' . |
|- | |- | ||
Line 263: | Line 263: | ||
|- | |- | ||
| 05:35 | | 05:35 | ||
− | |Type “hello” and press the Tab key. | + | |Type “hello” and press the '''Tab''' key. |
|- | |- | ||
Line 270: | Line 270: | ||
|- | |- | ||
| 05:45 | | 05:45 | ||
− | |This is how we create and use a custom snippet. | + | |This is how we create and use a custom '''snippet'''. |
|- | |- | ||
Line 278: | Line 278: | ||
|- | |- | ||
| 05:54 | | 05:54 | ||
− | |From the Main menu, click Tools and Manage Snippets. | + | |From the '''Main''' menu, click '''Tools''' and '''Manage Snippets'''. |
|- | |- | ||
| 05:59 | | 05:59 | ||
− | |In the snippet list, click C. | + | |In the '''snippet''' list, click '''C'''. |
|- | |- | ||
Line 290: | Line 290: | ||
|- | |- | ||
| 06:07 | | 06:07 | ||
− | |At the bottom left of the window, click the minus icon to delete a snippet. | + | |At the bottom left of the window, click the '''minus''' icon to delete a '''snippet'''. |
+ | |||
|- | |- | ||
| 06:13 | | 06:13 | ||
− | |The snippet is deleted. | + | |The '''snippet''' is deleted. |
|- | |- | ||
| 06:16 | | 06:16 | ||
− | |Now, locate the snippet ‘While loop’ from the list and select it for deletion. | + | |Now, locate the '''snippet''' '''‘While loop’''' from the list and select it for deletion. |
|- | |- | ||
| 06:23 | | 06:23 | ||
− | |We can see here that the delete icon is disabled. | + | |We can see here that the '''delete''' icon is disabled. |
|- | |- | ||
| 06:28 | | 06:28 | ||
− | |This means we can only delete the snippets which we have created, and not the default ones. | + | |This means we can only delete the '''snippets''' which we have created, and not the default ones. |
|- | |- | ||
| 06:35 | | 06:35 | ||
− | |Click Close. | + | |Click '''Close'''. |
|- | |- | ||
| 06:37 | | 06:37 | ||
− | |Let us switch back to NumCheck.c tab. | + | |Let us switch back to '''NumCheck.c''' tab. |
|- | |- | ||
Line 327: | Line 328: | ||
|- | |- | ||
| 06:58 | | 06:58 | ||
− | |From the Main menu, click Edit and Preferences. | + | |From the '''Main''' menu, click '''Edit''' and '''Preferences'''. |
|- | |- | ||
| 07:03 | | 07:03 | ||
− | |In the View tab, check the Highlight matching brackets box. | + | |In the '''View''' tab, check the '''Highlight matching brackets''' box. |
+ | |||
|- | |- | ||
| 07:07 | | 07:07 | ||
− | |Click Close. | + | |Click '''Close'''. |
|- | |- | ||
Line 347: | Line 349: | ||
| 07:22 | | 07:22 | ||
|Place your cursor on the second open curly braces. | |Place your cursor on the second open curly braces. | ||
+ | |||
|- | |- | ||
| 07:27 | | 07:27 | ||
Line 353: | Line 356: | ||
|- | |- | ||
| 07:33 | | 07:33 | ||
− | |This is good way to keep track of the brackets in a program. | + | |This is a good way to keep track of the brackets in a program. |
+ | |||
|- | |- | ||
| 07:38 | | 07:38 | ||
Line 360: | Line 364: | ||
|- | |- | ||
| 07:44 | | 07:44 | ||
− | |Next we will learn about the Document Statistics feature. | + | |Next we will learn about the '''Document Statistics''' feature. |
|- | |- | ||
| 07:49 | | 07:49 | ||
− | |Document Statistics plugin shows the various statistics related to the current document. | + | |'''Document Statistics plugin''' shows the various statistics related to the current document. |
+ | |||
|- | |- | ||
| 07:56 | | 07:56 | ||
− | |It shows information such as: | + | |It shows information such as: |
+ | Number of words | ||
+ | |||
+ | Number of lines | ||
+ | |||
+ | Number of characters | ||
+ | |||
+ | Number of non-space characters | ||
+ | |||
+ | Size of the file in bytes. | ||
|- | |- | ||
Line 375: | Line 389: | ||
|- | |- | ||
| 08:14 | | 08:14 | ||
− | |From the Main menu, click Edit and Preferences. | + | |From the '''Main''' menu, click '''Edit''' and '''Preferences'''. |
|- | |- | ||
| 08:19 | | 08:19 | ||
− | |Click on the Plugins tab. | + | |Click on the '''Plugins''' tab. |
|- | |- | ||
| 08:22 | | 08:22 | ||
− | |Scroll down to see Document Statistics option. | + | |Scroll down to see '''Document Statistics''' option. |
|- | |- | ||
| 08:26 | | 08:26 | ||
− | |If the Document Statistics plugin is not enabled then check it. | + | |If the '''Document Statistics plugin''' is not enabled then check it. |
|- | |- | ||
| 08:32 | | 08:32 | ||
− | |Click Close. | + | |Click '''Close'''. |
|- | |- | ||
| 08:34 | | 08:34 | ||
− | |From the Main menu, select Tools and Document Statistics. | + | |From the '''Main''' menu, select '''Tools''' and '''Document Statistics'''. |
|- | |- | ||
| 08:39 | | 08:39 | ||
− | |The Document Statistics dialog box opens. | + | |The '''Document Statistics''' dialog-box opens. |
|- | |- | ||
| 08:43 | | 08:43 | ||
− | |It displays the statistics including lines, words, characters and bytes in the document NumCheck.c | + | |It displays the statistics including lines, words, characters and bytes in the document '''NumCheck.c''' |
|- | |- | ||
| 08:53 | | 08:53 | ||
− | |In the file NumCheck.c, change the words as shown. | + | |In the file '''NumCheck.c''', change the words as shown. |
|- | |- | ||
| 09:01 | | 09:01 | ||
− | |Now, from the Document Statistics dialog box, click on Update. | + | |Now, from the '''Document Statistics''' dialog-box, click on '''Update'''. |
|- | |- | ||
| 09:07 | | 09:07 | ||
|Notice, that the information has been updated to reflect the changes we made. | |Notice, that the information has been updated to reflect the changes we made. | ||
+ | |||
|- | |- | ||
| 09:12 | | 09:12 | ||
− | |Click Close. | + | |Click '''Close'''. |
|- | |- | ||
Line 433: | Line 448: | ||
|- | |- | ||
| 09:27 | | 09:27 | ||
− | |In this tutorial, we learnt how to: Use default snippets | + | |In this tutorial, we learnt how to: * Use default '''snippets''' |
|- | |- | ||
| 09:32 | | 09:32 | ||
− | |Add new snippets | + | |Add new '''snippets''' |
|- | |- | ||
| 09:34 | | 09:34 | ||
− | |Delete snippets | + | |Delete '''snippets''' |
|- | |- | ||
| 09:36 | | 09:36 | ||
− | |Highlight matching brackets | + | |Highlight matching brackets and * Document Statistics. |
|- | |- | ||
Line 453: | Line 468: | ||
|- | |- | ||
| 09:44 | | 09:44 | ||
− | |Create a new custom snippet named company header | + | |Create a new custom '''snippet''' named '''company header'''. |
|- | |- | ||
| 09:49 | | 09:49 | ||
− | |Enter the complete company address in the edit panel | + | |Enter the complete company address in the edit panel. |
|- | |- | ||
| 09:53 | | 09:53 | ||
− | |In the Tab trigger field, enter the shortcut key as company | + | |In the '''Tab trigger''' field, enter the '''shortcut key''' as '''company'''. |
|- | |- | ||
| 09:58 | | 09:58 | ||
− | |Open a new document and use the snippet. | + | |Open a new document and use the '''snippet'''. |
|- | |- | ||
| 10:02 | | 10:02 | ||
− | |The video at the following link | + | |The video at the following link summarizes the '''Spoken Tutorial''' project. Please download and watch it. |
− | Please download and watch it. | + | |
|- | |- | ||
| 10:10 | | 10:10 | ||
− | |The Spoken Tutorial Project Team: conducts workshops using spoken tutorials and gives certificates on passing online tests. | + | |The '''Spoken Tutorial Project''' Team: |
+ | conducts workshops using spoken tutorials and | ||
+ | gives certificates on passing online tests. | ||
|- | |- | ||
| 10:19 | | 10:19 | ||
Line 482: | Line 498: | ||
| 10:22 | | 10:22 | ||
|Please post your timed queries in this forum. | |Please post your timed queries in this forum. | ||
− | |||
|- | |- | ||
Line 489: | Line 504: | ||
|- | |- | ||
− | | | + | |10:39 |
− | |This is Nirmala Venkat from IIT Bombay, signing off. Thanks for watching. | + | |This is Nirmala Venkat from '''IIT Bombay''', signing off. Thanks for watching. |
|} | |} |
Latest revision as of 17:09, 30 April 2019
Time | Narration |
00:01 | Welcome to the Spoken Tutorial on Snippets in gedit Text editor. |
00:08 | In this tutorial, we will learn how to:* use default Snippets |
00:13 | Add new snippets |
00:15 | Delete snippets |
00:17 | Highlight matching brackets and * Document Statistics. |
00:22 | To record this tutorial, I am using:
Ubuntu Linux 14.04 operating system gedit Text editor 3.10 |
00:33 | To follow this tutorial, you should have working knowledge of any operating system. |
00:39 | What are snippests? |
00:41 | Snippets are lines of text or source code that are used frequently while writing a program. |
00:49 | It allows the user to avoid repetitive typing. |
00:54 | Snippets is one of the default plugins in gedit Text editor. |
00:59 | Let's see how we can create and use Snippets. |
01:04 | Let's open the gedit Text editor. |
01:08 | First we need to enable the Snippet plugin. |
01:12 | From the Main menu, click Edit and Preferences. |
01:17 | In the Plugin tab, scroll down and check the Snippets box. |
01:23 | Click Close. |
01:25 | Let us write a 'C' program to check whether a given number is positive or negative. |
01:32 | First Let us save the file as NumCheck.c |
01:39 | Pause this tutorial and type this code in your gedit Text editor. |
01:44 | When you have finished typing, place your cursor on the next line. |
01:49 | Now, type the word If and press the Tab key. |
01:54 | Can you see the structure of the If statement automatically inserted here? |
02:00 | Notice that the cursor is on the word condition, by default. |
02:05 | Type num==0. |
02:09 | The word condition is overwritten. |
02:12 | We can see the open curly braces and end braces are inserted automatically. |
02:18 | This is because we have added the plugin called Intelligent text completion in the previous tutorial. |
02:26 | Type printf open brackets double quotes. |
02:31 | Notice the end double quotes are also inserted automatically. |
02:36 | Recall that one of the features of Intelligent Text Completion is “Auto close brackets and quotes”. |
02:44 | Now type as shown here. |
02:48 | Now, from the Main menu, select Tools and Manage Snippets. |
02:54 | The Manage Snippets dialog-box appears. |
02:56 | On the left side panel, scroll down and select 'C'. |
03:02 | Click on the triangle sign next to it. |
03:06 | The list of all the Snippets for 'C' are listed here. |
03:11 | Click on the If snippet. |
03:14 | In the top right panel, you can see the complete syntax for the 'If' statement in 'C' language. |
03:21 | Look at the Tab Trigger field at the right bottom. It is displayed as 'If', by default. |
03:30 | So, by typing 'If' and pressing the Tab key, the complete 'If' statement gets inserted. |
03:38 | Let us see one more snippet called else if. |
03:42 | On the left hand side, click on the else if snippet under 'C'. |
03:48 | You can see the syntax for this on the top right panel. |
03:53 | Note the Tab trigger as elif. |
03:56 | Click Close. |
04:00 | Let us see how to use this snippet in our program. |
04:04 | Type elif and press tab. |
04:09 | You can see that the syntax for 'else if' is inserted here. |
04:14 | Type the program code as shown here. |
04:19 | So, with the help of Snippets, we can avoid repetitive typing in our source code. |
04:26 | Next, we will see how to create our own Snippet. |
04:30 | Now, from the Main menu, click Tools and Manage snippets. |
04:38 | In the Manage Snippets dialog-box that appears, select C. |
04:42 | At the bottom left of the window, click the plus icon to create a new snippet. |
04:49 | Type “HelloWorld” and press Enter. |
04:53 | Then click on the Edit panel. |
04:56 | Type the following code. This is a simple basic program in 'C'. |
05:02 | In the Tab trigger field, type “hello”. This is the shortcut keyword used in the editor. |
05:10 | Click Close. |
05:13 | Open a new document in the gedit Text editor. |
05:18 | Save the file as helloworld.c . |
05:22 | If you don't save the file with '.c' extension, the snippets will not work. |
05:29 | It will consider the file as a text file, not a 'c' program file. |
05:35 | Type “hello” and press the Tab key. |
05:39 | The text that we typed in the ‘HelloWorld’ snippet is inserted here. |
05:45 | This is how we create and use a custom snippet. |
05:50 | Next, let us see how to delete a snippet. |
05:54 | From the Main menu, click Tools and Manage Snippets. |
05:59 | In the snippet list, click C. |
06:02 | Click on the snippet ‘HelloWorld’ which we have created. |
06:07 | At the bottom left of the window, click the minus icon to delete a snippet. |
06:13 | The snippet is deleted. |
06:16 | Now, locate the snippet ‘While loop’ from the list and select it for deletion. |
06:23 | We can see here that the delete icon is disabled. |
06:28 | This means we can only delete the snippets which we have created, and not the default ones. |
06:35 | Click Close. |
06:37 | Let us switch back to NumCheck.c tab. |
06:42 | In this 'C' program, you can see brackets of different types. |
06:47 | Sometimes, we may lose track of the closing bracket that matches the opening bracket. |
06:54 | Let us see how to highlight the matching brackets. |
06:58 | From the Main menu, click Edit and Preferences. |
07:03 | In the View tab, check the Highlight matching brackets box. |
07:07 | Click Close. |
07:09 | Now, place the cursor on the open curly braces at the start of the program. |
07:15 | Notice that the last closed curly braces is highlighted immediately. |
07:22 | Place your cursor on the second open curly braces. |
07:27 | Notice that the second last closed curly braces is highlighted in gray color. |
07:33 | This is a good way to keep track of the brackets in a program. |
07:38 | It helps ensure that all open brackets have the corresponding closing brackets. |
07:44 | Next we will learn about the Document Statistics feature. |
07:49 | Document Statistics plugin shows the various statistics related to the current document. |
07:56 | It shows information such as:
Number of words Number of lines Number of characters Number of non-space characters Size of the file in bytes. |
08:10 | Let us switch back to gedit Text editor. |
08:14 | From the Main menu, click Edit and Preferences. |
08:19 | Click on the Plugins tab. |
08:22 | Scroll down to see Document Statistics option. |
08:26 | If the Document Statistics plugin is not enabled then check it. |
08:32 | Click Close. |
08:34 | From the Main menu, select Tools and Document Statistics. |
08:39 | The Document Statistics dialog-box opens. |
08:43 | It displays the statistics including lines, words, characters and bytes in the document NumCheck.c |
08:53 | In the file NumCheck.c, change the words as shown. |
09:01 | Now, from the Document Statistics dialog-box, click on Update. |
09:07 | Notice, that the information has been updated to reflect the changes we made. |
09:12 | Click Close. |
09:15 | This feature is very useful when a document is required to stay within certain number of words. |
09:22 | This brings us to the end of this tutorial. |
09:25 | Let us summarise. |
09:27 | In this tutorial, we learnt how to: * Use default snippets |
09:32 | Add new snippets |
09:34 | Delete snippets |
09:36 | Highlight matching brackets and * Document Statistics. |
09:41 | Here is an assignment for you. |
09:44 | Create a new custom snippet named company header. |
09:49 | Enter the complete company address in the edit panel. |
09:53 | In the Tab trigger field, enter the shortcut key as company. |
09:58 | Open a new document and use the snippet. |
10:02 | The video at the following link summarizes the Spoken Tutorial project. Please download and watch it. |
10:10 | The Spoken Tutorial Project Team:
conducts workshops using spoken tutorials and gives certificates on passing online tests. |
10:19 | For more details, please write to us. |
10:22 | Please post your timed queries in this forum. |
10:26 | Spoken Tutorial project is funded by NMEICT, MHRD, Government of India. More information on this mission is available at this link. |
10:39 | This is Nirmala Venkat from IIT Bombay, signing off. Thanks for watching. |