Skip to content

Introduction

The way that DHV works can be configured using a configuration file. This section will describe what can be configured and how.

The location of the configuration file will depend on how your operating system and its settings; but by default it is looked for in $XDG_CONFIG_HOME, in a dhv subdirectory. Mostly this will translate to the file being called ~/.config/dhv/configuration.json.

Keyboard bindings

DHV allows for a degree of configuration of its keyboard bindings; providing a method for setting up replacement bindings for the commands that appear in the command palette.

Bindable commands

The following commands can have their keyboard bindings set:

  • ChangeCodeTheme - Change the theme of the Python code editor
    • Default: ctrl+f9
  • ChangeTheme - Change the application's theme
    • Default: f9
  • Help - Show help for and information about the application
    • Default: f1, ?
  • LoadFile - Load the content of a Python source file
    • Default: ctrl+l
  • NewCode - Empty the editor ready to enter some new code
    • Default: ctrl+n
  • OpcodeCounts - View the count of opcodes in the code
    • Default: f5
  • Quit - Quit the application
    • Default: f10, ctrl+q
  • ShowASTOnly - Only show the AST of the source code
    • Default: ctrl+t
  • ShowDisassemblyAndAST - Show both the disassembly and the AST of the source code
    • Default: ctrl+o
  • ShowDisassemblyOnly - Only show the disassembly of the source code
    • Default: ctrl+b
  • SwitchLayout - Switch the screen layout between horizontal and vertical
    • Default: f2
  • ToggleOffsets - Toggle the display of the offsets
    • Default: f3
  • ToggleOpcodes - Toggle the display of the numeric opcodes
    • Default: f4

Changing a binding

If you wish to change the binding for a command, edit the configuration file and add the binding to the bindings value. For example, if you wanted to change the binding used to toggle the display of numeric opcodes, changing it from f4 to ctrl+t, you would set bindings to this:

"bindings": {
    "ToggleOpcodes": "ctrl+t"
}

