Publish Markdown Plugin

In our last tip, we went over how to manually order files and directories within the TKE sidebar. What we didn’t cover is why you would ever want to manually sort files in the sidebar in the first place. One such reason we would do this is to control the order that files are processed within a directory from something like a plugin. The Publish Markdown plugin is one plugin which uses the sidebar ordering of the files to collate Markdown files into a single file and then hand that single file to a Markdown processor for export. This allows you to split your Markdown document into separate files (say, a file per chapter or section) and then organize the files into a particular order to generate a single export document.

After the plugin is installed, it is accessible by right-clicking on a sidebar item. If the item is a directory, all files within the directory and all of its subdirectories will be traversed and organized, in order, into a single temporary Markdown file. After this is complete, the export window will be displayed.

Publish Markdown Export window

If you want to save the file, select “Publish To”, select a directory to save the file to, and click “Publish”.

If you want to export the file as HTML directly, select “Publish To”, select a directory to save the HTML file to, select the “Export As HTML” option, and click “Publish”.

If you want to send the resulting file to an external application, select “Open In”, choose the application from the dropdown list (more on this in a bit), and click “Publish”.

Plugin Options

The Publish Markdown plugin has several options to configure its behavior that are accessible from the Preferences window within the Plugin panel. Select the “publish_markdown” option from the pull-down menu to reveal the options.

Publish Markdown Preferences Panel

You can specify an alternative Markdown processor, select which file extensions will be considered for inclusion, select which file patterns can be used to ignore certain files and setup the external applications that can be accessed by this plugin.

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

Advertisements
Publish Markdown Plugin

Sidebar Sorting

A new trick that TKE version 3.3 learned was how to move files/directories within the sidebar via drag and drop and how to allow manually sorting of files/directories within the sidebar using the same technique. In the past, you could always move a file or directory to a new location by selecting the item in the sidebar, right-clicking to display the contextual menu, select the rename option, and proceed to change the name or even the entire pathname of the file. This method of renaming still exists; however, there is now a simpler way to do this using the mouse.

Moving Files And Folders

 

To move a file or folder from one location in the sidebar to another, simply left-click on the item or items to move and then drag them to the new location in the sidebar. The TKE sidebar has support for spring loading folders while items are being dragged. Just move the cursor over a closed folder for a second while the left button is still pressed and the folder will automatically open, allowing you to continue delving down into the file system to find the destination folder to drop the items into. Additionally, if the destination folder is not currently in view in the sidebar, dragging files to the top or bottom of the sidebar will cause the sidebar to autoscroll. Nifty.

Manually Sorting Contents In A Folder

Pretty intuitive so far, right? Well, what can I do if I want to place the dragged items into a specific order within a folder? Perhaps I want a dragged item to be placed at the top of the destination folder’s contents instead of sorted alphabetically. Well, TKE has your back there, too.

First, you need to enable manually sort for the folder. To do this, select the folder, right-click to bring up the folder’s contextual menu, and select the Sort / Manually option. Nothing will immediately happen in the user interface; however, TKE will create a file within directory called “.tkesort”, storing the current order of the items in the directory. After that selection has occurred, you will be able to drag and drop items within the folder and TKE will remember the manually sorted order of those items, even between TKE sessions. Super simple.

Other Sorting Odds And Ends

 

In addition to the Manual sorting option, you can revert back to sorting by name at any time by selecting the “Sort / By Name” option in the directory’s contextual menu. TKE will not destroy the .tkesort file that exists in the directory, so switching back to manual sorting will revert the sorted state of the folder back to its original view if manual sorting is reselected in the future.

When a folder is sorted by name, you can sort it alphabetically or in reverse alphabetical order by selecting the “Sort / Increasing” or “Sort / Decreasing” options.

And that’s how the sidebar in TKE became your new best friend 🙂

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

Sidebar Sorting

Bird’s Eye View

Most of the time you want to keep your head down and stay focused on coding up the task at hand. However, every once in a while it’s nice to see where you have been and get a 10,000 foot view of your code. To that end, the TKE text editor comes with a built-in “Bird’s Eye View” panel that you can hide or show via the View / Bird’s Eye View menu option. This displays a high-level representation of the current editing buffer by displaying your file’s code (syntax highlighting included) on the right-hand side of the editing buffer.

