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.

Advertisements
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

Default Open/Save Dialog Directory

Whenever you need to open or save a file/directory, the open/save dialog window will display the contents of a directory. Sometimes that directory is the one that you want, but other times you may find yourself constantly using the file system browser features in the dialog window to change the directory. This can get tiresome if you are doing this often, but TKE can offer some help by making the default directory smarter and more customizable.

To change the way TKE chooses the default directory in the open/save dialog windows, head on over to Preferences (Edit / Preferences / Edit User – Global menu option) and go to the General tab within the General panel.

 

The last option in the tab specifies “Set default open/save browsing directory to:” with a dropdown list containing four options:

  • Last accessed:  TKE will remember the last directory that was in use in an open/save dialog window and use that directory as the default directory the next time the open/save dialog window is used.
  • Current editing buffer directory:  The directory containing the file which is the current editing buffer will be used as the default directory.
  • Current working directory:  The current working directory will be used as the default directory. The current working directory is always displayed in the title bar of the main window and can be changed at any of the methods discussed in our Current Working Directory post.
  • Use directory:  When this option is selected, a directory selection window will be displayed. Use it to navigate to the directory that you want to use as the default directory for subsequent open/save dialogs. The selected directory name will be displayed in the preferences window.

You can change this preference option at any time and, like most TKE preference changes, its selected value will be immediately applied within TKE.

If you using TKE in Vim mode, you can also change this option without needing to open Preferences. Just use the :browsedir value (or :bsdir value) command option and in place of value, use the values of:

  • last: Same as “Last accessed”.
  • buffer: Same as “Current editing buffer directory”.
  • current: Same as “Current working directory”.
  • Or specify the absolute or relative pathname of the directory to use.

Note that changing the default directory using the Vim command will not be remembered when you quit TKE (the preferences value will be the one used upon application startup), so using this method is a terrific way to temporary override the current behavior.

Sweet.

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

Default Open/Save Dialog Directory

Sidebar Ordering and Keyboard Selection

A couple of quick sidebar tips for you.

Tip #1: File/Folder Ordering

Depending on your operating system and personal preferences, you may be more accustomed to having all of the folders grouped at the top of a folder’s listed contents while all files are listed below. Or perhaps you prefer to have your files and folders intermixed in alphabetical order. Whichever way you prefer to view files/folders in the sidebar, TKE has you covered.

To switch the sidebar file/folder ordering, head on over to preferences (Edit / Preferences / Edit User – Global menu option), select the Sidebar panel and make sure that the Behaviors tab is selected. Simply toggle the checkbutton labeled Show Folders at Top to cause the sidebar to display folders first or folders intermixed.

image-2

Tip #2: Keyboard Selection

If the sidebar has keyboard focus, you can quickly select a file or folder within the current folder by typing the name of the file. As long as you enter the successive characters within a second of each other (the default time), the characters will be appended to the current search string; otherwise, waiting beyond a second will cause the search string to clear out and entering another key will select the first file/folder matching the new search string.

If one second between characters is not enough or too much time, you can adjust the value within the same Sidebar / Behavior tab within preferences, by increasing/decreasing the Append characters to search string if entered within: value.

And since we are on the topic of using the keyboard within the sidebar, you can always select the parent folder by hitting the left arrow key and you can open the currently selected folder by hitting the right arrow key. This means that you can quickly change the selection of any file/folder within the sidebar using only the keyboard.

Your mouse or trackpad might get a bit lonelier with these tips.

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

Sidebar Ordering and Keyboard Selection

The current_line Plugin

Perhaps its just a case of aging eyes, but sometimes I find myself searching for the current line that the cursor is on. I could adjust my theme’s cursor color to change it to make it easier to find; however, there is a plugin called the “current_line” plugin which highlights the entire line that the insertion cursor is currently on.

To install the plugin, click on the “Plugin” menu in the main menu and select the “Install…” menu option. In the resulting plugin preview window either type a portion of the name “current_line” or use the up/down arrows to find and select the plugin and hit the RETURN key. At the bottom of the TKE main window, a message indicating that the current_plugin is now installed will be displayed.

 

From that point on, all editing buffers will highlight the current line. What’s nice is that if you change the theme, the current line plugin will continue to work, adjusting the current line to go nicely with the theme’s background color.

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

The current_line Plugin

Pane Alignment and Synchronized Scrolling

Every once in a while, I find myself needing to visually compare two files side-by-side. Unfortunately, there are few tools available (apart from difference tools which typically only allow a read-only view) that allow you to quickly align textual lines and keep them in sync when scrolling one of the files.

Now in TKE (as of version 2.8) there is a great solution. Simply open the two files in separate panes. You can do this by opening the two files, selecting one of the files, right click on the tab and choose the “Move to Other Pane” option.

Once both files are in view, place the insertion cursor on the line in each file that you want to synchronize (you will only the insertion cursor in the active editing buffer but TKE remembers the last insertion point in an editing buffer). The lines do not need to be aligned, just in view. Then select the “View / Panes / Align Panes” menu option. This will cause both of the lines in each buffer to align themselves to each other.

Once the panes have been aligned, you can keep those lines aligned by choosing the “View / Panes / Enable Synchronized Scrolling”. When either buffer is scrolled, the other pane will match itself. Nice.

You can visually know that synchronized scrolling is enabled for the two buffers because the scrollbars in each buffer will be colored differently (usually in a red color but this can be changed within the theme editor). What’s even better is that pane synchronization is remembered for pairs of editing buffers. Change one of the pane’s buffers and synchronized scrolling is disabled for that pair. Re-select the original editing buffers and they will remain synchronized. Very nice.

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

Pane Alignment and Synchronized Scrolling

Relative Line Numbering

Let’s face it — there’s something comforting about having line numbers displayed when editing text.  It aids in debugging failures, it helps gives us a sense of where we are, and it even feels good to hit the return key at the end of a file and see the line number increase, giving us a feeling of accomplishment.  All code editors have line number support as a result.

Continue reading “Relative Line Numbering”

Relative Line Numbering