The designations used for keys is based on the internal system used by Textual; as such its caveats about what works where apply. The main modifier keys to know are shift, ctrl, alt, meta, super and hyper; letter keys are their own letters; shifted letter keys are their upper-case versions; function keys are simply f1, f2, etc; symbol keys (the likes of #, @, *, etc...) generally use a name (number_sign, at, asterisk, etc...).

Tip

If you want to test and discover all of the key names and combinations that will work, you may want to install textual-dev and use the textual keys command.

If you need help with keyboard bindings please feel free to ask.

Theme

DHV has a number of themes available. You can select a theme using the Change Theme (ChangeTheme, bound to F9 by default) command. The available themes include:

  • catppuccin-latte
  • catppuccin-mocha
  • dracula
  • flexoki
  • gruvbox
  • monokai
  • nord
  • solarized-light
  • textual-dark
  • textual-light
  • tokyo-night

Tip

You can also set the theme via the command line. This can be useful if you want to ensure that DHV runs up with a specific theme. Note that this also configures the theme for future runs of DHV.

Here's a sample of some of the themes:

textual-light DHV v0.8.1 — Python 3.14.0  Source─────────────────────────────────────────────────── Disassembly──────────────────────────────────────────────  1  """The main application class."""0      0RESUME                 0                      2  1      2LOAD_CONST             'The main application  3  ######################################################class.'                4  # Python imports.4STORE_NAME             __doc__                5  from argparse importNamespace5      6LOAD_SMALL_INT         0                      6  8LOAD_CONST             ('Namespace',)         7  ######################################################10IMPORT_NAME            argparse               8  # Textual imports.12IMPORT_FROM            Namespace              9  from textual.app importInvalidThemeError14STORE_NAME             Namespace             10  16POP_TOP                 11  ######################################################9      18LOAD_SMALL_INT         0                     12  # Textual enhanced imports.20LOAD_CONST             ('InvalidThemeError'… 13  from textual_enhanced.app importEnhancedApp22IMPORT_NAME            textual.app           14  24IMPORT_FROM            InvalidThemeError     15  ######################################################26STORE_NAME             InvalidThemeError     16  # Local imports.28POP_TOP                 17  from.import __version__ 13     30LOAD_SMALL_INT         0                     18  from.data import(32LOAD_CONST             ('EnhancedApp',)      19      load_configuration, AST────────────────────────────────────────────────────── 20      update_configuration,Module 21  )body 22  from.screens importMainExpr 23  value 24  Constant 25  ######################################################value 26  classDHV(EnhancedApp[None]):'The main application class.' 27  """The main application class."""kind 28  None 29      HELP_TITLE =f"DHV v{__version__}"ImportFrom 30      HELP_ABOUT =""" module 31      `DHV` is a terminal-based Python code explorer; it'argparse' 32      by and is maintained by [Dave Pearson](https://wwwnames 33      Free Software and can be [found on alias 34      GitHub](https://github.com/davep/dhv). name 35      """'Namespace' 36      HELP_LICENSE =""" asname  f1 Help  f5 Opcode Counts  f10 Quit  ^n New  ^l Load ^p Commands

nord DHV v0.8.1 — Python 3.14.0  Source─────────────────────────────────────────────────── Disassembly──────────────────────────────────────────────  1  """The main application class."""0      0RESUME                 0                      2  1      2LOAD_CONST             'The main application  3  ######################################################class.'                4  # Python imports.4STORE_NAME             __doc__                5  from argparse importNamespace5      6LOAD_SMALL_INT         0                      6  8LOAD_CONST             ('Namespace',)         7  ######################################################10IMPORT_NAME            argparse               8  # Textual imports.12IMPORT_FROM            Namespace              9  from textual.app importInvalidThemeError14STORE_NAME             Namespace             10  16POP_TOP                 11  ######################################################9      18LOAD_SMALL_INT         0                     12  # Textual enhanced imports.20LOAD_CONST             ('InvalidThemeError'… 13  from textual_enhanced.app importEnhancedApp22IMPORT_NAME            textual.app           14  24IMPORT_FROM            InvalidThemeError     15  ######################################################26STORE_NAME             InvalidThemeError     16  # Local imports.28POP_TOP                 17  from.import __version__ 13     30LOAD_SMALL_INT         0                     18  from.data import(32LOAD_CONST             ('EnhancedApp',)      19      load_configuration, AST────────────────────────────────────────────────────── 20      update_configuration,Module 21  )body 22  from.screens importMainExpr 23  value 24  Constant 25  ######################################################value 26  classDHV(EnhancedApp[None]):'The main application class.' 27  """The main application class."""kind 28  None 29      HELP_TITLE =f"DHV v{__version__}"ImportFrom 30      HELP_ABOUT =""" module 31      `DHV` is a terminal-based Python code explorer; it'argparse' 32      by and is maintained by [Dave Pearson](https://wwwnames 33      Free Software and can be [found on alias 34      GitHub](https://github.com/davep/dhv). name 35      """'Namespace' 36      HELP_LICENSE =""" asname  f1 Help  f5 Opcode Counts  f10 Quit  ^n New  ^l Load ^p Commands

catppuccin-latte DHV v0.8.1 — Python 3.14.0  Source─────────────────────────────────────────────────── Disassembly──────────────────────────────────────────────  1  """The main application class."""0      0RESUME                 0                      2  1      2LOAD_CONST             'The main application  3  ######################################################class.'                4  # Python imports.4STORE_NAME             __doc__                5  from argparse importNamespace5      6LOAD_SMALL_INT         0                      6  8LOAD_CONST             ('Namespace',)         7  ######################################################10IMPORT_NAME            argparse               8  # Textual imports.12IMPORT_FROM            Namespace              9  from textual.app importInvalidThemeError14STORE_NAME             Namespace             10  16POP_TOP                 11  ######################################################9      18LOAD_SMALL_INT         0                     12  # Textual enhanced imports.20LOAD_CONST             ('InvalidThemeError'… 13  from textual_enhanced.app importEnhancedApp22IMPORT_NAME            textual.app           14  24IMPORT_FROM            InvalidThemeError     15  ######################################################26STORE_NAME             InvalidThemeError     16  # Local imports.28POP_TOP                 17  from.import __version__ 13     30LOAD_SMALL_INT         0                     18  from.data import(32LOAD_CONST             ('EnhancedApp',)      19      load_configuration, AST────────────────────────────────────────────────────── 20      update_configuration,Module 21  )body 22  from.screens importMainExpr 23  value 24  Constant 25  ######################################################value 26  classDHV(EnhancedApp[None]):'The main application class.' 27  """The main application class."""kind 28  None 29      HELP_TITLE =f"DHV v{__version__}"ImportFrom 30      HELP_ABOUT =""" module 31      `DHV` is a terminal-based Python code explorer; it'argparse' 32      by and is maintained by [Dave Pearson](https://wwwnames 33      Free Software and can be [found on alias 34      GitHub](https://github.com/davep/dhv). name 35      """'Namespace' 36      HELP_LICENSE =""" asname  f1 Help  f5 Opcode Counts  f10 Quit  ^n New  ^l Load ^p Commands

dracula DHV v0.8.1 — Python 3.14.0  Source─────────────────────────────────────────────────── Disassembly──────────────────────────────────────────────  1  """The main application class."""0      0RESUME                 0                      2  1      2LOAD_CONST             'The main application  3  ######################################################class.'                4  # Python imports.4STORE_NAME             __doc__                5  from argparse importNamespace5      6LOAD_SMALL_INT         0                      6  8LOAD_CONST             ('Namespace',)         7  ######################################################10IMPORT_NAME            argparse               8  # Textual imports.12IMPORT_FROM            Namespace              9  from textual.app importInvalidThemeError14STORE_NAME             Namespace             10  16POP_TOP                 11  ######################################################9      18LOAD_SMALL_INT         0                     12  # Textual enhanced imports.20LOAD_CONST             ('InvalidThemeError'… 13  from textual_enhanced.app importEnhancedApp22IMPORT_NAME            textual.app           14  24IMPORT_FROM            InvalidThemeError     15  ######################################################26STORE_NAME             InvalidThemeError     16  # Local imports.28POP_TOP                 17  from.import __version__ 13     30LOAD_SMALL_INT         0                     18  from.data import(32LOAD_CONST             ('EnhancedApp',)      19      load_configuration, AST────────────────────────────────────────────────────── 20      update_configuration,Module 21  )body 22  from.screens importMainExpr 23  value 24  Constant 25  ######################################################value 26  classDHV(EnhancedApp[None]):'The main application class.' 27  """The main application class."""kind 28  None 29      HELP_TITLE =f"DHV v{__version__}"ImportFrom 30      HELP_ABOUT =""" module 31      `DHV` is a terminal-based Python code explorer; it'argparse' 32      by and is maintained by [Dave Pearson](https://wwwnames 33      Free Software and can be [found on alias 34      GitHub](https://github.com/davep/dhv). name 35      """'Namespace' 36      HELP_LICENSE =""" asname  f1 Help  f5 Opcode Counts  f10 Quit  ^n New  ^l Load ^p Commands