Kon startup

First Kon checks if there is a previous instance already running. If there is, the filenames specified at startup are passed to the previous instance.

Otherwise, if this is the first instance, configuration data such as preferences, and window positions are loaded. Then the syntax definition file, kon.syn, is loaded.

Finally (before the actual files to edit are loaded), the K startup module is loaded. This is where you should place code that is run during startup, constant defintions and functions that should be available while Kon is running.

K startup module

The startup module is named startup.k and is placed in <KON HOMEDIR>\k, where <KON HOMEDIR> is the directory where Kon is installed, such as C:\Program Files\Kon.

The function being called initially is startup(). The most important thing placed here by default is the key bindings, and the code for building the main menu.

The default startup function looks like this:

startKon()
{
  bindKey( "Ctrl+q-Ctrl+f", "searchDialog();" );
  bindKey( "Ctrl+q-Ctrl+a", "replaceDialog();" );
  bindKey( "F3", "repeatFind();" );
  bindKey( "Ctrl+k-Ctrl+s", "saveFile();" );
  bindKey( "F2", "saveFile();" );
  bindKey( "Ctrl+s", "saveFile();" );
  bindKey( "Ctrl+Insert", "copyBlockToClipboard();" );
  .
  . // Parts removed
  .
  bindKey( "Ctrl+Space", "savePos();" );
  bindKey( "Ctrl+Up", "jumpToPrevPos();" );
  bindKey( "Ctrl+Down", "jumpToNextPos();" );
  
  buildMainMenu();

  print( "*** startup script is finished" );
}

buildMainMenu() is located in the K-file menu.k.

Startup.k includes a number of files by default: