Configure SciTE to trim whitespace on saves: Automatically clean your code!

trim whitespace

Configuring SciTE to automatically trim whitespace upon file save is super-easy!   A minor tweak to the will tell SciTE to, automatically, trim spaces, tabs, etc. from the end of each line.

The following example is what I added to have it apply to my AutoHotkey files (which have an extension of .ahk).  If you have file patterns you can achieve the same goal by using something like this: strip.trailing.spaces.$(file.patterns.yaml)=0

Configure SciTE to automatically trim whitespace upon file save

Have SciTE automatically trim white space at end of line

Excellent SciTE editor video documenting powerful features

SciTE editor

SciTE Editor demonstration

If you frequently use tools like Notepad, Notepad++,  Textpad, etc. I highly recommend you give the SciTE editor a try! Here is a great video demonstrating it’s powerful features and how it can save you a ton of time!  It is highly customizable (but there is a learning curve to making the tweaks to your user settings.  I love it because I have the property files (which provide IntelliSense & syntax highlighting for ~80 languages)

scite editor

The editor is free and can be downloaded from here.  If you’re using AutoHotKey you can get SciTE4AutoHotkey built by fincs here.

Code Porn | Showing off SciTE Text Editor: Watch people code.



Text file explorer-Determine file headers & delimiters without opening file

Text file explorer

Text File Explorer

I often work with large text files in which the file extension (.txt, .dat, .csv, .tab) doesn’t always indicate what type of delimiter is used in the file.  When the file is small, I’ll typically just “pop” it open in SciTE / Notepad.  Large files (anything over 20 megs) often take a fair amount of time to read and very large files ( a gig or more) will often run into out of memory issues.

On top of wanting to know the delimiter, I also frequently want to know what fields / Headers are in the file.   This normally means I have to open it in a text editor or Excel and review.  I wrote the below Text File Explorer in AutoHotkey script to simplify the above.  I can highlight a file from Windows Explorer and quickly detect the type of delimiter plus display headers if I care to.

Text file explorer AutoHotkey code:

Here’s a video demonstrating the usage of the Text Explorer

Text file evaluator-Determine Type of delimiter and File Headers

Customizing your SciTE Status bars: Create your own to your liking!

scite status barCustomizing SciTE status bars is a great, easy, way to add more relevant information to your needs.

In the below video I walk through how you can make minor tweaks to your status bar by editing your file.  Further down the page I’ve provided some of the built-in variables however there are a ton of additional ones you can check out the defined variables here.

Here is the syntax I walked through in the below video.  The first statusbar.text.1 that is commented out is one I use by default.

SciTE Status Bar customization video

Customize yor SciTE Status Bars

Built-in variables for SciTE status bar

Variable NameMeaning
FilePathfull path of the current file
FileDirdirectory of the current file without a trailing slash
FileNamebase name of the current file
FileExtextension of the current file
Languagename of the lexer used for the current file
SessionPathfull path of the current session
CurrentSelectionvalue of the currently selected text
CurrentWordvalue of word which the caret is within or near
Replacementsnumber of replacements made by last Replace command
SelectionStartColumncolumn where selection starts
SelectionStartLineline where selection starts
SelectionEndColumncolumn where selection ends
SelectionEndLineline where selection ends
CurrentMessagemost recently selected output pane message
SciteDefaultHomedirectory in which the Global Options file is found
SciteUserHomedirectory in which the User Options file is found
SciteDirectoryHomedirectory in which the Directory Options file is found
APIPathlist of full paths of API files from api.filepattern
AbbrevPathfull path of abbreviations file
ScaleFactorthe screen’s scaling factor with a default value of 100