Skip to main content
  1. Lumesh Document/

Configuration Files

912 words·5 mins
Table of Contents

Configuration File Paths
#

  • To view the configuration file path, type About and check the prelude item, or use :About.prelude.

  • Default Path:

If no configuration file path is specified in the command line, Lume will read the default configuration file located at lumesh/config.lm under the default path.

PlatformPathExample
Linux$XDG_CONFIG_HOME or $HOME/.config/home/alice/.config
macOS$HOME/Library/Application Support/Users/Alice/Library/Application Support
Windows{FOLDERID_RoamingAppData}C:\Users\Alice\AppData\Roaming

You can execute Fs.dirs() to view your default paths.

History File Paths
#

If not specified in the configuration file, history will be saved in the default path.

On Linux/macOS, the filename is .lume_history. On Windows, the filename is lume_history.log.

Default paths:

PlatformPathExample
Linux$XDG_CACHE_HOME or $HOME/.cache/home/alice/.cache
macOS$HOME/Library/Caches/Users/Alice/Library/Caches
Windows{FOLDERID_LocalAppData}C:\Users\Alice\AppData\Local

You can execute Into.dirs() to view your default paths.

Configuration Items
#

  1. Support for configuring different modes separately. By checking IS_LOGIN and IS_INTERACTIVE, different configurations can be applied for different modes.

  2. AI Interface Configuration.

 1# ====== default AI Helper settings. following is default.
 2let LUME_AI_CONFIG = {
 3    host: "localhost:11434",
 4    complete_url: "/completion",
 5    chat_url: "/v1/chat/completions",
 6    complete_max_tokens: 10,
 7    chat_max_tokens: 100,
 8    model: "",
 9    system_prompt: "you're a lumesh shell script helper",
10}
  1. Key Binding Command Configuration.
 1# ====== key bindings
 2# NONE:0, SHIFT:2, ALT:4, CTRL:8,
 3# ALT_SHIFT:6, CTRL_SHIFT: 10, CTRL_ALT:12, CTRL_ALT_SHIFT:14
 4let LUME_HOT_MODIFIER = 4
 5let LUME_HOT_KEYS = {
 6    q: "exit",
 7    c: "clear",
 8    h: "Fs.read ~/.cache/.lume_history | String.lines() | Ui.pick('select history:') ?! | exec_str()",
 9    x: "Fs.read ~/.cache/bookmark | String.lines() | Ui.pick('select bookmark:') ?! | exec_str()",
10    m: 'let cmd := "$CMD_CURRENT";let s = Into.str(cmd); if s {s+"\n" >> /tmp/bookmark;println "\t[MARKED]"}',
11}
  1. Command Abbreviation Configuration.
1# ====== abbreviations
2let LUME_ABBREVIATIONS = {
3    xi: 'doas pacman -S',
4    xup: 'doas pacman -Syu',
5    xq: 'pacman -Q',
6    xs: 'pacman -Ss',
7    xr: 'doas pacman -Rs',
8}
  1. Command Alias Configuration.
 1# ====== alias
 2alias int = Into.int()
 3alias str = Into.str()
 4alias each = List.map()
 5alias sort = List.sort()
 6alias group = List.group()
 7alias table = Into.table()
 8alias format = String.format()
 9alias ll = Fs.ls -l
10alias lsx = ls -l --time-style=long-iso
11alias join = List.join()
12alias chars = String.chars()
13alias open = Fs.read()
  1. History File Path Configuration.
1# ====== history file
2let LUME_HISTORY_FILE = "/tmp/lume_history"
  1. Prompt Configuration.

    1    # MODE: 1=use template; 2=use starship; 0=use default.
    2    let LUME_PROMPT_SETTINGS = {
    3        MODE: 1,
    4        TTL_SECS: 2
    5    }

    The command line prompt can operate in the following modes:

    • 0, default mode

    • 1, template mode, where the template can be a regular expression or function.

      TTL is used to control the cache update frequency, in seconds.

      Generally, regular expressions are more resource-efficient;

      1# Templates support the following variables: $CWD, $CWD_SHORT
      2let LUME_PROMPT_TEMPLATE = (String.blue($CWD_SHORT) + String.yellow(String.bold(">> ")))

      Function templates can be used to render more complex prompts, such as displaying the git branch. Function templates consume slightly more resources than regular templates.

      1let LUME_PROMPT_TEMPLATE := x -> {
      2    String.format "{} {}{}{} " String.blue(x) String.green(String.bold("|")) \
      3    (if (Into.exists '.git') {git branch --show-current | String.cyan()} else "") \
      4    String.green(String.bold(">"))
      5}
    • 2, starship mode

  2. Welcome Message

1# ====== welcome msg
2let LUME_WELCOME = "Welcome to Lumesh!"
  1. Enable VI Mode
1LUME_VI_MODE = True
  1. Enable Strict Mode
1   # ====== default strict mode
2   let STRICT = True

This setting has the lowest priority and may be overridden by the command parameter -s or the script-specified mode.

  1. Control Direct Print Mode
1   # ====== default strict mode
2   let STRICT = True

This mode controls whether to directly print the results and types of arithmetic channels. It is enabled by default. For example, after entering 5, you will see:

1>> [Integer] <<
25
  1. Sudo Command Completion
1   # ====== default strict mode
2   let LUME_SUDO_CMD = "doas"

Pressing Alt+s will automatically add the sudo command. If you use doas or another sudo command, you can configure this option. The default value is sudo.

  1. Configure PATH Environment Variable
1PATH = "~/.local/bin:" + $PATH
  1. Configure IFS
1IFS = "\n"
2# IFS affect: 0:never; 2:cmd args; 4:for;  8:string.split; 16:csv; 32:pick; 62:all
3let LUME_IFS_MODE=2

The latter is used to refine control over where IFS is enabled.

  1. Configure Global Module Path
1let LUME_MODULES_PATH=/opt/mods

When importing modules, it will first search in the current path's ./mods/, then ./, and finally in the global path.

  1. Configure Maximum Recursion Depth
1let LUME_MAX_SYNTAX_RECURSION = 100   # Syntax nesting depth
2let LUME_MAX_RUNTIME_RECURSION = 800  # Execution depth

This setting does not affect the execution of loop statements. It should only be set when you see a system prompt indicating that the depth needs to be increased.

  1. Highlight Theme Configuration
1# ====== base theme: 'one_dark', 'ayu_dark', 'light'
2LUME_THEME = 'ayu_dark'
3
4# ====== theme modify
5LUME_THEME_CONFIG = {
6   keyword: "\x1b[38;5;170m",      # Purple (#C678DD)
7   #    ...
8}

LUME_THEME is used to set the base theme;

LUME_THEME_CONFIG is used to modify the base theme, where configurable items include:

 1# One Dark core syntax colors - each using a different color
 2 keyword,
 3 value_symbol,
 4 operator,
 5 operator_prefix,
 6 operator_infix,
 7 operator_postfix,
 8
 9 # String-related colors
10 string_raw,
11 string_template,
12 string_literal,
13 string_error,
14
15 # Numbers and literals
16 number_literal,
17 number_error,
18 integer_literal,
19 float_literal,
20
21 # Symbols and identifiers
22 symbol_none,
23 builtin_cmd,
24 symbol,
25
26 # Comments and punctuation
27 comment,
28 punctuation,
29
30 # REPL and interaction-related
31 command_valid,
32 hint,
33 completion_cmd,
34 completion_ai,
35
36 # Time token colors
37 time,
38
39 # Regex token colors
40 regex,

Related