Text Formatting

When you are editing files with a syntax type that supports text formatting, you can quickly get tired of adding the syntax that is required for doing things like bolding, italicizing, underlining, etc. However, if you are using TKE to do the editing, then your editor has your back.

If you need to italicize some text that you have already typed, simply select the text and use the Edit / Format / Italics (or use the shortcut Command/Control-I). TKE will insert the correct syntax before or around the text. This functionality is super handy and will save a ton of keystrokes, but TKE’s text formatting capabilities don’t stop there.

If you need to bold some text that you are about to type, simply select the Edit / Format / Bold (or using the shortcut Command/Control-B). TKE will insert the proper emboldening syntax and place the cursor at the appropriate spot to start entering the text to be emboldened. Once you have finished entering the formatted text, if there is bold syntax following the text, simply enter the TAB key to move the cursor to the right of that syntax and continue entering text.

Bonus Tip: Any time that you are editing text and you are not filling in a snippet, hitting the TAB key will advance the cursor to the first whitespace character in the current line (unless the cursor is in the first column when the TAB key is entered).

If you need to remove syntax formatting, simply select the text (including the formatting syntax) and then select the Edit / Format / Remove Formatting (or use the Command/Control-minus keyboard shortcut). Any syntax that can be applied via the text formatting feature will be removed from the selected text.

Text formatting support is currently available for the following syntax descriptions:

  • Markdown
  • MultiMarkdown
  • Fountain
  • HTML
  • HelpSystem
  • ManPage
  • Latex

In addition to text formatting options, TKE also supports the following formatting (depending on the availability of the format support in the syntax):

Text Formatting Submenu

Simple, easy, powerful. TKE might just make text formatting fun again.

To see more information and download your copy of the TKE code editor, visit http://tke.sourceforge.net.

Text Formatting

Vim Macro Recording

A quick tip for Vim mode users…

TKE has support for Vim’s macro recording feature when Vim mode is enabled. Vim macros are basically just a recording of some number of keystrokes that the user used while recording is enabled. These recorded macros can then be “played” at any time which will essentially replay the keystrokes within Vim, allowing you to do a lot of repetitive tasks quite quickly within the editor.

There is support for automatic recording (that is, you can repeat the last Vim command at any time just by pressing the ‘.’ key). You can also repeat the last Vim command-line (started by entering ‘:’ when in COMMAND mode), by entering the ‘@’ key followed by the ‘:’ key.

There is also support for recording to multiple macro “registers”. Each register is named by a single letter of the alphabet (i.e., a-z, A-Z as well as the doublequote (“) character). To begin recording keystrokes to a named register, simply enter ‘q’ (when in COMMAND mode) followed by the name of the register to use and then begin entering the keystrokes that you would like to store in the macro register. When you are done entering keystrokes, enter ‘q’ when in COMMAND mode. While you are recording, the information bar at the bottom of the main window will display the recording status and the name of the macro register being recorded into.

Main Window Status Bar Indicating Recording Status

 

To playback the recorded keystrokes of a register, enter ‘@’ when in COMMAND mode, followed by the name of the register to playback. The keystrokes will be played back immediately.

So if you are Vim user, you probably already know this, but here is the TKE tip for this week….

Vim macros are recordable and usable in any editing buffer within TKE. That means that you could record a macro in one editing buffer and replay that macro in another editing buffer. So if you find yourself performing the same types of tasks in multiple files, do the task once in one buffer and replay the macro in all of the other files. (Insert mind blowing explosion sounds here).

Sweet.

To see more information and download your copy of the TKE code editor, visit http://tke.sourceforge.net.

Vim Macro Recording

Vim Mode

The Vim editor is exceptional in many, many ways, and it has been a staple of many programmers and writers primarily due to its keyboard focused approach to editing and its extensibility and flexibility. Vim is a fantastic editor to use within a terminal because it does not necessitate a graphical user interface and works fairly well when you are spending most of your time within that terminal.

Vim was designed and written at a time when graphical user interfaces were not as mainstream as they are today. I’ll never forget the first few times I attempted to use Vi to edit a file in college. A blank screen with just a cursor staring at me with no instructions for use and, try as I may, typing on the keyboard did practically nothing. I needed to track down someone with knowledge of the editor just to do basic things, and then I needed to commit those first few keystrokes to memory. It’s no wonder that I initially sought out the few graphical editors that were available to me at the time instead of sticking with it. Though Vim’s keyboard-centric editing features, once committed to memory, are incredibly efficient, there are elements of having a graphical user interface that improves on Vim. Ease of learning, discoverability of features, better view modes, and interactions with those features are just some of those improvements.

