akinomyoga / ble.sh

Bash Line Editor―a line editor written in pure Bash with syntax highlighting, auto suggestions, vim modes, etc. for Bash interactive sessions.
BSD 3-Clause "New" or "Revised" License
2.33k stars 77 forks source link

Unable to set ble-face `syntax_function_name` #419

Closed Jai-JAP closed 4 months ago

Jai-JAP commented 4 months ago
GNU bash, version 5.2.26(1)-release (x86_64-pc-linux-gnu) [Manjaro Linux]
ble.sh, version 0.4.0-devel4+18dd51ab (noarch) [git 2.43.2, GNU Make 4.4.1, GNU Awk 5.3.0, API 4.0, PMA Avon 8-g1, (GNU MPFR 4.2.1, GNU MP 6.3.0)]
bash-completion, version 2.11 (hash:2d02f73e803daa87a06e94e33b2a7b3e672a2c0c, 76338 bytes) (noarch)
locale: LANG=en_IN.UTF-8
terminal: TERM=xterm-256color wcwidth=15.0-west/15.1-2+ri, vte:7402 (65;7402;1)

Using the ble-face commands to customize the colors in my terminal, setting syntax_function_name using

ble-face -s syntax-function-name fg=108,bold

# OR

ble-face syntax-function-name='fg=108,bold'

doesn`t change the color of functions called on the shell.

EDIT:

I haven't tried changing all the faces but most of them seem ok.

The same issue is reproducible on a fresh ble.sh install.

akinomyoga commented 4 months ago
ble-face -s syntax-function-name fg=108,bold

# OR

ble-face syntax-function-name='fg=108,bold'

You are using syntax-function-name. You need to use syntax_function_name. The underscore and hyphen are treated differently.

Jai-JAP commented 4 months ago
ble-face -s syntax-function-name fg=108,bold

# OR

ble-face syntax-function-name='fg=108,bold'

You are using syntax-function-name. You need to use syntax_function_name. The underscore and hyphen are treated differently.

Sorry for that typo. But I do use underscores in my config and it's still the same.

Here's my .blerc for reference

if [[ "$TERM_PROGRAM" != "vscode" ]]; then
  if [[ ! "$PREFIX" =~ "com.termux" ]]; then
    ble-import contrib/prompt-git
    bleopt prompt_rps1='\q{contrib/git-branch} \q{contrib/git-hash}' prompt_rps1_transient=1
  fi

  ble-bind -f 'C-h' delete-backward-cword
  ble-bind -m emacs -f 'C-w' ''
else
  ble-bind -f 'C-h' ''
  ble-bind -m emacs -f 'C-w' delete-backward-cword
fi

bleopt edit_vbell= \
  decode_error_char_vbell= \
  decode_error_cseq_vbell= \
  decode_error_kseq_vbell=

ble-face auto_complete='fg=240' \
  command_builtin='fg=86' \
  command_builtin_dot='fg=86' \
  syntax_quotation='fg=124,bold' \
  syntax_quoted='fg=136,bold' \
  syntax_delimiter='fg=88,bold' \
  syntax_function_name='fg=108,bold'

bleopt prompt_ps1_final="\g{bold,fg=70}🠶🡆  "

bleopt indent_offset=2 indent_tabs=0
blehook CHPWD="echo -ne '\Uf024b ➞ \033[33;1m'; pwd | sed 's|'$HOME'|~|'; echo -e '\033[0m'"
blehook POSTEXEC="echo ''" # Separate command outputs

EDIT: Also is there a better way to separate output of the previous command from the current prompt with an empty line?

akinomyoga commented 4 months ago

What would you expect by setting syntax_function_name? The following phrase in the first report seems to imply that you are trying to change the color of the name of the command that matches a function name.

doesn`t change the color of functions called on the shell.

Then, it's not syntax_function_name but command_function. The face syntax_function_name is used to highlight the function name of the function definition (such as function HERE { ...; } and HERE() { ...; }), which is determined at the syntax level. The function names appearing as part of the command are determined dynamically so are not syntax-level highlighting.

Jai-JAP commented 4 months ago

That seems to work fine. Sorry for the confusion.

Another Question: Is there a better way to separate the output of the previous command from the current prompt with an empty line? I currently do that with POSTEXEC="echo ' '"

akinomyoga commented 4 months ago

Another Question: Is there a better way to separate the output of the previous command from the current prompt with an empty line? I currently do that with POSTEXEC="echo ' '"

Ah, sorry. I missed it. You can use bleopt prompt_ruler. To separate the prompt and command line from the output of the previous command by an empty line, you can use the following setting:

# blerc

bleopt prompt_ruler=empty-line
Jai-JAP commented 4 months ago

Thanks for your quick reply. Closing this issue.

akinomyoga commented 4 months ago

Thanks!