Using Sessions

Sessions is how Kate lets you keep more than one list of files and GUI configuration around. You can have as many named sessions as you want, and you can use unnamed or anonymous sessions for files you want to use only once. Currently Kate can save the list of open files, and the general window configuration in the session, future versions of Kate may add more features that can be saved in sessions. With the introduction of sessions, Kate also allows you to open any number of instances of the application instead of just one as it used to do as the default behavior.

Sessions are supported in three areas:

When starting a new session, the GUI configuration of Default Session is loaded. To save window configuration in the default session, you need to enable saving window configuration in the sessions configuration page of the configuration dialog and then load the default session, set up the window as desired and save the session again.

When a named session is loaded, Kate will display the session name at the start of the window title, which then have the form "Session Name: Document name or URL - Kate"

When opening files on the command line with --start name or if a session is selected using the session chooser, the specified session is loaded prior to the files specified on the command line. To open files from the commandline in a new, unnamed session, configure kate to start a new session as default in the session page of the configuration dialog or use --start with an empty string: ''.

Since Kate 2.5.1 the PID of the current instance is exported to the environment variable KATE_PID. When opening files from the built in terminal Kate will automatically select the current instance if nothing else is indicated on the command line.

Restoring old style Kate behavior

When you get used to using sessions you will hopefully see that they provide a very simple and efficient tool for working in different areas. However, if you prefer the old Kate behavior (one instance opens all files), you can easily achieve that by following this simple strategy:

  • Make kate always start with the --use parameter by adding that to the command in the application preferences, and additionally using a shell alias.

  • Configure Kate to load the last used session at startup.

  • Configure Kate to save the file list when closing a session.

  • Load the default session once