Bird’s Eye Viewer (on right)

 

In addition to displaying a bird’s eye representation of the file, this pane can also be used for navigating to different points within the file. The following are few tips on using the Bird’s Eye View panel for navigating.

  1. Use the mouse scrollbar, while the cursor is within the panel, to scroll the view panel up and down. This won’t change the editing buffer view.
  2. Holding down the Control key while left/right-clicking in the panel will cause the bird’s eye view to scroll up/down by a screen at a time.
  3. When the cursor is within panel, a translucent background will be displayed to show you what the editing buffer is currently displaying.
  4. Left-click in the panel to jump the editing buffer view to that location within the file.
  5. Left-click and drag in the panel to cause the editing buffer view to change.

As you scroll the editing buffer, the bird’s eye view will automatically adjust itself to make sure that the current editing buffer content is displayed in the bird’s eye view panel.

You can control the font size and width of the Bird’s Eye View panel within Preferences by selecting the View pane. From here you can control whether the panel is always displayed when a file is opened by selecting the Show Bird’s Eye View checkbox. At the bottom of the View panel, you can change the font size of the text used in the panel with the Bird’s Eye View Font Size value selector, and you can change the pixel width of the panel using the Bird’s Eye View Width value selector.

Preference Window View Panel


Important note:
It is recommended that you not enable this feature by default within preferences as it can have a negative impact on the application’s performance. By using the menu option to enable the view, you only display the panel for the current editing buffer, which should keep things moving along nicely while you are using it.

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

Bird’s Eye View

Calendar Plugin

This tip is a fairly quick one. If you have ever needed/wanted to generate a monthly mini calendar, TKE 3.3 now has the all new Calendar plugin which will accomplish just that.

Inserted Calendar Text

 

After the plugin in installed, place the insertion cursor in the editing buffer where you want the calendar to be inserted. Then select the Plugins / Calendar / Insert Mini Calendar menu option. This will display the date range selection window as shown below:

Date Selection Window

 

Use the window to select the starting and ending month to generate and select the OK button to instantly insert a calendar in your editing buffer. Each consecutive month will be inserted below the previous month. To insert a single month, just make sure that the starting and ending month are the same.

Sometimes it’s the little things that make the difference.

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

Calendar Plugin

The Sidebar Information Panel

Files and directories on your file system contain a lot of meta data associated with them. Sometimes, we need to get at that information for various reasons. This typically requires the use of your operating system’s file system viewer, the terminal and/or other 3rd party software. Jumping around to other pieces of software on your desktop can be disruptive to a good workflow and that’s where the new sidebar information panel in TKE (version 3.3) comes in handy.

This panel is displayed at the bottom of the sidebar and allows you to view information for any file that is displayed within the sidebar. To view file/directory information, either right-click on a file or directory within the sidebar and select the “Show Info” menu item or hold down the Control key while right-clicking on a file/directory. A representation of this panel is shown below.

Sidebar Information Panel

In this representation, we see that an image file’s information is being viewed, including a 64×64 thumbnail preview of the image, file name, image dimensions, syntax type, file size, modification date, file permissions, file owner, file group, current version control number, and the TKE favorited status of the file. The information displayed within this file will be customized depending on the item type selected (i.e., image file, text file, directory).

But wait, there’s more… In addition to this information, several other file/directory attributes can be optionally displayed by heading over to the Preferences window (Edit / Preferences / Edit User – Global), selecting the Sidebar panel and clicking on the Info Panel tab.

Sidebar Information Panel Preferences

Simply check/uncheck the file/directory attributes within this panel to control what information is displayed. By default, the panel will only be displayed when the sidebar has the current input focus. However, if you would prefer to keep it visible when the sidebar does not have keyboard focus, simply check the “Keep file information panel visible when sidebar doesn’t have focus” option.

Back in the information panel itself, there are a few other useful functions you can perform when the mouse cursor is within the panel.

  1. Clicking on the ‘x’ button will remove the panel from the sidebar.
  2. Clicking on the “refresh” button will refresh the information within the panel (by default, the information is refreshed if the user is editing the associated file and saves it).
  3. Clicking on the “eye” button will cause the associated file/directory to be displayed and selected within the sidebar.
  4. Clicking on the value of any attribute that is clickable will copy that information to the clipboard.

