Difference between revisions of "Gedit-Text-Editor/C3/Snippets-in-gedit/English-timed"

From Script | Spoken-Tutorial
Jump to: navigation, search
 
(One intermediate revision by one other user not shown)
Line 9: Line 9:
 
|-
 
|-
 
|  00:08
 
|  00:08
|In this tutorial, we will learn how to:
+
|In this tutorial, we will learn how to:* use '''default Snippets'''  
* use '''default Snippets'''  
+
  
 
|-
 
|-
 
|  00:13
 
|  00:13
|* Add new '''snippets'''   
+
|Add new '''snippets'''   
  
 
|-
 
|-
 
|  00:15
 
|  00:15
|* Delete '''snippets'''  
+
|Delete '''snippets'''  
  
 
|-
 
|-
 
|  00:17
 
|  00:17
|* '''Highlight matching brackets''' and  
+
|'''Highlight matching brackets''' and * '''Document Statistics'''.  
* '''Document Statistics'''.  
+
  
 
|-
 
|-
 
|  00:22
 
|  00:22
 
|To record this tutorial, I am using:  
 
|To record this tutorial, I am using:  
* '''Ubuntu Linux''' 14.04 operating system   
+
'''Ubuntu Linux''' 14.04 operating system   
* '''gedit Text editor''' 3.10  
+
'''gedit Text editor''' 3.10  
  
 
|-
 
|-
Line 185: Line 183:
 
|-
 
|-
 
|  03:53
 
|  03:53
|Note the Tab '''trigger''' as '''elif'''.  
+
|Note the '''Tab trigger''' as '''elif'''.  
  
 
|-
 
|-
Line 221: 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 253: Line 251:
 
|-
 
|-
 
|  05:18
 
|  05:18
|Save the file as '''helloworld.c''' .
+
|'''Save''' the file as '''helloworld.c''' .
  
 
|-
 
|-
Line 265: Line 263:
 
|-
 
|-
 
|  05:35
 
|  05:35
|Type “hello” and press the Tab key.  
+
|Type “hello” and press the '''Tab''' key.  
  
 
|-
 
|-
 
|  05:39
 
|  05:39
|The text that we typed in the '''‘HelloWorld’''' '''snippet''' is inserted here.  
+
|The text that we typed in the ‘HelloWorld’ snippet is inserted here.  
 
|-
 
|-
 
|  05:45
 
|  05:45
Line 284: Line 282:
 
|-
 
|-
 
|  05:59
 
|  05:59
|In the '''snippet''' list, click C.  
+
|In the '''snippet''' list, click '''C'''.  
  
 
|-
 
|-
 
|  06:02
 
|  06:02
|Click on the snippet '''‘HelloWorld’''' which we have created.  
+
|Click on the snippet ‘HelloWorld’ which we have created.  
  
 
|-
 
|-
Line 358: 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.  
  
 
|-
 
|-
Line 374: Line 372:
 
|-
 
|-
 
|  07:56
 
|  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  
+
|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 405: Line 412:
 
|-
 
|-
 
|  08:39
 
|  08:39
|The '''Document Statistics dialog''' box opens.  
+
|The '''Document Statistics''' dialog-box opens.  
  
 
|-
 
|-
Line 417: Line 424:
 
|-
 
|-
 
|  09:01
 
|  09:01
|Now, from the '''Document Statistics''' dialog box, click on '''Update'''.  
+
|Now, from the '''Document Statistics''' dialog-box, click on '''Update'''.  
  
 
|-
 
|-
Line 441: 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'''  
  
 
|-
 
|-
Line 453: Line 460:
 
|-
 
|-
 
|  09:36
 
|  09:36
|Highlight matching brackets  aned Document Statistics  
+
|Highlight matching brackets  and * Document Statistics.
  
 
|-
 
|-
Line 461: 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'''.
  
 
|-
 
|-
Line 477: Line 484:
 
|-
 
|-
 
|  10:02
 
|  10:02
|The video at the following link summarises the Spoken Tutorial project.Please download and watch it.  
+
|The video at the following link summarizes the '''Spoken Tutorial''' project. 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 496: Line 505:
 
|-
 
|-
 
|10:39
 
|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.

Contributors and Content Editors

Jyotisolanki, Pratik kamble, Sandhya.np14