The marriage of the Vim editing experience and a graphical user interface has been attempted by many editors in the past but many of those editors fall short, relegating Vim mode to a second-class citizen — a plugin of sorts — instead of integrating it into the core experience. There was also many things about gvim (a graphical implementation of a Vim editor) that didn’t seem to work quite right to me.

This is one of the primary reasons TKE was created, to attempt to create a modern editor which integrates deeply with Vim editing functionality. Most editing features added to TKE are implemented for Vim mode first or designed with Vim editing in mind, making sure that Vim editing remains frictionless and central to the TKE editing experience.

If you consider yourself in the Vim camp and are looking for a great graphical Vim editor, give the TKE editor a try. It is hoped that you will find a terrific editing experience with additional superpowers.

To see more information and download your copy of the TKE code editor, visit http://tke.sourceforge.net.

Vim Mode

Markdown Table Beautifier Plugin

In TKE 3.2 a new plugin called the “Markdown Table Beautifier” is included which, when run, cleans up any table syntax found inside of a Markdown document. This essentially involves, making all table columns be vertically aligned and all cell contents be justified according to their column justification indicators. It also will adjust all rows to include the maximum column specified within a table row. All of this cleanup helps make Markdown tables easier to read in Markdown format.

Essentially the Markdown Table Beautifier plugin can run on all tables found within a single Markdown file or it can run only on the table where the insertion cursor is within.

To install the plugin, select the Plugins / Install… menu option, find the Markdown Table Beautifier plugin in the resulting list, highlight it and hit the RETURN key. Once the plugin has been successfully installed, you can run it by simply selecting the Plugins / Markdown Table Beautifier submenu and choosing one of the two available options to beautify all tables or only the currently selected table. Note that these menu options will only be enabled if the file syntax is either Markdown or MultiMarkdown.

Clean and easy to read tables without the fuss? Check and check.

To see more information and download your copy of the TKE code editor, visit http://tke.sourceforge.net.

Markdown Table Beautifier Plugin

Line Wrapping

To line wrap or to not line wrap, that is the question! For a long time, TKE did not provide the ability to wrap lines. Why? Well, first of all, line wrapped programming code can be a bit hard to read. Second, it is creating an editing view that may be inconsistent with other users of the file, leading to potential formatting issues (this is the same argument as to why TKE generally replaces TAB characters with spaces when editing). Third, adding a feature like line wrapping can lead to some tricky corner cases in code. Finally, and probably not least, there were other features that TKE’s developers wanted to get into the tool before it 🙂 However, the latest version of TKE (3.2 as of this writing) fully supports line wrapping, so let’s briefly go over how you can put it to work.

Line wrapping support is a feature which is enabled/disabled by each programming language syntax file. So a programming language like C++ will have line wrapping disabled by default while a writing language like Markdown will enable line wrapping by default. You can, at any time and with any language, temporarily override the default line wrapping behavior by toggling the state of the View / Line Wrapping menu option. When line wrapping is enabled, lines will wrap at the editing buffer ruler location (which is controllable in the Preferences window in the Editor panel).

If you want the line wrapping behavior to be remembered between invocations of TKE, you can do so in the Preferences window within the View panel. Here you can set how TKE should determine the line wrapping state using the Line Wrapping Default option menu at the bottom of the panel. The three option values are as follows:

  • syntax: Use the syntax-specified line wrapping indication to dictate if line wrapping should be enabled or disabled.
  • enable: Always enable line wrapping mode.
  • disable: Always disable line wrapping mode.

For Vim users, wrapped lines offer a few additional cursor motion commands which are as follows (note that logical lines share the same line number within the file but displayed lines are created due to wrapping):

  • g0: Moves the cursor to the first character of the currently displayed line.
  • g^: Moves the cursor to the first non-whitespace character of the currently displayed line.
  • g$: Moves the cursor to the last character of the currently displayed line.
  • gm: Moves the cursor to the middle-most character of the currently displayed line.

Once you have “wrapped” your mind around this feature, you can take your editing to new levels of Zen.

