h4. Functions

*activateTab(_tab_index_)* - Activates tab by index.
_tab_index_ - index of tab to activate. Index of the first tab is 1.


*addMenu(_menu_)* - Adds menu in menubar.
_menu_ - table of TermitMenuItem type.


*addPopupMenu(_menu_)* - Adds menu in popup menu, similar to addMenu.
_menu_ - table of TermitMenuItem type.


*bindKey(_keys_, _luaFunction_)* - Sets new keybinding. If luaFunction is nil removes keybinding.
_keys_ - string with keybinding
_luaFunction_ - callback function

pre. Example: don't close tab with Ctrl-w
    bindKey('Ctrl-w', nil)


*bindMouse(_event_, _luaFunction_)* - Sets new mouse-binding. If luaFunction is nilremoves mouse-binding.
_event_ - string with one of those values: DoubleClick
_luaFunction_ - callback function


*closeTab()* - Closes active tab.


*copy()* - Copies selection into tab's buffer.


*currentTab()* - Returns current tab of TermitTabInfo.


*currentTabIndex()* - Returns current tab index.


*loadSessionDlg()* - Displays "Load session" dialog.


*nextTab()* - Activates next tab.


*openTab(_tabInfo_)* - Opens new tab.
_tabinfo_ - table of TermitTabInfo with tab settings.

pre. Example:
    tabInfo = {}
    tabInfo.title = 'Zsh tab'
    tabInfo.command = 'zsh'
    tabInfo.encoding = 'UTF-8'
    tabInfo.workingDir = '/tmp'
    openTab(tabInfo)


*paste()* - Pastes tab's buffer.


*preferencesDlg()* - Displays "Preferences" dialog.


*prevTab()* - Activates previous tab.


*quit()* - Quit.


*reconfigure()* - Sets all configurable variables to defaults and forces rereading rc.lua.


*saveSessionDlg()* - Displays "Save session" dialog.


*selection()* - Returns selected text from current tab.


*setColormap(_colormap_)* - Sets new colormap.
_colormap_ - array with 8 or 16 or 24 colors.

pre. Example: Tango-like color theme
    colormap = {'#2e2e34343636', '#cccc00000000', '#4e4e9a9a0606', '#c4c4a0a00000',
        '#34346565a4a4', '#757550507b7b', '#060698209a9a', '#d3d3d7d7cfcf',
        '#555557575353', '#efef29292929', '#8a8ae2e23434', '#fcfce9e94f4f',
        '#72729f9fcfcf', '#adad7f7fa8a8', '#3434e2e2e2e2', '#eeeeeeeeecec'}
    setColormap(colormap)


*setEncoding(_encoding_)* - Changes encoding for active tab.
_encoding_ - string with encoding name.

pre. Example:
    setEncoding('UTF-8')


*setKbPolicy(_kb_policy_)* - Sets keyuboard policy for shortcuts.
_kb_policy_ - string with one of those values:

* keycode - use hardware keyboard codes (XkbLayout-independent)
* keysym - use keysym values (XkbLayout-dependent)

pre. Example: treat keys via current XkbLayout
    setKbPolicy('keysym')

*setMatches(_matches_)* - Sets matches and callbacks for them.
_matches_ - table of TermitMatch type.

*setOptions(_opts_)* - Changes default options.
_opts_ - table of TermitOptions type with new options:


*setTabBackgroundColor(_color_)* - Changes background color for active tab.
_color_ - string with new color.


*setTabFont(_font_)* - Changes font for active tab.
_font_ - string with new font.


*setTabForegroundColor(_color_)* - Changes foreground (e.g. font) color for active tab.
_color_ - string with new color.


*setTabTitle(_tabTitle_)* - Changes title for active tab.
_tabTitle_ - string with new tab title.


*setTabTitleDlg()* - Displays "Set tab title" dialog.


*setWindowTitle(_title_)* - Changes termit window title.
_title_ - string with new title.


*spawn(_command_) - Spawns command (works via shell).
_command_ - string with command and arguments.

*toggleMenubar()* - Displays or hides menubar.

h4. Types

*TermitKeybindings* - table with predefined keybindings.

* prevTab - 'Alt-Left'
* nextTab - 'Alt-Right'
* openTab - 'Ctrl-t'
* closeTab - 'Ctrl-w'
* copy - 'Ctrl-Insert'
* paste - 'Shift-Insert'

pre. Example: enable Gnome-like tab switching
    keys = {}
    keys.nextTab = 'Ctrl-Page_Down'
    keys.prevTab = 'Ctrl-Page_Up'
    setKeys(keys)


*TermitMatch* - table for matches.
*field name - match regular expression.
*field value - lua callback for action on Left-click.

pre. Example: matching url
    matches = {}
    matches['http.*'] = function (url) print('Matchin url: '..url) end
    setMatches(matches)


*TermitMenuItem* - table for menuitems.

* name - name for menuitem
* action - lua-function to execute when item activated
* accel - accelerator for menuitem. String with keybinding


*TermitOptions* - table with termit options.

* tabName - default tab name
* encoding - default encoding
* wordChars - word characters (double click selects word)
* font - font name
* foregroundColor
* backgroundColor
* showScrollbar
* fillTabbar - expand tabs' titles to fill whole tabbar
* allowChangingTitle - auto change title (similar to xterm)
* audibleBell - enables audible bell
* visibleBell - enables visible bell
* urgencyOnBell - set WM-hint 'urgent' on termit window when bell
* getWindowTitle - lua function to generate new window title
* getTabTitle - lua function to generate new tab title
* transparentBackground - use transparency
* transparentSaturation - level of saturation [0,1]
* hideSingleTab
* hideMenubar
* scrollbackLines
* geometry - cols x rows to start with


*TermitTabInfo* - table with tab settings:

* title
* command
* encoding
* workingDir
* pid - process id
* font - font string
* fontSize - font size


h4. Globals

*tabs* - Table with tab settings, access specific tabs by index.