Finally, it is possible for future plugins to display additional information within this panel, making it extensible and infinitely more useful.

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

The Sidebar Information Panel

Clipboard Snippet Workflow for Markdown

Instead of talking about a TKE feature this week, let’s look at creating a simple but potentially useful workflow that allows us to copy a URL to the clipboard and essentially paste the text as a well-formatted Markdown link, using a snippet.

To create the snippet, open the TKE Preference window (Command-, on Mac or Control-, on other platforms). Select the Snippets panel and make sure that the Language option menu within the Snippets panel is set to “Markdown”. To add a new snippet, click on the Add button and fill in the resulting snippet editor pane as follows:

After giving the snippet an expansion keyword “clipurl” and entering the snippet code, click the Save button at the bottom of the editing panel to save the snippet. The Preference window will change the snippet panel view to show the list of all saved snippets that are specific to the Markdown syntax. You should see your new “clipurl” snippet in the table which will look like:

So what is going on in this snippet text? Well, when we enter the snippet keyword in a Markdown editing buffer, the snippet will grab the contents stored in the clipboard (a URL in this case), it will remove the URL scheme including the “://“ characters and place the remaining contents between a square bracket pair (this is the displayed link name within a Markdown link). It will then output the full URL between a pair of parenthesis (the link URL within a Markdown link).

So now let’s close the preference window and test out the new clipboard snippet. To do that, navigate to a website within your web browser (we’ll use tke.sourceforge.net for this example) and copy the URL from the address bar. Then back in TKE, create a new editing buffer (Command-n or Control-n), set the syntax of the new editing buffer to Markdown, input our new snippet text “clipurl” in the editing buffer and enter the TAB key to expand our snippet which should look as follows:

Cool! It’s a valid Markdown link with the displayed link name being the copied URL name minus the “http://“ syntax, while the full URL exists in the URL portion of the Markdown link. To test the link out, right click on the underlined link name and the link should be displayed within your web browser.

Now whenever you are working on that next great Markdown document, you can quickly create a Markdown link by simply copying a URL to the clipboard and entering “clipurl”. Try thinking about other ways that you can manipulate the clipboard (or even contents in clipboard history) using snippets to increase your editing productivity.

Consider yourself are a certified TKE power user now. Feel free to impress your friends.

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

Clipboard Snippet Workflow for Markdown

Perforce Plugin

This plugin may only apply to a small subset of the TKE user base who use Perforce for their version control system, but it’s a really handy one that does one thing really well. When you are working with Perforce-controlled files, getting permissions to edit a file requires that you always execute the ‘p4 edit <filename>’ command before you save the file contents. This usually means that you need to open a terminal, enter the command, then go to your editor where you make and save the change.

The Perforce plugin, when installed, automatically performs a p4 edit on the file when the file is saved. This will greatly improve your workflow when editing Perforce-controlled files (so much so that it will bother you to use other editors that don’t have this feature).

To install the plugin, simply click on the Plugins / Install… menu item and select the Perforce plugin from the available list. Before using the plugin, select the Plugins / Perforce / Edit include directories menu option. This will open a settings file in a new editing buffer which will look like the following:

# Host Directory
# ——— ————

Below the line, enter the name of the server containing the Perforce view that you would like to edit (i.e., the result of executing the ‘hostname’ command on *nix filesystems), followed by one or more spaces, and the base directory containing the Perforce view to edit (i.e., the result of displaying $P4WORKAREA in a terminal). Save the file, close it, and you are ready to start editing without the tedium ad nauseum of ‘p4 edit’ madness. You can add as many Perforce host-directory combinations that you need, if you are someone who works with multiple views on several machines.

If at any time, you want to disable this feature, simply select the Plugins / Perforce / Disable edit on open menu option. The plugin even provides a feature which will revert the current file if you want to throw away changes made to the file since the last file submission via the Plugins / Perforce / Revert current file menu option.

Once you have this plugin enabled and firing on all cylinders, you’ll never want to go back.

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

Perforce Plugin