Using a Linux distribution that uses a KDE desktop, you will see a couple of options concerning text editors. The KDE project will officially support a couple of editors, such as Kate and KWrite. Both are graphical text editors containing several advanced features and some extra niceties found in some common standard editors. This section will describe each editor and also the features that you may use in shell scripting.
The KWrite Editor
This is the basic editor for the KDE environment. It offers word-style text editing with support for code syntax editing and highlighting and is used for different programming languages. It uses color-coding to distinguish comments, constants, and functions. You should notice that the for loop carries an icon that connects the opening and closing braces. The editing window provides cut-and-paste capabilities.
The editor has many command line parameters you may use to customize how it starts.
- The Kwrite editor command –stdin triggers the editor to read the data from a standard input device in place of a file.
- –column triggers the editor to specify a column number in a file to initiate the process in the editor’s window.
- –encoding triggers the editor to specify the type of character encoding for a file.
- –line triggers the editor to specify the number of a line in a file to initiate in the editor’s window.
The KWrite editor offers a toolbar and a menu bar at the top of the window used for editing, which allows you to select different features and then change the editor’s configuration settings. The menu bar will contain the following items.
- File helps you load up, save, export or print different pieces of text from different files.
- Edit aids you in manipulating text in the buffer.
- The view helps you manage the appearance of the text in the editor of the window.
- Bookmarks help you handle the pointers to get back to certain locations in the text.
- Tools have some specialized features for the manipulation of the text.
- Settings help you configure the way your editor handles the text.
- Help will give you the information about the editor and its commands.
The Edit Menu of KWrite Editor
Here is a rundown of different commands of the Edit menu of the KWrite editor.
- Undo is used to reverse your latest action in the editor.
- Redo is used to reverse the latest action you undid.
- The cut is used to delete the text you selected and then placed it in the clipboard.
- Copy is used to copy any piece of text that you have selected to the clipboard.
- Copy as HTML is used to copy the selected text to the clipboard as the HTML code.
- Paste is used to insert the current content of the clipboard at the present position of the cursor on the screen.
- Select All is used to select the entire text in your editor.
- Deselect is used to deselect the piece of text that you have currently selected.
- Block Selection Mode permits you to select a piece of text between the columns instead of all the lines.
- Overwrite Mode is used to toggle between insert mode and overwrite mode by replacing text with newly typed text instead of inserting it.
- Find is used to produce the Find Text dialog box, which allows you to customize the text search.
- Find Next is used to repeat the last find operation forward in the buffer.
- Find Previous is used to repeat the last find operation backward in the buffer.
- Replace is used to bring about on the screen the Replace With Dialog box. You can use it to customize a text search.
- Go to Line is used to produce the Goto dialog box. It allows you to enter a certain line number. The cursor jumps to a specified line.
The KWrite Editor Tools
KWrite offers a wide range of tools for users to write and edit their shell scripts. Some of the tools are as under:
- The KWrite editing tool, Read-Only Mode, will lock the text so that no changes may be made while you are still using the editor.
- Filetype will select the file-type scheme used in a piece of text.
- Spelling will start the spellcheck program at the starting point of a piece of text.
- Highlighting will highlight the text based on the content, like the program code or the configuration file.
- Indent will increase the indentation in a paragraph by one.
- The indentation will automate indentation based on the selection you have made in the editor.
- Spelling will initiate the spellcheck program at the beginning point of the text.
- Spellcheck Selection will initiate the spellcheck program on the selected section of a piece of text.
- Unindent will cut down on the indentation of a paragraph by one.
- Clean Indentation will return the paragraph indentation to the original settings.
- Align will bring back the selected lines’ current line to the default indentation settings.
- Uncomment eliminates a comment symbol from the present line based on the type of file.
- Lowercase will set the selected text or the character at the cursor’s present position to lower case.
- Uppercase, will set the selected text or the character at the cursor’s present position to upper case.
- Capitalize, will set the first letter of the selected text or the word at the cursor’s present position to uppercase.
- Join Lines will pair up the selected text or lines at the present position with the next line into a single line.
- Word Wrap Document will enable word wrapping inside a piece of text. If a line moves past the editor window edge, it will continue on the next line.