To see more information and download your copy of the TKE code editor, visit http://tke.sourceforge.net.

Line Wrapping

Inserting Enumerations

I don’t know about you, but in the past, I’ve spent a lot of time editing files where I write a line of code which contains a number, duplicate that line a bunch of times, and then proceed to change the number in each line such that they increment by one. The following animated GIF illustrates the problem.

Wouldn’t it be nice if our editor helped us do this type of enumeration more quickly? With multicursor capability, TKE can make this editing task no longer a chore.

After creating the lines of code and duplicating them, hold the SHIFT and ALT/OPTION keys and click and drag a block selection on the numbers in each line. Once all numbers have been selected, select to the Edit / Insert / Enumeration menu option and enter the number “1” in the field at the bottom of the window followed by hitting the RETURN key. This will cause the first line to be numbered a decimal value of 1 and have each line be incremented by 1. Finally, hit the ESCAPE key to exit multicursor mode.

 

TKE also supports creating enumerated values for other bases besides decimal, including binary, octal and hexidecimal. Here’s a few other examples of how to specify the starting value (we’ll use our graphical example to show its effect).

  1. “32’dd10” => “This is line 32’d10. This is line 32’d11. This is line 32’d12…”
  2. “b0+2″ => “This is line 0. This is line 10. This is line 100…”
  3. “0oo6” => “This is line 0o6. This is line 0o7. This is line 0o10…”
  4. “0xxf-1″ => “This is line 0xf. This is line 0xe. This is line 0xd…”
  5. “16’hhf” => “This is line 16’hf. This is line 16’h10. This is line 16’h11…” (i.e., ‘x’ and ‘h’ both indicate a hexidecimal number)

By default, if nothing is entered in the number entry field and the RETURN key is pressed, a decimal value of 0 will be used as the starting value.

Special note for Vim users:
If you select the numbers using the “s” and “Shift-s” keys to cause multicursors to placed at the beginning of each number, you can use “dn” to delete the number and use “#” (pound key) to bring up the enumeration field. Super quick way to do this type of edit without touching the mouse.

So why risk repetitive strain injury? Use your time and keystrokes to get more complicated things done with TKE.

To see more information and download your copy of the TKE code editor, visit http://tke.sourceforge.net.

Inserting Enumerations

Auto-completing HTML/XML tags

HTML editors have many different methods for handling the auto-completion of tags, that is, when an opening tag is entered in the editing buffer (i.e., “<div>”), the closing tag is inserted immediately after by the editor, saving the user time and keystrokes. Various editors use different strategies for detecting when/how to auto-complete:

  1. When the opening tag is completed (with the closing “>” character).
  2. When the start of the closing tag (the “</” characters) is entered and then use some inference logic to insert the correct closing tag.
  3. Do nothing at all.

Each of these solutions have their pros and cons. For example, solution #1 generally performs quickly since it is relatively easy to get the just entered tag name; however, if the user only wants to insert a starting tag at the current insertion point, the editor is inserting text that the user will now have to spend time removing, saving no time and perhaps taking a bit more time to edit. Solution #2 doesn’t have the downside of #1 since the editor only inserts the closing tag when/where the user chooses; however, it can have a bit of a performance impact since the editor needs to infer which closing bracket to insert. Solution #3 has the most flexibility, but obviously doesn’t attempt to help the user in the more common cases.

For HTML/XML tags, TKE takes a slightly different approach to tag auto-completion, relying on its built-in Emmet support. To insert a tag with Emmet, simply enter the name of the tag without the angled tag brackets and enter the Control-E shortcut. This will replace the tag name with both the starting and closing tags as shown in the animated GIF below.

img-alternative-text

If you need to wrap a block of text with a given tag, select the text to wrap, and select the Edit / Emmet / Wrap With Abbreviation menu option. An entry field will be displayed at the bottom of the window, allowing you to enter the tag name to wrap. After entering the tag name, hit the RETURN key to cause the opening/closing tag to be inserted around the selected text. What is even cooler is that TKE will adjust the indentation so that the code looks good after the insertion occurs.

Using Emmet for tag auto-completion has all of the upsides without the downsides since it gives the user all of the control and then some.

To see more information and download your copy of the TKE code editor, visit http://tke.sourceforge.net.

Auto-completing HTML/XML tags